Commit 58ad846f authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: nfsd4_release_lockowner() oops fix

Fix oops in release_lockowner.  We need to break out to two loops, not just
one, and if the loop finds nothing, 'local' won't be NULL.  So just put the
body of the 'if' inside the loop.

From: Andy Adamson <andros@citi.umich.edu>
From: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6b8ba437
...@@ -2334,28 +2334,27 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner * ...@@ -2334,28 +2334,27 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *
/* find the lockowner */ /* find the lockowner */
status = nfs_ok; status = nfs_ok;
for (i=0; i < LOCK_HASH_SIZE; i++) { for (i=0; i < LOCK_HASH_SIZE; i++)
list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash) { list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash)
if(cmp_owner_str(local, owner, clid)) if(cmp_owner_str(local, owner, clid)) {
break; struct nfs4_stateid *stp;
}
} /* check for any locks held by any stateid
if (local) { * associated with the (lock) stateowner */
struct nfs4_stateid *stp; status = nfserr_locks_held;
list_for_each_entry(stp, &local->so_perfilestate,
/* check for any locks held by any stateid associated with the st_perfilestate) {
* (lock) stateowner */ if(stp->st_vfs_set) {
status = nfserr_locks_held; if (check_for_locks(&stp->st_vfs_file,
list_for_each_entry(stp, &local->so_perfilestate, st_perfilestate) { local))
if(stp->st_vfs_set) { goto out;
if (check_for_locks(&stp->st_vfs_file, local)) }
goto out; }
/* no locks held by (lock) stateowner */
status = nfs_ok;
release_stateowner(local);
goto out;
} }
}
/* no locks held by (lock) stateowner */
status = nfs_ok;
release_stateowner(local);
}
out: out:
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment