cifs: Add mount option -o reparse=none
authorPali Rohár <pali@kernel.org>
Sat, 21 Sep 2024 14:15:30 +0000 (16:15 +0200)
committerSteve French <stfrench@microsoft.com>
Wed, 29 Jan 2025 23:35:38 +0000 (17:35 -0600)
This new mount option allows to completely disable creating new reparse
points. When -o sfu or -o mfsymlinks or -o symlink= is not specified then
creating any special file (fifo, socket, symlink, block and char) will fail
with -EOPNOTSUPP error.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsglob.h
fs/smb/client/fs_context.c
fs/smb/client/fs_context.h

index 9a96f69e67d0433aaf319ee52a8d289cf351e2c9..ee9754fad3e8af50de9857ce7c602c7c4d4f3112 100644 (file)
@@ -160,6 +160,7 @@ enum upcall_target_enum {
 };
 
 enum cifs_reparse_type {
+       CIFS_REPARSE_TYPE_NONE,
        CIFS_REPARSE_TYPE_NFS,
        CIFS_REPARSE_TYPE_WSL,
        CIFS_REPARSE_TYPE_DEFAULT = CIFS_REPARSE_TYPE_NFS,
@@ -168,6 +169,8 @@ enum cifs_reparse_type {
 static inline const char *cifs_reparse_type_str(enum cifs_reparse_type type)
 {
        switch (type) {
+       case CIFS_REPARSE_TYPE_NONE:
+               return "none";
        case CIFS_REPARSE_TYPE_NFS:
                return "nfs";
        case CIFS_REPARSE_TYPE_WSL:
index 5a9a5e04fb0513d3e87167b59332e072f3d4f4cb..821eb149e4b885919d1736344a77ae2c9f05ea54 100644 (file)
@@ -334,6 +334,7 @@ cifs_parse_cache_flavor(struct fs_context *fc, char *value, struct smb3_fs_conte
 
 static const match_table_t reparse_flavor_tokens = {
        { Opt_reparse_default,  "default" },
+       { Opt_reparse_none,     "none" },
        { Opt_reparse_nfs,      "nfs" },
        { Opt_reparse_wsl,      "wsl" },
        { Opt_reparse_err,      NULL },
@@ -348,6 +349,9 @@ static int parse_reparse_flavor(struct fs_context *fc, char *value,
        case Opt_reparse_default:
                ctx->reparse_type = CIFS_REPARSE_TYPE_DEFAULT;
                break;
+       case Opt_reparse_none:
+               ctx->reparse_type = CIFS_REPARSE_TYPE_NONE;
+               break;
        case Opt_reparse_nfs:
                ctx->reparse_type = CIFS_REPARSE_TYPE_NFS;
                break;
@@ -1828,8 +1832,10 @@ enum cifs_symlink_type get_cifs_symlink_type(struct cifs_sb_info *cifs_sb)
                        return CIFS_SYMLINK_TYPE_SFU;
                else if (cifs_sb->ctx->linux_ext && !cifs_sb->ctx->no_linux_ext)
                        return CIFS_SYMLINK_TYPE_UNIX;
-               else
+               else if (cifs_sb->ctx->reparse_type != CIFS_REPARSE_TYPE_NONE)
                        return CIFS_SYMLINK_TYPE_NATIVE;
+               else
+                       return CIFS_SYMLINK_TYPE_NONE;
        } else {
                return cifs_sb->ctx->symlink_type;
        }
index 204643428068cbb1ad4a2bf6c45dbe9d843828b0..2ccdda350267ff332ac6d6ffee9b00cb18d2dc26 100644 (file)
@@ -43,6 +43,7 @@ enum {
 
 enum cifs_reparse_parm {
        Opt_reparse_default,
+       Opt_reparse_none,
        Opt_reparse_nfs,
        Opt_reparse_wsl,
        Opt_reparse_err