aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 03:54:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 03:54:24 -0500
commit85004cc367abc000aa36c0d0e270ab609a68b0cb (patch)
tree5739aae778d67b6d119fe5c668313fc2823e9836 /fs/nfs/nfs4state.c
parent149a051f82d2b3860fe32fa182dbc83a66274894 (diff)
parent3fbd67ad61f6d5a09ea717b56c50bc5c3d8042a8 (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (118 commits) NFSv4: Iterate through all nfs_clients when the server recalls a delegation NFSv4: Deal more correctly with duplicate delegations NFS: Fix a potential race between umount and nfs_access_cache_shrinker() NFS: Add an asynchronous delegreturn operation for use in nfs_clear_inode nfs: convert NFS_*(inode) helpers to static inline nfs: obliterate NFS_FLAGS macro NFS: Address memory leaks in the NFS client mount option parser nfs4: allow nfsv4 acls on non-regular-files NFS: Optimise away the sigmask code in aio/dio reads and writes SUNRPC: Don't bother changing the sigmask for asynchronous RPC calls SUNRPC: rpcb_getport_sync() passes incorrect address size to rpc_create() SUNRPC: Clean up block comment preceding rpcb_getport_sync() SUNRPC: Use appropriate argument types in rpcb client SUNRPC: rpcb_getport_sync() should use built-in hostname generator SUNRPC: Clean up functions that free address_strings array NFS: NFS version number is unsigned NLM: Fix a bogus 'return' in nlmclnt_rpc_release NLM: Introduce an arguments structure for nlmclnt_init() NLM/NFS: Use cached nlm_host when calling nlmclnt_proc() NFS: Invoke nlmclnt_init during NFS mount processing ...
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 5a39c6f78acf..f9c7432471dc 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -644,27 +644,26 @@ void nfs4_copy_stateid(nfs4_stateid *dst, struct nfs4_state *state, fl_owner_t f
644 644
645struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter) 645struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter)
646{ 646{
647 struct rpc_sequence *sequence = counter->sequence;
648 struct nfs_seqid *new; 647 struct nfs_seqid *new;
649 648
650 new = kmalloc(sizeof(*new), GFP_KERNEL); 649 new = kmalloc(sizeof(*new), GFP_KERNEL);
651 if (new != NULL) { 650 if (new != NULL) {
652 new->sequence = counter; 651 new->sequence = counter;
653 spin_lock(&sequence->lock); 652 INIT_LIST_HEAD(&new->list);
654 list_add_tail(&new->list, &sequence->list);
655 spin_unlock(&sequence->lock);
656 } 653 }
657 return new; 654 return new;
658} 655}
659 656
660void nfs_free_seqid(struct nfs_seqid *seqid) 657void nfs_free_seqid(struct nfs_seqid *seqid)
661{ 658{
662 struct rpc_sequence *sequence = seqid->sequence->sequence; 659 if (!list_empty(&seqid->list)) {
660 struct rpc_sequence *sequence = seqid->sequence->sequence;
663 661
664 spin_lock(&sequence->lock); 662 spin_lock(&sequence->lock);
665 list_del(&seqid->list); 663 list_del(&seqid->list);
666 spin_unlock(&sequence->lock); 664 spin_unlock(&sequence->lock);
667 rpc_wake_up(&sequence->wait); 665 rpc_wake_up(&sequence->wait);
666 }
668 kfree(seqid); 667 kfree(seqid);
669} 668}
670 669
@@ -675,6 +674,7 @@ void nfs_free_seqid(struct nfs_seqid *seqid)
675 */ 674 */
676static void nfs_increment_seqid(int status, struct nfs_seqid *seqid) 675static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
677{ 676{
677 BUG_ON(list_first_entry(&seqid->sequence->sequence->list, struct nfs_seqid, list) != seqid);
678 switch (status) { 678 switch (status) {
679 case 0: 679 case 0:
680 break; 680 break;
@@ -726,15 +726,15 @@ int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
726 struct rpc_sequence *sequence = seqid->sequence->sequence; 726 struct rpc_sequence *sequence = seqid->sequence->sequence;
727 int status = 0; 727 int status = 0;
728 728
729 if (sequence->list.next == &seqid->list)
730 goto out;
731 spin_lock(&sequence->lock); 729 spin_lock(&sequence->lock);
732 if (sequence->list.next != &seqid->list) { 730 if (list_empty(&seqid->list))
733 rpc_sleep_on(&sequence->wait, task, NULL, NULL); 731 list_add_tail(&seqid->list, &sequence->list);
734 status = -EAGAIN; 732 if (list_first_entry(&sequence->list, struct nfs_seqid, list) == seqid)
735 } 733 goto unlock;
734 rpc_sleep_on(&sequence->wait, task, NULL, NULL);
735 status = -EAGAIN;
736unlock:
736 spin_unlock(&sequence->lock); 737 spin_unlock(&sequence->lock);
737out:
738 return status; 738 return status;
739} 739}
740 740
@@ -758,8 +758,9 @@ static void nfs4_recover_state(struct nfs_client *clp)
758 758
759 __module_get(THIS_MODULE); 759 __module_get(THIS_MODULE);
760 atomic_inc(&clp->cl_count); 760 atomic_inc(&clp->cl_count);
761 task = kthread_run(reclaimer, clp, "%u.%u.%u.%u-reclaim", 761 task = kthread_run(reclaimer, clp, "%s-reclaim",
762 NIPQUAD(clp->cl_addr.sin_addr)); 762 rpc_peeraddr2str(clp->cl_rpcclient,
763 RPC_DISPLAY_ADDR));
763 if (!IS_ERR(task)) 764 if (!IS_ERR(task))
764 return; 765 return;
765 nfs4_clear_recover_bit(clp); 766 nfs4_clear_recover_bit(clp);
@@ -970,8 +971,8 @@ out:
970 module_put_and_exit(0); 971 module_put_and_exit(0);
971 return 0; 972 return 0;
972out_error: 973out_error:
973 printk(KERN_WARNING "Error: state recovery failed on NFSv4 server %u.%u.%u.%u with error %d\n", 974 printk(KERN_WARNING "Error: state recovery failed on NFSv4 server %s"
974 NIPQUAD(clp->cl_addr.sin_addr), -status); 975 " with error %d\n", clp->cl_hostname, -status);
975 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); 976 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
976 goto out; 977 goto out;
977} 978}