diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6f228b5af819..8bee93469617 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -5439,15 +5439,15 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock * | |||
5439 | return err; | 5439 | return err; |
5440 | } | 5440 | } |
5441 | 5441 | ||
5442 | static int do_vfs_lock(struct file *file, struct file_lock *fl) | 5442 | static int do_vfs_lock(struct inode *inode, struct file_lock *fl) |
5443 | { | 5443 | { |
5444 | int res = 0; | 5444 | int res = 0; |
5445 | switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { | 5445 | switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { |
5446 | case FL_POSIX: | 5446 | case FL_POSIX: |
5447 | res = posix_lock_file_wait(file, fl); | 5447 | res = posix_lock_inode_wait(inode, fl); |
5448 | break; | 5448 | break; |
5449 | case FL_FLOCK: | 5449 | case FL_FLOCK: |
5450 | res = flock_lock_file_wait(file, fl); | 5450 | res = flock_lock_inode_wait(inode, fl); |
5451 | break; | 5451 | break; |
5452 | default: | 5452 | default: |
5453 | BUG(); | 5453 | BUG(); |
@@ -5484,7 +5484,6 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, | |||
5484 | atomic_inc(&lsp->ls_count); | 5484 | atomic_inc(&lsp->ls_count); |
5485 | /* Ensure we don't close file until we're done freeing locks! */ | 5485 | /* Ensure we don't close file until we're done freeing locks! */ |
5486 | p->ctx = get_nfs_open_context(ctx); | 5486 | p->ctx = get_nfs_open_context(ctx); |
5487 | get_file(fl->fl_file); | ||
5488 | memcpy(&p->fl, fl, sizeof(p->fl)); | 5487 | memcpy(&p->fl, fl, sizeof(p->fl)); |
5489 | p->server = NFS_SERVER(inode); | 5488 | p->server = NFS_SERVER(inode); |
5490 | return p; | 5489 | return p; |
@@ -5496,7 +5495,6 @@ static void nfs4_locku_release_calldata(void *data) | |||
5496 | nfs_free_seqid(calldata->arg.seqid); | 5495 | nfs_free_seqid(calldata->arg.seqid); |
5497 | nfs4_put_lock_state(calldata->lsp); | 5496 | nfs4_put_lock_state(calldata->lsp); |
5498 | put_nfs_open_context(calldata->ctx); | 5497 | put_nfs_open_context(calldata->ctx); |
5499 | fput(calldata->fl.fl_file); | ||
5500 | kfree(calldata); | 5498 | kfree(calldata); |
5501 | } | 5499 | } |
5502 | 5500 | ||
@@ -5509,7 +5507,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data) | |||
5509 | switch (task->tk_status) { | 5507 | switch (task->tk_status) { |
5510 | case 0: | 5508 | case 0: |
5511 | renew_lease(calldata->server, calldata->timestamp); | 5509 | renew_lease(calldata->server, calldata->timestamp); |
5512 | do_vfs_lock(calldata->fl.fl_file, &calldata->fl); | 5510 | do_vfs_lock(calldata->lsp->ls_state->inode, &calldata->fl); |
5513 | if (nfs4_update_lock_stateid(calldata->lsp, | 5511 | if (nfs4_update_lock_stateid(calldata->lsp, |
5514 | &calldata->res.stateid)) | 5512 | &calldata->res.stateid)) |
5515 | break; | 5513 | break; |
@@ -5617,7 +5615,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock * | |||
5617 | mutex_lock(&sp->so_delegreturn_mutex); | 5615 | mutex_lock(&sp->so_delegreturn_mutex); |
5618 | /* Exclude nfs4_reclaim_open_stateid() - note nesting! */ | 5616 | /* Exclude nfs4_reclaim_open_stateid() - note nesting! */ |
5619 | down_read(&nfsi->rwsem); | 5617 | down_read(&nfsi->rwsem); |
5620 | if (do_vfs_lock(request->fl_file, request) == -ENOENT) { | 5618 | if (do_vfs_lock(inode, request) == -ENOENT) { |
5621 | up_read(&nfsi->rwsem); | 5619 | up_read(&nfsi->rwsem); |
5622 | mutex_unlock(&sp->so_delegreturn_mutex); | 5620 | mutex_unlock(&sp->so_delegreturn_mutex); |
5623 | goto out; | 5621 | goto out; |
@@ -5758,7 +5756,7 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata) | |||
5758 | data->timestamp); | 5756 | data->timestamp); |
5759 | if (data->arg.new_lock) { | 5757 | if (data->arg.new_lock) { |
5760 | data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); | 5758 | data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); |
5761 | if (do_vfs_lock(data->fl.fl_file, &data->fl) < 0) { | 5759 | if (do_vfs_lock(lsp->ls_state->inode, &data->fl) < 0) { |
5762 | rpc_restart_call_prepare(task); | 5760 | rpc_restart_call_prepare(task); |
5763 | break; | 5761 | break; |
5764 | } | 5762 | } |
@@ -6000,7 +5998,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
6000 | if (status != 0) | 5998 | if (status != 0) |
6001 | goto out; | 5999 | goto out; |
6002 | request->fl_flags |= FL_ACCESS; | 6000 | request->fl_flags |= FL_ACCESS; |
6003 | status = do_vfs_lock(request->fl_file, request); | 6001 | status = do_vfs_lock(state->inode, request); |
6004 | if (status < 0) | 6002 | if (status < 0) |
6005 | goto out; | 6003 | goto out; |
6006 | down_read(&nfsi->rwsem); | 6004 | down_read(&nfsi->rwsem); |
@@ -6008,7 +6006,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
6008 | /* Yes: cache locks! */ | 6006 | /* Yes: cache locks! */ |
6009 | /* ...but avoid races with delegation recall... */ | 6007 | /* ...but avoid races with delegation recall... */ |
6010 | request->fl_flags = fl_flags & ~FL_SLEEP; | 6008 | request->fl_flags = fl_flags & ~FL_SLEEP; |
6011 | status = do_vfs_lock(request->fl_file, request); | 6009 | status = do_vfs_lock(state->inode, request); |
6012 | up_read(&nfsi->rwsem); | 6010 | up_read(&nfsi->rwsem); |
6013 | goto out; | 6011 | goto out; |
6014 | } | 6012 | } |