NFSv4: Don't call close if the open stateid has already been cleared
authorTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 14 Nov 2016 16:19:56 +0000 (11:19 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 18 Nov 2016 19:18:02 +0000 (14:18 -0500)
Ensure we test to see if the open stateid is actually set, before we
send a CLOSE.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4proc.c

index 0b3cdf8563339bf194a38221d6f9c17f3f12fee2..2d1481eb19291938816704b257e4c542da38172f 100644 (file)
@@ -3122,7 +3122,8 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
        } else if (is_rdwr)
                calldata->arg.fmode |= FMODE_READ|FMODE_WRITE;
 
-       if (!nfs4_valid_open_stateid(state))
+       if (!nfs4_valid_open_stateid(state) ||
+           test_bit(NFS_OPEN_STATE, &state->flags) == 0)
                call_close = 0;
        spin_unlock(&state->owner->so_lock);