Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b134fc4a authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker
Browse files

NFSv4: Don't test open_stateid unless it is set



We need to test the NFS_OPEN_STATE flag for whether or not the
open_stateid is valid.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Tested-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 272289a3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2587,6 +2587,11 @@ static int nfs41_check_open_stateid(struct nfs4_state *state)
	struct rpc_cred *cred = state->owner->so_cred;
	int status;

	if (test_bit(NFS_OPEN_STATE, &state->flags) == 0) {
		if (test_bit(NFS_DELEGATED_STATE, &state->flags) == 0)
			return NFS_OK;
		return -NFS4ERR_BAD_STATEID;
	}
	/* If a state reset has been done, test_stateid is unneeded */
	if ((test_bit(NFS_O_RDONLY_STATE, &state->flags) == 0) &&
	    (test_bit(NFS_O_WRONLY_STATE, &state->flags) == 0) &&