This is a note to let you know that I've just added the patch titled

    nfsd4: remember to put RW access on stateid destruction

to the 3.0-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nfsd4-remember-to-put-rw-access-on-stateid-destruction.patch
and it can be found in the queue-3.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 499f3edc23ca0431f3a0a6736b3a40944c81bf3b Mon Sep 17 00:00:00 2001
From: "J. Bruce Fields" <[email protected]>
Date: Mon, 27 Jun 2011 16:57:12 -0400
Subject: nfsd4: remember to put RW access on stateid destruction

From: "J. Bruce Fields" <[email protected]>

commit 499f3edc23ca0431f3a0a6736b3a40944c81bf3b upstream.

Without this, for example,

        open read
        open read+write
        close

will result in a struct file leak.

Regression from 7d94784293096c0a46897acdb83be5abd9278ece "nfsd4: fix
downgrade/lock logic".

Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 fs/nfsd/nfs4state.c |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -381,14 +381,6 @@ static int nfs4_access_to_omode(u32 acce
        BUG();
 }
 
-static int nfs4_access_bmap_to_omode(struct nfs4_stateid *stp)
-{
-       unsigned int access;
-
-       set_access(&access, stp->st_access_bmap);
-       return nfs4_access_to_omode(access);
-}
-
 static void unhash_generic_stateid(struct nfs4_stateid *stp)
 {
        list_del(&stp->st_hash);
@@ -398,11 +390,14 @@ static void unhash_generic_stateid(struc
 
 static void free_generic_stateid(struct nfs4_stateid *stp)
 {
-       int oflag;
+       int i;
 
        if (stp->st_access_bmap) {
-               oflag = nfs4_access_bmap_to_omode(stp);
-               nfs4_file_put_access(stp->st_file, oflag);
+               for (i = 1; i < 4; i++) {
+                       if (test_bit(i, &stp->st_access_bmap))
+                               nfs4_file_put_access(stp->st_file,
+                                               nfs4_access_to_omode(i));
+               }
        }
        put_nfs4_file(stp->st_file);
        kmem_cache_free(stateid_slab, stp);


Patches currently in stable-queue which might be from [email protected] are

queue-3.0/svcrpc-fix-list-corrupting-race-on-nfsd-shutdown.patch
queue-3.0/nfsd4-remember-to-put-rw-access-on-stateid-destruction.patch
queue-3.0/nfsd-don-t-break-lease-on-claim_delegate_cur.patch
queue-3.0/nfsd4-fix-file-leak-on-open_downgrade.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to