Skip to content

Commit 2a9d683

Browse files
author
Trond Myklebust
committed
NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0
The NFSv4.0 protocol only supports open() by name. It cannot therefore be used with open_by_handle() and friends, nor can it be re-exported by knfsd. Reported-by: Chuck Lever III <[email protected]> Fixes: 20fa190 ("nfs: add export operations") Signed-off-by: Trond Myklebust <[email protected]>
1 parent 1781481 commit 2a9d683

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

fs/nfs/super.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,22 +1051,31 @@ static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
10511051
if (ctx->bsize)
10521052
sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits);
10531053

1054-
if (server->nfs_client->rpc_ops->version != 2) {
1055-
/* The VFS shouldn't apply the umask to mode bits. We will do
1056-
* so ourselves when necessary.
1054+
switch (server->nfs_client->rpc_ops->version) {
1055+
case 2:
1056+
sb->s_time_gran = 1000;
1057+
sb->s_time_min = 0;
1058+
sb->s_time_max = U32_MAX;
1059+
break;
1060+
case 3:
1061+
/*
1062+
* The VFS shouldn't apply the umask to mode bits.
1063+
* We will do so ourselves when necessary.
10571064
*/
10581065
sb->s_flags |= SB_POSIXACL;
10591066
sb->s_time_gran = 1;
1060-
sb->s_export_op = &nfs_export_ops;
1061-
} else
1062-
sb->s_time_gran = 1000;
1063-
1064-
if (server->nfs_client->rpc_ops->version != 4) {
10651067
sb->s_time_min = 0;
10661068
sb->s_time_max = U32_MAX;
1067-
} else {
1069+
sb->s_export_op = &nfs_export_ops;
1070+
break;
1071+
case 4:
1072+
sb->s_flags |= SB_POSIXACL;
1073+
sb->s_time_gran = 1;
10681074
sb->s_time_min = S64_MIN;
10691075
sb->s_time_max = S64_MAX;
1076+
if (server->caps & NFS_CAP_ATOMIC_OPEN_V1)
1077+
sb->s_export_op = &nfs_export_ops;
1078+
break;
10701079
}
10711080

10721081
sb->s_magic = NFS_SUPER_MAGIC;

0 commit comments

Comments
 (0)