8000 NFS: Fix another OPEN_DOWNGRADE bug · bsd-unix/linux@e547f26 · GitHub
[go: up one dir, main page]

Skip to content

Commit e547f26

Browse files
trondmypdamschuma-ntap
authored andcommitted
NFS: Fix another OPEN_DOWNGRADE bug
Olga Kornievskaia reports that the following test fails to trigger an OPEN_DOWNGRADE on the wire, and only triggers the final CLOSE. fd0 = open(foo, RDRW) -- should be open on the wire for "both" fd1 = open(foo, RDONLY) -- should be open on the wire for "read" close(fd0) -- should trigger an open_downgrade read(fd1) close(fd1) The issue is that we're missing a check for whether or not the current state transitioned from an O_RDWR state as opposed to having transitioned from a combination of O_RDONLY and O_WRONLY. Reported-by: Olga Kornievskaia <aglo@umich.edu> Fixes: cd9288f ("NFSv4: Fix another bug in the close/open_downgrade code") Cc: stable@vger.kernel.org # 2.6.33+ Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent d20cb71 commit e547f26

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/nfs/nfs4proc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,12 +2882,11 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
28822882
call_close |= is_wronly;
28832883
else if (is_wronly)
28842884
calldata->arg.fmode |= FMODE_WRITE;
2885+
if (calldata->arg.fmode != (FMODE_READ|FMODE_WRITE))
2886+
call_close |= is_rdwr;
28852887
} else if (is_rdwr)
28862888
calldata->arg.fmode |= FMODE_READ|FMODE_WRITE;
28872889

2888-
if (calldata->arg.fmode == 0)
2889-
call_close |= is_rdwr;
2890-
28912890
if (!nfs4_valid_open_stateid(state))
28922891
call_close = 0;
28932892
spin_unlock(&state->owner->so_lock);

0 commit comments

Comments
 (0)
0