Skip to content

Commit 49f4810

Browse files
committed
Merge tag 'nfsd-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd updates from Chuck Lever: "The bulk of the patches for this release are clean-ups and minor bug fixes. There is one significant revert to mention: support for RDMA Read operations in the server's RPC-over-RDMA transport implementation has been fixed so it waits for Read completion in a way that avoids tying up an nfsd thread. This prevents a possible DoS vector if an RPC-over-RDMA client should become unresponsive during RDMA Read operations. As always I am grateful to NFSD contributors, reviewers, and testers" * tag 'nfsd-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (56 commits) nfsd: rename nfsd_last_thread() to nfsd_destroy_serv() SUNRPC: discard sv_refcnt, and svc_get/svc_put svc: don't hold reference for poolstats, only mutex. SUNRPC: remove printk when back channel request not found svcrdma: Implement multi-stage Read completion again svcrdma: Copy construction of svc_rqst::rq_arg to rdma_read_complete() svcrdma: Add back svcxprt_rdma::sc_read_complete_q svcrdma: Add back svc_rdma_recv_ctxt::rc_pages svcrdma: Clean up comment in svc_rdma_accept() svcrdma: Remove queue-shortening warnings svcrdma: Remove pointer addresses shown in dprintk() svcrdma: Optimize svc_rdma_cc_init() svcrdma: De-duplicate completion ID initialization helpers svcrdma: Move the svc_rdma_cc_init() call svcrdma: Remove struct svc_rdma_read_info svcrdma: Update the synopsis of svc_rdma_read_special() svcrdma: Update the synopsis of svc_rdma_read_call_chunk() svcrdma: Update synopsis of svc_rdma_read_multiple_chunks() svcrdma: Update synopsis of svc_rdma_copy_inline_range() svcrdma: Update the synopsis of svc_rdma_read_data_item() ...
2 parents d8c8e59 + 17419ae commit 49f4810

37 files changed

+907
-781
lines changed

fs/lockd/svc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,10 @@ static int lockd_get(void)
345345

346346
serv->sv_maxconn = nlm_max_connections;
347347
error = svc_set_num_threads(serv, NULL, 1);
348-
/* The thread now holds the only reference */
349-
svc_put(serv);
350-
if (error < 0)
348+
if (error < 0) {
349+
svc_destroy(&serv);
351350
return error;
351+
}
352352

353353
nlmsvc_serv = serv;
354354
register_inetaddr_notifier(&lockd_inetaddr_notifier);
@@ -372,11 +372,9 @@ static void lockd_put(void)
372372
unregister_inet6addr_notifier(&lockd_inet6addr_notifier);
373373
#endif
374374

375-
svc_get(nlmsvc_serv);
376375
svc_set_num_threads(nlmsvc_serv, NULL, 0);
377-
svc_put(nlmsvc_serv);
378376
timer_delete_sync(&nlmsvc_retry);
379-
nlmsvc_serv = NULL;
377+
svc_destroy(&nlmsvc_serv);
380378
dprintk("lockd_down: service destroyed\n");
381379
}
382380

fs/nfs/callback.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
187187
* Check whether we're already up and running.
188188
*/
189189
if (cb_info->serv)
190-
return svc_get(cb_info->serv);
190+
return cb_info->serv;
191191

192192
/*
193193
* Sanity check: if there's no task,
@@ -245,9 +245,10 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
245245

246246
cb_info->users++;
247247
err_net:
248-
if (!cb_info->users)
249-
cb_info->serv = NULL;
250-
svc_put(serv);
248+
if (!cb_info->users) {
249+
svc_set_num_threads(cb_info->serv, NULL, 0);
250+
svc_destroy(&cb_info->serv);
251+
}
251252
err_create:
252253
mutex_unlock(&nfs_callback_mutex);
253254
return ret;
@@ -271,11 +272,9 @@ void nfs_callback_down(int minorversion, struct net *net)
271272
nfs_callback_down_net(minorversion, serv, net);
272273
cb_info->users--;
273274
if (cb_info->users == 0) {
274-
svc_get(serv);
275275
svc_set_num_threads(serv, NULL, 0);
276-
svc_put(serv);
277276
dprintk("nfs_callback_down: service destroyed\n");
278-
cb_info->serv = NULL;
277+
svc_destroy(&cb_info->serv);
279278
}
280279
mutex_unlock(&nfs_callback_mutex);
281280
}

fs/nfs/callback.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,6 @@ enum nfs4_callback_procnum {
1919
CB_COMPOUND = 1,
2020
};
2121

22-
enum nfs4_callback_opnum {
23-
OP_CB_GETATTR = 3,
24-
OP_CB_RECALL = 4,
25-
/* Callback operations new to NFSv4.1 */
26-
OP_CB_LAYOUTRECALL = 5,
27-
OP_CB_NOTIFY = 6,
28-
OP_CB_PUSH_DELEG = 7,
29-
OP_CB_RECALL_ANY = 8,
30-
OP_CB_RECALLABLE_OBJ_AVAIL = 9,
31-
OP_CB_RECALL_SLOT = 10,
32-
OP_CB_SEQUENCE = 11,
33-
OP_CB_WANTS_CANCELLED = 12,
34-
OP_CB_NOTIFY_LOCK = 13,
35-
OP_CB_NOTIFY_DEVICEID = 14,
36-
/* Callback operations new to NFSv4.2 */
37-
OP_CB_OFFLOAD = 15,
38-
OP_CB_ILLEGAL = 10044,
39-
};
40-
4122
struct nfs4_slot;
4223
struct cb_process_state {
4324
__be32 drc_status;

fs/nfsd/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,19 @@ config NFSD_V4_SECURITY_LABEL
158158

159159
If you do not wish to enable fine-grained security labels SELinux or
160160
Smack policies on NFSv4 files, say N.
161+
162+
config NFSD_LEGACY_CLIENT_TRACKING
163+
bool "Support legacy NFSv4 client tracking methods (DEPRECATED)"
164+
depends on NFSD_V4
165+
default n
166+
help
167+
The NFSv4 server needs to store a small amount of information on
168+
stable storage in order to handle state recovery after reboot. Most
169+
modern deployments upcall to a userland daemon for this (nfsdcld),
170+
but older NFS servers may store information directly in a
171+
recoverydir, or spawn a process directly using a usermodehelper
172+
upcall.
173+
174+
These legacy client tracking methods have proven to be probelmatic
175+
and will be removed in the future. Say Y here if you need support
176+
for them in the interim.

fs/nfsd/filecache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ nfsd_file_cache_init(void)
717717
return ret;
718718

719719
ret = -ENOMEM;
720-
nfsd_filecache_wq = alloc_workqueue("nfsd_filecache", 0, 0);
720+
nfsd_filecache_wq = alloc_workqueue("nfsd_filecache", WQ_UNBOUND, 0);
721721
if (!nfsd_filecache_wq)
722722
goto out;
723723

fs/nfsd/netns.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,9 @@ struct nfsd_net {
123123
u32 clientid_counter;
124124
u32 clverifier_counter;
125125

126-
struct svc_serv *nfsd_serv;
127-
/* When a listening socket is added to nfsd, keep_active is set
128-
* and this justifies a reference on nfsd_serv. This stops
129-
* nfsd_serv from being freed. When the number of threads is
130-
* set, keep_active is cleared and the reference is dropped. So
131-
* when the last thread exits, the service will be destroyed.
132-
*/
133-
int keep_active;
126+
struct svc_info nfsd_info;
127+
#define nfsd_serv nfsd_info.serv
128+
134129

135130
/*
136131
* clientid and stateid data for construction of net unique COPY

fs/nfsd/nfs4callback.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
*/
3333

34+
#include <linux/nfs4.h>
3435
#include <linux/sunrpc/clnt.h>
3536
#include <linux/sunrpc/xprt.h>
3637
#include <linux/sunrpc/svc_xprt.h>
@@ -87,31 +88,6 @@ static void encode_bitmap4(struct xdr_stream *xdr, const __u32 *bitmap,
8788
WARN_ON_ONCE(xdr_stream_encode_uint32_array(xdr, bitmap, len) < 0);
8889
}
8990

90-
/*
91-
* nfs_cb_opnum4
92-
*
93-
* enum nfs_cb_opnum4 {
94-
* OP_CB_GETATTR = 3,
95-
* ...
96-
* };
97-
*/
98-
enum nfs_cb_opnum4 {
99-
OP_CB_GETATTR = 3,
100-
OP_CB_RECALL = 4,
101-
OP_CB_LAYOUTRECALL = 5,
102-
OP_CB_NOTIFY = 6,
103-
OP_CB_PUSH_DELEG = 7,
104-
OP_CB_RECALL_ANY = 8,
105-
OP_CB_RECALLABLE_OBJ_AVAIL = 9,
106-
OP_CB_RECALL_SLOT = 10,
107-
OP_CB_SEQUENCE = 11,
108-
OP_CB_WANTS_CANCELLED = 12,
109-
OP_CB_NOTIFY_LOCK = 13,
110-
OP_CB_NOTIFY_DEVICEID = 14,
111-
OP_CB_OFFLOAD = 15,
112-
OP_CB_ILLEGAL = 10044
113-
};
114-
11591
static void encode_nfs_cb_opnum4(struct xdr_stream *xdr, enum nfs_cb_opnum4 op)
11692
{
11793
__be32 *p;

fs/nfsd/nfs4proc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,11 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
970970
* To ensure proper ordering, we therefore turn off zero copy if
971971
* the client wants us to do more in this compound:
972972
*/
973-
if (!nfsd4_last_compound_op(rqstp))
974-
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
973+
if (!nfsd4_last_compound_op(rqstp)) {
974+
struct nfsd4_compoundargs *argp = rqstp->rq_argp;
975+
976+
argp->splice_ok = false;
977+
}
975978

976979
/* check stateid */
977980
status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,

0 commit comments

Comments
 (0)