tree 706511b06aeeee25615f45701e640d01f4f1d51a
parent f1ee4f22f21d74bc3ca63b95ca5b63d3a8620527
author NeilBrown <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:26:38 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:26:38 -0700

[PATCH] nfsd4: fix struct file leak

We were failing to close on an error path, resulting in a leak of struct files
which could take a v4 server down fairly quickly....  So call
nfs4_close_delegation instead of just open-coding parts of it.

Simplify the cleanup on delegation failure while we're at it.

Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 nfsd/nfs4state.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Index: fs/nfsd/nfs4state.c
===================================================================
--- 29b860a31e5cb1d52f1d3a63290a2d0da7c905dd/fs/nfsd/nfs4state.c  (mode:100644 
sha1:579f7fea79681102ca0e22fad2ae3ce7db47d650)
+++ 706511b06aeeee25615f45701e640d01f4f1d51a/fs/nfsd/nfs4state.c  (mode:100644 
sha1:75e8b137580c29730d84cd6c58ef60f68ec84c3e)
@@ -190,7 +190,8 @@
        dp->dl_vfs_file = NULL;
        /* The following nfsd_close may not actually close the file,
         * but we want to remove the lease in any case. */
-       setlease(filp, F_UNLCK, &dp->dl_flock);
+       if (dp->dl_flock)
+               setlease(filp, F_UNLCK, &dp->dl_flock);
        nfsd_close(filp);
        vfsclose++;
 }
@@ -1673,10 +1674,7 @@
        if ((status = setlease(stp->st_vfs_file,
                flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK, &flp))) {
                dprintk("NFSD: setlease failed [%d], no delegation\n", status);
-               list_del(&dp->dl_del_perfile);
-               list_del(&dp->dl_del_perclnt);
-               nfs4_put_delegation(dp);
-               free_delegation++;
+               unhash_delegation(dp);
                flag = NFS4_OPEN_DELEGATE_NONE;
                goto out;
        }
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to