diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 9019e8ec9dc8..56347e0ac88d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -2614,7 +2614,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta | |||
2614 | struct nfs4_delegation *dp; | 2614 | struct nfs4_delegation *dp; |
2615 | struct nfs4_stateowner *sop = stp->st_stateowner; | 2615 | struct nfs4_stateowner *sop = stp->st_stateowner; |
2616 | int cb_up = atomic_read(&sop->so_client->cl_cb_set); | 2616 | int cb_up = atomic_read(&sop->so_client->cl_cb_set); |
2617 | struct file_lock fl, *flp = &fl; | 2617 | struct file_lock *fl; |
2618 | int status, flag = 0; | 2618 | int status, flag = 0; |
2619 | 2619 | ||
2620 | flag = NFS4_OPEN_DELEGATE_NONE; | 2620 | flag = NFS4_OPEN_DELEGATE_NONE; |
@@ -2648,20 +2648,24 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta | |||
2648 | flag = NFS4_OPEN_DELEGATE_NONE; | 2648 | flag = NFS4_OPEN_DELEGATE_NONE; |
2649 | goto out; | 2649 | goto out; |
2650 | } | 2650 | } |
2651 | locks_init_lock(&fl); | 2651 | status = -ENOMEM; |
2652 | fl.fl_lmops = &nfsd_lease_mng_ops; | 2652 | fl = locks_alloc_lock(); |
2653 | fl.fl_flags = FL_LEASE; | 2653 | if (!fl) |
2654 | fl.fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK; | 2654 | goto out; |
2655 | fl.fl_end = OFFSET_MAX; | 2655 | locks_init_lock(fl); |
2656 | fl.fl_owner = (fl_owner_t)dp; | 2656 | fl->fl_lmops = &nfsd_lease_mng_ops; |
2657 | fl.fl_file = find_readable_file(stp->st_file); | 2657 | fl->fl_flags = FL_LEASE; |
2658 | BUG_ON(!fl.fl_file); | 2658 | fl->fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK; |
2659 | fl.fl_pid = current->tgid; | 2659 | fl->fl_end = OFFSET_MAX; |
2660 | fl->fl_owner = (fl_owner_t)dp; | ||
2661 | fl->fl_file = find_readable_file(stp->st_file); | ||
2662 | BUG_ON(!fl->fl_file); | ||
2663 | fl->fl_pid = current->tgid; | ||
2660 | 2664 | ||
2661 | /* vfs_setlease checks to see if delegation should be handed out. | 2665 | /* vfs_setlease checks to see if delegation should be handed out. |
2662 | * the lock_manager callbacks fl_mylease and fl_change are used | 2666 | * the lock_manager callbacks fl_mylease and fl_change are used |
2663 | */ | 2667 | */ |
2664 | if ((status = vfs_setlease(fl.fl_file, fl.fl_type, &flp))) { | 2668 | if ((status = vfs_setlease(fl->fl_file, fl->fl_type, &fl))) { |
2665 | dprintk("NFSD: setlease failed [%d], no delegation\n", status); | 2669 | dprintk("NFSD: setlease failed [%d], no delegation\n", status); |
2666 | unhash_delegation(dp); | 2670 | unhash_delegation(dp); |
2667 | flag = NFS4_OPEN_DELEGATE_NONE; | 2671 | flag = NFS4_OPEN_DELEGATE_NONE; |