aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@netapp.com>2015-03-02 16:46:09 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-03-02 18:06:42 -0500
commit369d6b7f00977eb9090212d4a47ac71f3ec5c217 (patch)
treea4185c4f13e62871747b08ac28bcb42c8a86b87f /fs
parent7c0af9ffb7bb4e5355470fa60b3eb711ddf226fa (diff)
NFS: Fix stateid used for NFS v4 closes
After 566fcec60 the client uses the "current stateid" from the nfs4_state structure to close a file. This could potentially contain a delegation stateid, which is disallowed by the protocol and causes servers to return NFS4ERR_BAD_STATEID. This patch restores the (correct) behavior of sending the open stateid to close a file. Reported-by: Olga Kornievskaia <kolga@netapp.com> Fixes: 566fcec60 (NFSv4: Fix an atomicity problem in CLOSE) Signed-off-by: Anna Schumaker <Anna.Schumaker@netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a211daf58c32..732526e04cd5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2655,7 +2655,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
2655 case -NFS4ERR_BAD_STATEID: 2655 case -NFS4ERR_BAD_STATEID:
2656 case -NFS4ERR_EXPIRED: 2656 case -NFS4ERR_EXPIRED:
2657 if (!nfs4_stateid_match(&calldata->arg.stateid, 2657 if (!nfs4_stateid_match(&calldata->arg.stateid,
2658 &state->stateid)) { 2658 &state->open_stateid)) {
2659 rpc_restart_call_prepare(task); 2659 rpc_restart_call_prepare(task);
2660 goto out_release; 2660 goto out_release;
2661 } 2661 }
@@ -2691,7 +2691,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
2691 is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); 2691 is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags);
2692 is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); 2692 is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags);
2693 is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); 2693 is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags);
2694 nfs4_stateid_copy(&calldata->arg.stateid, &state->stateid); 2694 nfs4_stateid_copy(&calldata->arg.stateid, &state->open_stateid);
2695 /* Calculate the change in open mode */ 2695 /* Calculate the change in open mode */
2696 calldata->arg.fmode = 0; 2696 calldata->arg.fmode = 0;
2697 if (state->n_rdwr == 0) { 2697 if (state->n_rdwr == 0) {