]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kNFSd: nfsd4_release_lockowner() oops fix
authorNeil Brown <neilb@cse.unsw.edu.au>
Sat, 5 Jun 2004 03:54:34 +0000 (20:54 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 5 Jun 2004 03:54:34 +0000 (20:54 -0700)
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: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/nfsd/nfs4state.c

index 73a8944ad96ed786b8a878a988e892ca6b4d31b1..63a85b8ad79ffdd1f3dc20a0c0e26455771746ec 100644 (file)
@@ -2334,28 +2334,27 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *
 
        /* find the lockowner */
         status = nfs_ok;
-       for (i=0; i < LOCK_HASH_SIZE; i++) {
-               list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash) {
-                       if(cmp_owner_str(local, owner, clid))
-                               break;
-               }
-       }
-       if (local) {
-               struct nfs4_stateid *stp;
-
-               /* check for any locks held by any stateid associated with the
-                * (lock) stateowner */
-               status = nfserr_locks_held;
-               list_for_each_entry(stp, &local->so_perfilestate, st_perfilestate) {
-                       if(stp->st_vfs_set) {
-                               if (check_for_locks(&stp->st_vfs_file, local))
-                                       goto out;
+       for (i=0; i < LOCK_HASH_SIZE; i++)
+               list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash)
+                       if(cmp_owner_str(local, owner, clid)) {
+                               struct nfs4_stateid *stp;
+
+                               /* check for any locks held by any stateid
+                                * associated with the (lock) stateowner */
+                               status = nfserr_locks_held;
+                               list_for_each_entry(stp, &local->so_perfilestate,
+                                                   st_perfilestate) {
+                                       if(stp->st_vfs_set) {
+                                               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:
        nfs4_unlock_state();
        return status;