aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-04-16 18:26:38 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:26:38 -0400
commitc907132d534c10b4f34a60383c8384403cb424a4 (patch)
tree706511b06aeeee25615f45701e640d01f4f1d51a /fs/nfsd
parentf1ee4f22f21d74bc3ca63b95ca5b63d3a8620527 (diff)
[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>
Diffstat (limited to 'fs/nfsd')
-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)
190 dp->dl_vfs_file = NULL; 190 dp->dl_vfs_file = NULL;
191 /* The following nfsd_close may not actually close the file, 191 /* The following nfsd_close may not actually close the file,
192 * but we want to remove the lease in any case. */ 192 * but we want to remove the lease in any case. */
193 setlease(filp, F_UNLCK, &dp->dl_flock); 193 if (dp->dl_flock)
194 setlease(filp, F_UNLCK, &dp->dl_flock);
194 nfsd_close(filp); 195 nfsd_close(filp);
195 vfsclose++; 196 vfsclose++;
196} 197}
@@ -1673,10 +1674,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
1673 if ((status = setlease(stp->st_vfs_file, 1674 if ((status = setlease(stp->st_vfs_file,
1674 flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK, &flp))) { 1675 flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK, &flp))) {
1675 dprintk("NFSD: setlease failed [%d], no delegation\n", status); 1676 dprintk("NFSD: setlease failed [%d], no delegation\n", status);
1676 list_del(&dp->dl_del_perfile); 1677 unhash_delegation(dp);
1677 list_del(&dp->dl_del_perclnt);
1678 nfs4_put_delegation(dp);
1679 free_delegation++;
1680 flag = NFS4_OPEN_DELEGATE_NONE; 1678 flag = NFS4_OPEN_DELEGATE_NONE;
1681 goto out; 1679 goto out;
1682 } 1680 }