Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 61ea647

Browse files
committed
Merge tag 'nfsd-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd updates from Chuck Lever: "This is a light release containing mostly optimizations, code clean- ups, and minor bug fixes. This development cycle has focused on non- upstream kernel work: 1. Continuing to build upstream CI for NFSD, based on kdevops 2. Backporting NFSD filecache-related fixes to selected LTS kernels One notable new feature in v6.10 NFSD is the addition of a new netlink protocol dedicated to configuring NFSD. A new user space tool, nfsdctl, is to be added to nfs-utils. Lots more to come here. As always I am very grateful to NFSD contributors, reviewers, testers, and bug reporters who participated during this cycle" * tag 'nfsd-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (29 commits) NFSD: Force all NFSv4.2 COPY requests to be synchronous SUNRPC: Fix gss_free_in_token_pages() NFS/knfsd: Remove the invalid NFS error 'NFSERR_OPNOTSUPP' knfsd: LOOKUP can return an illegal error value nfsd: set security label during create operations NFSD: Add COPY status code to OFFLOAD_STATUS response NFSD: Record status of async copy operation in struct nfsd4_copy SUNRPC: Remove comment for sp_lock NFSD: add listener-{set,get} netlink command SUNRPC: add a new svc_find_listener helper SUNRPC: introduce svc_xprt_create_from_sa utility routine NFSD: add write_version to netlink command NFSD: convert write_threads to netlink command NFSD: allow callers to pass in scope string to nfsd_svc NFSD: move nfsd_mutex handling into nfsd_svc callers lockd: host: Remove unnecessary statements'host = NULL;' nfsd: don't create nfsv4recoverydir in nfsdfs when not used. nfsd: optimise recalculate_deny_mode() for a common case nfsd: add tracepoint in mark_client_expired_locked nfsd: new tracepoint for check_slot_seqid ...
2 parents 25f4874 + 8d915bb commit 61ea647

File tree

29 files changed

+1286
-271
lines changed

29 files changed

+1286
-271
lines changed

Documentation/netlink/specs/nfsd.yaml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,59 @@ attribute-sets:
6262
name: compound-ops
6363
type: u32
6464
multi-attr: true
65+
-
66+
name: server
67+
attributes:
68+
-
69+
name: threads
70+
type: u32
71+
multi-attr: true
72+
-
73+
name: gracetime
74+
type: u32
75+
-
76+
name: leasetime
77+
type: u32
78+
-
79+
name: scope
80+
type: string
81+
-
82+
name: version
83+
attributes:
84+
-
85+
name: major
86+
type: u32
87+
-
88+
name: minor
89+
type: u32
90+
-
91+
name: enabled
92+
type: flag
93+
-
94+
name: server-proto
95+
attributes:
96+
-
97+
name: version
98+
type: nest
99+
nested-attributes: version
100+
multi-attr: true
101+
-
102+
name: sock
103+
attributes:
104+
-
105+
name: addr
106+
type: binary
107+
-
108+
name: transport-name
109+
type: string
110+
-
111+
name: server-sock
112+
attributes:
113+
-
114+
name: addr
115+
type: nest
116+
nested-attributes: sock
117+
multi-attr: true
65118

66119
operations:
67120
list:
@@ -87,3 +140,60 @@ operations:
87140
- sport
88141
- dport
89142
- compound-ops
143+
-
144+
name: threads-set
145+
doc: set the number of running threads
146+
attribute-set: server
147+
flags: [ admin-perm ]
148+
do:
149+
request:
150+
attributes:
151+
- threads
152+
- gracetime
153+
- leasetime
154+
- scope
155+
-
156+
name: threads-get
157+
doc: get the number of running threads
158+
attribute-set: server
159+
do:
160+
reply:
161+
attributes:
162+
- threads
163+
- gracetime
164+
- leasetime
165+
- scope
166+
-
167+
name: version-set
168+
doc: set nfs enabled versions
169+
attribute-set: server-proto
170+
flags: [ admin-perm ]
171+
do:
172+
request:
173+
attributes:
174+
- version
175+
-
176+
name: version-get
177+
doc: get nfs enabled versions
178+
attribute-set: server-proto
179+
do:
180+
reply:
181+
attributes:
182+
- version
183+
-
184+
name: listener-set
185+
doc: set nfs running sockets
186+
attribute-set: server-sock
187+
flags: [ admin-perm ]
188+
do:
189+
request:
190+
attributes:
191+
- addr
192+
-
193+
name: listener-get
194+
doc: get nfs running listeners
195+
attribute-set: server-sock
196+
do:
197+
reply:
198+
attributes:
199+
- addr

fs/lockd/host.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni,
117117
if (nsm != NULL)
118118
refcount_inc(&nsm->sm_count);
119119
else {
120-
host = NULL;
121120
nsm = nsm_get_handle(ni->net, ni->sap, ni->salen,
122121
ni->hostname, ni->hostname_len);
123122
if (unlikely(nsm == NULL)) {

fs/nfsd/export.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,21 +334,25 @@ static void nfsd4_fslocs_free(struct nfsd4_fs_locations *fsloc)
334334
static int export_stats_init(struct export_stats *stats)
335335
{
336336
stats->start_time = ktime_get_seconds();
337-
return nfsd_percpu_counters_init(stats->counter, EXP_STATS_COUNTERS_NUM);
337+
return percpu_counter_init_many(stats->counter, 0, GFP_KERNEL,
338+
EXP_STATS_COUNTERS_NUM);
338339
}
339340

340341
static void export_stats_reset(struct export_stats *stats)
341342
{
342-
if (stats)
343-
nfsd_percpu_counters_reset(stats->counter,
344-
EXP_STATS_COUNTERS_NUM);
343+
if (stats) {
344+
int i;
345+
346+
for (i = 0; i < EXP_STATS_COUNTERS_NUM; i++)
347+
percpu_counter_set(&stats->counter[i], 0);
348+
}
345349
}
346350

347351
static void export_stats_destroy(struct export_stats *stats)
348352
{
349353
if (stats)
350-
nfsd_percpu_counters_destroy(stats->counter,
351-
EXP_STATS_COUNTERS_NUM);
354+
percpu_counter_destroy_many(stats->counter,
355+
EXP_STATS_COUNTERS_NUM);
352356
}
353357

354358
static void svc_export_put(struct kref *ref)

fs/nfsd/netlink.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,36 @@
1010

1111
#include <uapi/linux/nfsd_netlink.h>
1212

13+
/* Common nested types */
14+
const struct nla_policy nfsd_sock_nl_policy[NFSD_A_SOCK_TRANSPORT_NAME + 1] = {
15+
[NFSD_A_SOCK_ADDR] = { .type = NLA_BINARY, },
16+
[NFSD_A_SOCK_TRANSPORT_NAME] = { .type = NLA_NUL_STRING, },
17+
};
18+
19+
const struct nla_policy nfsd_version_nl_policy[NFSD_A_VERSION_ENABLED + 1] = {
20+
[NFSD_A_VERSION_MAJOR] = { .type = NLA_U32, },
21+
[NFSD_A_VERSION_MINOR] = { .type = NLA_U32, },
22+
[NFSD_A_VERSION_ENABLED] = { .type = NLA_FLAG, },
23+
};
24+
25+
/* NFSD_CMD_THREADS_SET - do */
26+
static const struct nla_policy nfsd_threads_set_nl_policy[NFSD_A_SERVER_SCOPE + 1] = {
27+
[NFSD_A_SERVER_THREADS] = { .type = NLA_U32, },
28+
[NFSD_A_SERVER_GRACETIME] = { .type = NLA_U32, },
29+
[NFSD_A_SERVER_LEASETIME] = { .type = NLA_U32, },
30+
[NFSD_A_SERVER_SCOPE] = { .type = NLA_NUL_STRING, },
31+
};
32+
33+
/* NFSD_CMD_VERSION_SET - do */
34+
static const struct nla_policy nfsd_version_set_nl_policy[NFSD_A_SERVER_PROTO_VERSION + 1] = {
35+
[NFSD_A_SERVER_PROTO_VERSION] = NLA_POLICY_NESTED(nfsd_version_nl_policy),
36+
};
37+
38+
/* NFSD_CMD_LISTENER_SET - do */
39+
static const struct nla_policy nfsd_listener_set_nl_policy[NFSD_A_SERVER_SOCK_ADDR + 1] = {
40+
[NFSD_A_SERVER_SOCK_ADDR] = NLA_POLICY_NESTED(nfsd_sock_nl_policy),
41+
};
42+
1343
/* Ops table for nfsd */
1444
static const struct genl_split_ops nfsd_nl_ops[] = {
1545
{
@@ -19,6 +49,42 @@ static const struct genl_split_ops nfsd_nl_ops[] = {
1949
.done = nfsd_nl_rpc_status_get_done,
2050
.flags = GENL_CMD_CAP_DUMP,
2151
},
52+
{
53+
.cmd = NFSD_CMD_THREADS_SET,
54+
.doit = nfsd_nl_threads_set_doit,
55+
.policy = nfsd_threads_set_nl_policy,
56+
.maxattr = NFSD_A_SERVER_SCOPE,
57+
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
58+
},
59+
{
60+
.cmd = NFSD_CMD_THREADS_GET,
61+
.doit = nfsd_nl_threads_get_doit,
62+
.flags = GENL_CMD_CAP_DO,
63+
},
64+
{
65+
.cmd = NFSD_CMD_VERSION_SET,
66+
.doit = nfsd_nl_version_set_doit,
67+
.policy = nfsd_version_set_nl_policy,
68+
.maxattr = NFSD_A_SERVER_PROTO_VERSION,
69+
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
70+
},
71+
{
72+
.cmd = NFSD_CMD_VERSION_GET,
73+
.doit = nfsd_nl_version_get_doit,
74+
.flags = GENL_CMD_CAP_DO,
75+
},
76+
{
77+
.cmd = NFSD_CMD_LISTENER_SET,
78+
.doit = nfsd_nl_listener_set_doit,
79+
.policy = nfsd_listener_set_nl_policy,
80+
.maxattr = NFSD_A_SERVER_SOCK_ADDR,
81+
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
82+
},
83+
{
84+
.cmd = NFSD_CMD_LISTENER_GET,
85+
.doit = nfsd_nl_listener_get_doit,
86+
.flags = GENL_CMD_CAP_DO,
87+
},
2288
};
2389

2490
struct genl_family nfsd_nl_family __ro_after_init = {

fs/nfsd/netlink.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,21 @@
1111

1212
#include <uapi/linux/nfsd_netlink.h>
1313

14+
/* Common nested types */
15+
extern const struct nla_policy nfsd_sock_nl_policy[NFSD_A_SOCK_TRANSPORT_NAME + 1];
16+
extern const struct nla_policy nfsd_version_nl_policy[NFSD_A_VERSION_ENABLED + 1];
17+
1418
int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb);
1519
int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb);
1620

1721
int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
1822
struct netlink_callback *cb);
23+
int nfsd_nl_threads_set_doit(struct sk_buff *skb, struct genl_info *info);
24+
int nfsd_nl_threads_get_doit(struct sk_buff *skb, struct genl_info *info);
25+
int nfsd_nl_version_set_doit(struct sk_buff *skb, struct genl_info *info);
26+
int nfsd_nl_version_get_doit(struct sk_buff *skb, struct genl_info *info);
27+
int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info);
28+
int nfsd_nl_listener_get_doit(struct sk_buff *skb, struct genl_info *info);
1929

2030
extern struct genl_family nfsd_nl_family;
2131

fs/nfsd/netns.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ struct nfsd_net {
218218
/* Simple check to find out if a given net was properly initialized */
219219
#define nfsd_netns_ready(nn) ((nn)->sessionid_hashtbl)
220220

221+
extern bool nfsd_support_version(int vers);
221222
extern void nfsd_netns_free_versions(struct nfsd_net *nn);
222223

223224
extern unsigned int nfsd_net_id;

fs/nfsd/nfs4callback.c

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -978,12 +978,12 @@ static int max_cb_time(struct net *net)
978978
return max(((u32)nn->nfsd4_lease)/10, 1u) * HZ;
979979
}
980980

981-
static struct workqueue_struct *callback_wq;
982-
983981
static bool nfsd4_queue_cb(struct nfsd4_callback *cb)
984982
{
985-
trace_nfsd_cb_queue(cb->cb_clp, cb);
986-
return queue_work(callback_wq, &cb->cb_work);
983+
struct nfs4_client *clp = cb->cb_clp;
984+
985+
trace_nfsd_cb_queue(clp, cb);
986+
return queue_work(clp->cl_callback_wq, &cb->cb_work);
987987
}
988988

989989
static void nfsd41_cb_inflight_begin(struct nfs4_client *clp)
@@ -1153,7 +1153,7 @@ void nfsd4_probe_callback(struct nfs4_client *clp)
11531153
void nfsd4_probe_callback_sync(struct nfs4_client *clp)
11541154
{
11551155
nfsd4_probe_callback(clp);
1156-
flush_workqueue(callback_wq);
1156+
flush_workqueue(clp->cl_callback_wq);
11571157
}
11581158

11591159
void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn)
@@ -1372,19 +1372,6 @@ static const struct rpc_call_ops nfsd4_cb_ops = {
13721372
.rpc_release = nfsd4_cb_release,
13731373
};
13741374

1375-
int nfsd4_create_callback_queue(void)
1376-
{
1377-
callback_wq = alloc_ordered_workqueue("nfsd4_callbacks", 0);
1378-
if (!callback_wq)
1379-
return -ENOMEM;
1380-
return 0;
1381-
}
1382-
1383-
void nfsd4_destroy_callback_queue(void)
1384-
{
1385-
destroy_workqueue(callback_wq);
1386-
}
1387-
13881375
/* must be called under the state lock */
13891376
void nfsd4_shutdown_callback(struct nfs4_client *clp)
13901377
{
@@ -1398,7 +1385,7 @@ void nfsd4_shutdown_callback(struct nfs4_client *clp)
13981385
* client, destroy the rpc client, and stop:
13991386
*/
14001387
nfsd4_run_cb(&clp->cl_cb_null);
1401-
flush_workqueue(callback_wq);
1388+
flush_workqueue(clp->cl_callback_wq);
14021389
nfsd41_cb_inflight_wait_complete(clp);
14031390
}
14041391

@@ -1420,9 +1407,9 @@ static struct nfsd4_conn * __nfsd4_find_backchannel(struct nfs4_client *clp)
14201407

14211408
/*
14221409
* Note there isn't a lot of locking in this code; instead we depend on
1423-
* the fact that it is run from the callback_wq, which won't run two
1424-
* work items at once. So, for example, callback_wq handles all access
1425-
* of cl_cb_client and all calls to rpc_create or rpc_shutdown_client.
1410+
* the fact that it is run from clp->cl_callback_wq, which won't run two
1411+
* work items at once. So, for example, clp->cl_callback_wq handles all
1412+
* access of cl_cb_client and all calls to rpc_create or rpc_shutdown_client.
14261413
*/
14271414
static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
14281415
{

0 commit comments

Comments
 (0)