Skip to content

Commit cf453bf

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFSv4: Don't send delegation-related share access modes to CLOSE
When we set the new share access modes for CLOSE in nfs4_close_prepare(). we should only set a mode of NFS4_SHARE_ACCESS_READ, NFS4_SHARE_ACCESS_WRITE or NFS4_SHARE_ACCESS_BOTH. Currently, we may also be passing in the NFSv4.1 share modes for controlling delegation requests in OPEN, which is wrong. Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent adb4b42 commit cf453bf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

fs/nfs/nfs4proc.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,8 +1333,7 @@ static fmode_t _nfs4_ctx_to_openmode(const struct nfs_open_context *ctx)
13331333
}
13341334

13351335
static u32
1336-
nfs4_map_atomic_open_share(struct nfs_server *server,
1337-
fmode_t fmode, int openflags)
1336+
nfs4_fmode_to_share_access(fmode_t fmode)
13381337
{
13391338
u32 res = 0;
13401339

@@ -1348,6 +1347,15 @@ nfs4_map_atomic_open_share(struct nfs_server *server,
13481347
case FMODE_READ|FMODE_WRITE:
13491348
res = NFS4_SHARE_ACCESS_BOTH;
13501349
}
1350+
return res;
1351+
}
1352+
1353+
static u32
1354+
nfs4_map_atomic_open_share(struct nfs_server *server,
1355+
fmode_t fmode, int openflags)
1356+
{
1357+
u32 res = nfs4_fmode_to_share_access(fmode);
1358+
13511359
if (!(server->caps & NFS_CAP_ATOMIC_OPEN_V1))
13521360
goto out;
13531361
/* Want no delegation if we're using O_DIRECT */
@@ -3753,8 +3761,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
37533761
}
37543762

37553763
calldata->arg.share_access =
3756-
nfs4_map_atomic_open_share(NFS_SERVER(inode),
3757-
calldata->arg.fmode, 0);
3764+
nfs4_fmode_to_share_access(calldata->arg.fmode);
37583765

37593766
if (calldata->res.fattr == NULL)
37603767
calldata->arg.bitmask = NULL;

0 commit comments

Comments
 (0)