tree 5511098a1284aad33f7492eb1ab816a54c758369
parent dfa427c7621868a7597717a7d3c38bdc97e2d75b
author NeilBrown <[EMAIL PROTECTED]> Tue Apr 12 08:27:05 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:27:05 2005
[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]>
nfs4state.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
Index: fs/nfsd/nfs4state.c
===================================================================
--- 074c1411c6c53cb32787588263abbd04f760b610/fs/nfsd/nfs4state.c (mode:100644
sha1:f1cfaba9e4ec9da64a42d9ed4b7e74f596882516)
+++ 5511098a1284aad33f7492eb1ab816a54c758369/fs/nfsd/nfs4state.c (mode:100644
sha1:772a48dea17a03842a2f392d4e0a66a4ef2186bf)
@@ -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