Skip to content

Commit 78f6946

Browse files
paliSteve French
authored andcommitted
cifs: Add mount option -o reparse=none
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>
1 parent 660618d commit 78f6946

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

fs/smb/client/cifsglob.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ enum upcall_target_enum {
160160
};
161161

162162
enum cifs_reparse_type {
163+
CIFS_REPARSE_TYPE_NONE,
163164
CIFS_REPARSE_TYPE_NFS,
164165
CIFS_REPARSE_TYPE_WSL,
165166
CIFS_REPARSE_TYPE_DEFAULT = CIFS_REPARSE_TYPE_NFS,
@@ -168,6 +169,8 @@ enum cifs_reparse_type {
168169
static inline const char *cifs_reparse_type_str(enum cifs_reparse_type type)
169170
{
170171
switch (type) {
172+
case CIFS_REPARSE_TYPE_NONE:
173+
return "none";
171174
case CIFS_REPARSE_TYPE_NFS:
172175
return "nfs";
173176
case CIFS_REPARSE_TYPE_WSL:

fs/smb/client/fs_context.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ cifs_parse_cache_flavor(struct fs_context *fc, char *value, struct smb3_fs_conte
334334

335335
static const match_table_t reparse_flavor_tokens = {
336336
{ Opt_reparse_default, "default" },
337+
{ Opt_reparse_none, "none" },
337338
{ Opt_reparse_nfs, "nfs" },
338339
{ Opt_reparse_wsl, "wsl" },
339340
{ Opt_reparse_err, NULL },
@@ -348,6 +349,9 @@ static int parse_reparse_flavor(struct fs_context *fc, char *value,
348349
case Opt_reparse_default:
349350
ctx->reparse_type = CIFS_REPARSE_TYPE_DEFAULT;
350351
break;
352+
case Opt_reparse_none:
353+
ctx->reparse_type = CIFS_REPARSE_TYPE_NONE;
354+
break;
351355
case Opt_reparse_nfs:
352356
ctx->reparse_type = CIFS_REPARSE_TYPE_NFS;
353357
break;
@@ -1828,8 +1832,10 @@ enum cifs_symlink_type get_cifs_symlink_type(struct cifs_sb_info *cifs_sb)
18281832
return CIFS_SYMLINK_TYPE_SFU;
18291833
else if (cifs_sb->ctx->linux_ext && !cifs_sb->ctx->no_linux_ext)
18301834
return CIFS_SYMLINK_TYPE_UNIX;
1831-
else
1835+
else if (cifs_sb->ctx->reparse_type != CIFS_REPARSE_TYPE_NONE)
18321836
return CIFS_SYMLINK_TYPE_NATIVE;
1837+
else
1838+
return CIFS_SYMLINK_TYPE_NONE;
18331839
} else {
18341840
return cifs_sb->ctx->symlink_type;
18351841
}

fs/smb/client/fs_context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ enum {
4343

4444
enum cifs_reparse_parm {
4545
Opt_reparse_default,
46+
Opt_reparse_none,
4647
Opt_reparse_nfs,
4748
Opt_reparse_wsl,
4849
Opt_reparse_err

0 commit comments

Comments
 (0)