summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-04-16 15:26:38 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:26:38 -0700
commitc907132d534c10b4f34a60383c8384403cb424a4 (patch)
tree706511b06aeeee25615f45701e640d01f4f1d51a
parentf1ee4f22f21d74bc3ca63b95ca5b63d3a8620527 (diff)
downloadblackbird-op-linux-c907132d534c10b4f34a60383c8384403cb424a4.tar.gz
blackbird-op-linux-c907132d534c10b4f34a60383c8384403cb424a4.zip
[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 <bfields@citi.umich.edu> 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>
-rw-r--r--fs/nfsd/nfs4state.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 579f7fea7968..75e8b137580c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -190,7 +190,8 @@ nfs4_close_delegation(struct nfs4_delegation *dp)
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 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
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;
}
OpenPOWER on IntegriCloud