aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2010-10-30 17:31:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-30 21:08:15 -0400
commitfcf744a96c66ca6ad7301a372034b771e57f30c4 (patch)
tree4d4094cb2e04b391bd11eedf1466245dc8403704 /fs
parent05fa3135fdc7b9b510b502a35b6b97d2b38c6f48 (diff)
nfsd4: initialize delegation pointer to lease
The NFSv4 server was initializing the dp->dl_flock pointer by the somewhat ridiculous method of a locks_copy_lock callback. Now that setlease uses the passed-in lock instead of doing a copy, dl_flock no longer gets set, resulting in the lock leaking on delegation release, and later possible hangs (among other problems). So, initialize dl_flock and get rid of the callback. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4state.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 56347e0ac88d..b7f818b0580c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2310,22 +2310,6 @@ void nfsd_release_deleg_cb(struct file_lock *fl)
2310} 2310}
2311 2311
2312/* 2312/*
2313 * Set the delegation file_lock back pointer.
2314 *
2315 * Called from setlease() with lock_kernel() held.
2316 */
2317static
2318void nfsd_copy_lock_deleg_cb(struct file_lock *new, struct file_lock *fl)
2319{
2320 struct nfs4_delegation *dp = (struct nfs4_delegation *)new->fl_owner;
2321
2322 dprintk("NFSD: nfsd_copy_lock_deleg_cb: new fl %p dp %p\n", new, dp);
2323 if (!dp)
2324 return;
2325 dp->dl_flock = new;
2326}
2327
2328/*
2329 * Called from setlease() with lock_kernel() held 2313 * Called from setlease() with lock_kernel() held
2330 */ 2314 */
2331static 2315static
@@ -2355,7 +2339,6 @@ int nfsd_change_deleg_cb(struct file_lock **onlist, int arg)
2355static const struct lock_manager_operations nfsd_lease_mng_ops = { 2339static const struct lock_manager_operations nfsd_lease_mng_ops = {
2356 .fl_break = nfsd_break_deleg_cb, 2340 .fl_break = nfsd_break_deleg_cb,
2357 .fl_release_private = nfsd_release_deleg_cb, 2341 .fl_release_private = nfsd_release_deleg_cb,
2358 .fl_copy_lock = nfsd_copy_lock_deleg_cb,
2359 .fl_mylease = nfsd_same_client_deleg_cb, 2342 .fl_mylease = nfsd_same_client_deleg_cb,
2360 .fl_change = nfsd_change_deleg_cb, 2343 .fl_change = nfsd_change_deleg_cb,
2361}; 2344};
@@ -2661,12 +2644,14 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
2661 fl->fl_file = find_readable_file(stp->st_file); 2644 fl->fl_file = find_readable_file(stp->st_file);
2662 BUG_ON(!fl->fl_file); 2645 BUG_ON(!fl->fl_file);
2663 fl->fl_pid = current->tgid; 2646 fl->fl_pid = current->tgid;
2647 dp->dl_flock = fl;
2664 2648
2665 /* vfs_setlease checks to see if delegation should be handed out. 2649 /* vfs_setlease checks to see if delegation should be handed out.
2666 * the lock_manager callbacks fl_mylease and fl_change are used 2650 * the lock_manager callbacks fl_mylease and fl_change are used
2667 */ 2651 */
2668 if ((status = vfs_setlease(fl->fl_file, fl->fl_type, &fl))) { 2652 if ((status = vfs_setlease(fl->fl_file, fl->fl_type, &fl))) {
2669 dprintk("NFSD: setlease failed [%d], no delegation\n", status); 2653 dprintk("NFSD: setlease failed [%d], no delegation\n", status);
2654 dp->dl_flock = NULL;
2670 unhash_delegation(dp); 2655 unhash_delegation(dp);
2671 flag = NFS4_OPEN_DELEGATE_NONE; 2656 flag = NFS4_OPEN_DELEGATE_NONE;
2672 goto out; 2657 goto out;