Skip to content

Commit 1bd773b

Browse files
neilbrownchucklever
authored andcommitted
nfsd: hold nfsd_mutex across entire netlink operation
Rather than using svc_get() and svc_put() to hold a stable reference to the nfsd_svc for netlink lookups, simply hold the mutex for the entire time. The "entire" time isn't very long, and the mutex is not often contented. This makes way for us to remove the refcounts of svc, which is more confusing than useful. Reported-by: Jeff Layton <jlayton@kernel.org> Closes: https://lore.kernel.org/linux-nfs/5d9bbb599569ce29f16e4e0eef6b291eda0f375b.camel@kernel.org/T/#u Fixes: bd9d6a3 ("NFSD: add rpc_status netlink support") Signed-off-by: NeilBrown <neilb@suse.de> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 2a501f5 commit 1bd773b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/nfsd/nfsctl.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,11 +1515,10 @@ int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb)
15151515
int ret = -ENODEV;
15161516

15171517
mutex_lock(&nfsd_mutex);
1518-
if (nn->nfsd_serv) {
1519-
svc_get(nn->nfsd_serv);
1518+
if (nn->nfsd_serv)
15201519
ret = 0;
1521-
}
1522-
mutex_unlock(&nfsd_mutex);
1520+
else
1521+
mutex_unlock(&nfsd_mutex);
15231522

15241523
return ret;
15251524
}
@@ -1691,8 +1690,6 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
16911690
*/
16921691
int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb)
16931692
{
1694-
mutex_lock(&nfsd_mutex);
1695-
nfsd_put(sock_net(cb->skb->sk));
16961693
mutex_unlock(&nfsd_mutex);
16971694

16981695
return 0;

0 commit comments

Comments
 (0)