Skip to content

Commit c2fc946

Browse files
committed
Merge tag 'nfsd-6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: - Fix crashes triggered by administrative operations on the server * tag 'nfsd-6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: NFSD: grab nfsd_mutex in nfsd_nl_rpc_status_get_dumpit() nfsd: fix oops when reading pool_stats before server is started
2 parents 563a506 + da2c8fe commit c2fc946

File tree

5 files changed

+16
-47
lines changed

5 files changed

+16
-47
lines changed

Documentation/netlink/specs/nfsd.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ operations:
123123
doc: dump pending nfsd rpc
124124
attribute-set: rpc-status
125125
dump:
126-
pre: nfsd-nl-rpc-status-get-start
127-
post: nfsd-nl-rpc-status-get-done
128126
reply:
129127
attributes:
130128
- xid

fs/nfsd/netlink.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ static const struct nla_policy nfsd_listener_set_nl_policy[NFSD_A_SERVER_SOCK_AD
4444
static const struct genl_split_ops nfsd_nl_ops[] = {
4545
{
4646
.cmd = NFSD_CMD_RPC_STATUS_GET,
47-
.start = nfsd_nl_rpc_status_get_start,
4847
.dumpit = nfsd_nl_rpc_status_get_dumpit,
49-
.done = nfsd_nl_rpc_status_get_done,
5048
.flags = GENL_CMD_CAP_DUMP,
5149
},
5250
{

fs/nfsd/netlink.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
extern const struct nla_policy nfsd_sock_nl_policy[NFSD_A_SOCK_TRANSPORT_NAME + 1];
1616
extern const struct nla_policy nfsd_version_nl_policy[NFSD_A_VERSION_ENABLED + 1];
1717

18-
int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb);
19-
int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb);
20-
2118
int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
2219
struct netlink_callback *cb);
2320
int nfsd_nl_threads_set_doit(struct sk_buff *skb, struct genl_info *info);

fs/nfsd/nfsctl.c

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,28 +1460,6 @@ static int create_proc_exports_entry(void)
14601460

14611461
unsigned int nfsd_net_id;
14621462

1463-
/**
1464-
* nfsd_nl_rpc_status_get_start - Prepare rpc_status_get dumpit
1465-
* @cb: netlink metadata and command arguments
1466-
*
1467-
* Return values:
1468-
* %0: The rpc_status_get command may proceed
1469-
* %-ENODEV: There is no NFSD running in this namespace
1470-
*/
1471-
int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb)
1472-
{
1473-
struct nfsd_net *nn = net_generic(sock_net(cb->skb->sk), nfsd_net_id);
1474-
int ret = -ENODEV;
1475-
1476-
mutex_lock(&nfsd_mutex);
1477-
if (nn->nfsd_serv)
1478-
ret = 0;
1479-
else
1480-
mutex_unlock(&nfsd_mutex);
1481-
1482-
return ret;
1483-
}
1484-
14851463
static int nfsd_genl_rpc_status_compose_msg(struct sk_buff *skb,
14861464
struct netlink_callback *cb,
14871465
struct nfsd_genl_rqstp *rqstp)
@@ -1558,8 +1536,16 @@ static int nfsd_genl_rpc_status_compose_msg(struct sk_buff *skb,
15581536
int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
15591537
struct netlink_callback *cb)
15601538
{
1561-
struct nfsd_net *nn = net_generic(sock_net(skb->sk), nfsd_net_id);
15621539
int i, ret, rqstp_index = 0;
1540+
struct nfsd_net *nn;
1541+
1542+
mutex_lock(&nfsd_mutex);
1543+
1544+
nn = net_generic(sock_net(skb->sk), nfsd_net_id);
1545+
if (!nn->nfsd_serv) {
1546+
ret = -ENODEV;
1547+
goto out_unlock;
1548+
}
15631549

15641550
rcu_read_lock();
15651551

@@ -1636,22 +1622,10 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
16361622
ret = skb->len;
16371623
out:
16381624
rcu_read_unlock();
1639-
1640-
return ret;
1641-
}
1642-
1643-
/**
1644-
* nfsd_nl_rpc_status_get_done - rpc_status_get dumpit post-processing
1645-
* @cb: netlink metadata and command arguments
1646-
*
1647-
* Return values:
1648-
* %0: Success
1649-
*/
1650-
int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb)
1651-
{
1625+
out_unlock:
16521626
mutex_unlock(&nfsd_mutex);
16531627

1654-
return 0;
1628+
return ret;
16551629
}
16561630

16571631
/**

net/sunrpc/svc_xprt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,12 +1421,13 @@ static void *svc_pool_stats_start(struct seq_file *m, loff_t *pos)
14211421

14221422
dprintk("svc_pool_stats_start, *pidx=%u\n", pidx);
14231423

1424+
if (!si->serv)
1425+
return NULL;
1426+
14241427
mutex_lock(si->mutex);
14251428

14261429
if (!pidx)
14271430
return SEQ_START_TOKEN;
1428-
if (!si->serv)
1429-
return NULL;
14301431
return pidx > si->serv->sv_nrpools ? NULL
14311432
: &si->serv->sv_pools[pidx - 1];
14321433
}
@@ -1458,7 +1459,8 @@ static void svc_pool_stats_stop(struct seq_file *m, void *p)
14581459
{
14591460
struct svc_info *si = m->private;
14601461

1461-
mutex_unlock(si->mutex);
1462+
if (si->serv)
1463+
mutex_unlock(si->mutex);
14621464
}
14631465

14641466
static int svc_pool_stats_show(struct seq_file *m, void *p)

0 commit comments

Comments
 (0)