Commit 043958395a6b91863046b0cd7cae9c67fa845144
Committed by
J. Bruce Fields
1 parent
e5f9570319
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
NFSD: Lock state before calling fault injection function
Each function touches state in some way, so getting the lock earlier can help simplify code. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Showing 2 changed files with 4 additions and 16 deletions Side-by-side Diff
fs/nfsd/fault_inject.c
fs/nfsd/nfs4state.c
... | ... | @@ -4611,13 +4611,11 @@ |
4611 | 4611 | int count = 0; |
4612 | 4612 | struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id); |
4613 | 4613 | |
4614 | - nfs4_lock_state(); | |
4615 | 4614 | list_for_each_entry_safe(clp, next, &nn->client_lru, cl_lru) { |
4616 | 4615 | expire_client(clp); |
4617 | 4616 | if (++count == num) |
4618 | 4617 | break; |
4619 | 4618 | } |
4620 | - nfs4_unlock_state(); | |
4621 | 4619 | |
4622 | 4620 | printk(KERN_INFO "NFSD: Forgot %d clients", count); |
4623 | 4621 | } |
4624 | 4622 | |
4625 | 4623 | |
4626 | 4624 | |
... | ... | @@ -4653,25 +4651,15 @@ |
4653 | 4651 | |
4654 | 4652 | void nfsd_forget_locks(u64 num) |
4655 | 4653 | { |
4656 | - int count; | |
4657 | 4654 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); |
4658 | - | |
4659 | - nfs4_lock_state(); | |
4660 | - count = nfsd_release_n_owners(num, false, release_lockowner_sop, nn); | |
4661 | - nfs4_unlock_state(); | |
4662 | - | |
4655 | + int count = nfsd_release_n_owners(num, false, release_lockowner_sop, nn); | |
4663 | 4656 | printk(KERN_INFO "NFSD: Forgot %d locks", count); |
4664 | 4657 | } |
4665 | 4658 | |
4666 | 4659 | void nfsd_forget_openowners(u64 num) |
4667 | 4660 | { |
4668 | - int count; | |
4669 | 4661 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); |
4670 | - | |
4671 | - nfs4_lock_state(); | |
4672 | - count = nfsd_release_n_owners(num, true, release_openowner_sop, nn); | |
4673 | - nfs4_unlock_state(); | |
4674 | - | |
4662 | + int count = nfsd_release_n_owners(num, true, release_openowner_sop, nn); | |
4675 | 4663 | printk(KERN_INFO "NFSD: Forgot %d open owners", count); |
4676 | 4664 | } |
4677 | 4665 | |
4678 | 4666 | |
... | ... | @@ -4704,10 +4692,8 @@ |
4704 | 4692 | count = nfsd_process_n_delegations(num, &victims); |
4705 | 4693 | spin_unlock(&recall_lock); |
4706 | 4694 | |
4707 | - nfs4_lock_state(); | |
4708 | 4695 | list_for_each_entry_safe(dp, dnext, &victims, dl_recall_lru) |
4709 | 4696 | unhash_delegation(dp); |
4710 | - nfs4_unlock_state(); | |
4711 | 4697 | |
4712 | 4698 | printk(KERN_INFO "NFSD: Forgot %d delegations", count); |
4713 | 4699 | } |