aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-18 17:20:13 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-18 17:20:13 -0400
commit83c9d41e456033000ccfadf535f3098d8739488d (patch)
tree09f5573ba348225bb7eed14c20b3305f49449e06
parente6dfa553cffcb9740f932311dff42f81d6ac63bb (diff)
NFSv4: Remove nfs4_client->cl_sem from close() path
We no longer need to worry about collisions between close() and the state recovery code, since the new close will automatically recheck the file state once it is done waiting on its sequence slot. Ditto for the nfs4_proc_locku() procedure. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4proc.c5
-rw-r--r--fs/nfs/nfs4state.c9
2 files changed, 1 insertions, 13 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 25bab6032dfe..611052bacaff 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -820,12 +820,10 @@ static void nfs4_free_closedata(struct nfs4_closedata *calldata)
820{ 820{
821 struct nfs4_state *state = calldata->state; 821 struct nfs4_state *state = calldata->state;
822 struct nfs4_state_owner *sp = state->owner; 822 struct nfs4_state_owner *sp = state->owner;
823 struct nfs_server *server = NFS_SERVER(calldata->inode);
824 823
825 nfs4_put_open_state(calldata->state); 824 nfs4_put_open_state(calldata->state);
826 nfs_free_seqid(calldata->arg.seqid); 825 nfs_free_seqid(calldata->arg.seqid);
827 nfs4_put_state_owner(sp); 826 nfs4_put_state_owner(sp);
828 up_read(&server->nfs4_state->cl_sem);
829 kfree(calldata); 827 kfree(calldata);
830} 828}
831 829
@@ -2758,7 +2756,6 @@ static int _nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock
2758{ 2756{
2759 struct inode *inode = state->inode; 2757 struct inode *inode = state->inode;
2760 struct nfs_server *server = NFS_SERVER(inode); 2758 struct nfs_server *server = NFS_SERVER(inode);
2761 struct nfs4_client *clp = server->nfs4_state;
2762 struct nfs_lockargs arg = { 2759 struct nfs_lockargs arg = {
2763 .fh = NFS_FH(inode), 2760 .fh = NFS_FH(inode),
2764 .type = nfs4_lck_type(cmd, request), 2761 .type = nfs4_lck_type(cmd, request),
@@ -2778,7 +2775,6 @@ static int _nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock
2778 struct nfs_locku_opargs luargs; 2775 struct nfs_locku_opargs luargs;
2779 int status; 2776 int status;
2780 2777
2781 down_read(&clp->cl_sem);
2782 status = nfs4_set_lock_state(state, request); 2778 status = nfs4_set_lock_state(state, request);
2783 if (status != 0) 2779 if (status != 0)
2784 goto out; 2780 goto out;
@@ -2802,7 +2798,6 @@ static int _nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock
2802out: 2798out:
2803 if (status == 0) 2799 if (status == 0)
2804 do_vfs_lock(request->fl_file, request); 2800 do_vfs_lock(request->fl_file, request);
2805 up_read(&clp->cl_sem);
2806 return status; 2801 return status;
2807} 2802}
2808 2803
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 86c08c165ce7..bb3574361958 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -481,17 +481,15 @@ void nfs4_put_open_state(struct nfs4_state *state)
481} 481}
482 482
483/* 483/*
484 * Beware! Caller must be holding no references to clp->cl_sem! 484 * Close the current file.
485 */ 485 */
486void nfs4_close_state(struct nfs4_state *state, mode_t mode) 486void nfs4_close_state(struct nfs4_state *state, mode_t mode)
487{ 487{
488 struct inode *inode = state->inode; 488 struct inode *inode = state->inode;
489 struct nfs4_state_owner *owner = state->owner; 489 struct nfs4_state_owner *owner = state->owner;
490 struct nfs4_client *clp = owner->so_client;
491 int newstate; 490 int newstate;
492 491
493 atomic_inc(&owner->so_count); 492 atomic_inc(&owner->so_count);
494 down_read(&clp->cl_sem);
495 /* Protect against nfs4_find_state() */ 493 /* Protect against nfs4_find_state() */
496 spin_lock(&inode->i_lock); 494 spin_lock(&inode->i_lock);
497 if (mode & FMODE_READ) 495 if (mode & FMODE_READ)
@@ -523,7 +521,6 @@ void nfs4_close_state(struct nfs4_state *state, mode_t mode)
523out: 521out:
524 nfs4_put_open_state(state); 522 nfs4_put_open_state(state);
525 nfs4_put_state_owner(owner); 523 nfs4_put_state_owner(owner);
526 up_read(&clp->cl_sem);
527} 524}
528 525
529/* 526/*
@@ -704,8 +701,6 @@ void nfs_free_seqid(struct nfs_seqid *seqid)
704} 701}
705 702
706/* 703/*
707 * Called with clp->cl_sem held.
708 *
709 * Increment the seqid if the OPEN/OPEN_DOWNGRADE/CLOSE succeeded, or 704 * Increment the seqid if the OPEN/OPEN_DOWNGRADE/CLOSE succeeded, or
710 * failed with a seqid incrementing error - 705 * failed with a seqid incrementing error -
711 * see comments nfs_fs.h:seqid_mutating_error() 706 * see comments nfs_fs.h:seqid_mutating_error()
@@ -743,8 +738,6 @@ void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid)
743} 738}
744 739
745/* 740/*
746 * Called with clp->cl_sem held.
747 *
748 * Increment the seqid if the LOCK/LOCKU succeeded, or 741 * Increment the seqid if the LOCK/LOCKU succeeded, or
749 * failed with a seqid incrementing error - 742 * failed with a seqid incrementing error -
750 * see comments nfs_fs.h:seqid_mutating_error() 743 * see comments nfs_fs.h:seqid_mutating_error()