Skip to content

Commit 7827c81

Browse files
committed
Revert "SUNRPC: Use RMW bitops in single-threaded hot paths"
The premise that "Once an svc thread is scheduled and executing an RPC, no other processes will touch svc_rqst::rq_flags" is false. svc_xprt_enqueue() examines the RQ_BUSY flag in scheduled nfsd threads when determining which thread to wake up next. Found via KCSAN. Fixes: 28df098 ("SUNRPC: Use RMW bitops in single-threaded hot paths") Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 0b3a551 commit 7827c81

File tree

7 files changed

+15
-16
lines changed

7 files changed

+15
-16
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
937937
* the client wants us to do more in this compound:
938938
*/
939939
if (!nfsd4_last_compound_op(rqstp))
940-
__clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
940+
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
941941

942942
/* check stateid */
943943
status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,
@@ -2607,12 +2607,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
26072607
cstate->minorversion = args->minorversion;
26082608
fh_init(current_fh, NFS4_FHSIZE);
26092609
fh_init(save_fh, NFS4_FHSIZE);
2610-
26112610
/*
26122611
* Don't use the deferral mechanism for NFSv4; compounds make it
26132612
* too hard to avoid non-idempotency problems.
26142613
*/
2615-
__clear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
2614+
clear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
26162615

26172616
/*
26182617
* According to RFC3010, this takes precedence over all other errors.
@@ -2734,7 +2733,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
27342733
out:
27352734
cstate->status = status;
27362735
/* Reset deferral mechanism for RPC deferrals */
2737-
__set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
2736+
set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
27382737
return rpc_success;
27392738
}
27402739

fs/nfsd/nfs4xdr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
25232523
argp->rqstp->rq_cachetype = cachethis ? RC_REPLBUFF : RC_NOCACHE;
25242524

25252525
if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack)
2526-
__clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags);
2526+
clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags);
25272527

25282528
return true;
25292529
}

net/sunrpc/auth_gss/svcauth_gss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g
923923
* rejecting the server-computed MIC in this somewhat rare case,
924924
* do not use splice with the GSS integrity service.
925925
*/
926-
__clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
926+
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
927927

928928
/* Did we already verify the signature on the original pass through? */
929929
if (rqstp->rq_deferred)
@@ -990,7 +990,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
990990
int pad, remaining_len, offset;
991991
u32 rseqno;
992992

993-
__clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
993+
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
994994

995995
priv_len = svc_getnl(&buf->head[0]);
996996
if (rqstp->rq_deferred) {

net/sunrpc/svc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,10 +1243,10 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
12431243
goto err_short_len;
12441244

12451245
/* Will be turned off by GSS integrity and privacy services */
1246-
__set_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
1246+
set_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
12471247
/* Will be turned off only when NFSv4 Sessions are used */
1248-
__set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
1249-
__clear_bit(RQ_DROPME, &rqstp->rq_flags);
1248+
set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
1249+
clear_bit(RQ_DROPME, &rqstp->rq_flags);
12501250

12511251
svc_putu32(resv, rqstp->rq_xid);
12521252

net/sunrpc/svc_xprt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ static struct cache_deferred_req *svc_defer(struct cache_req *req)
12381238
trace_svc_defer(rqstp);
12391239
svc_xprt_get(rqstp->rq_xprt);
12401240
dr->xprt = rqstp->rq_xprt;
1241-
__set_bit(RQ_DROPME, &rqstp->rq_flags);
1241+
set_bit(RQ_DROPME, &rqstp->rq_flags);
12421242

12431243
dr->handle.revisit = svc_revisit;
12441244
return &dr->handle;

net/sunrpc/svcsock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,9 @@ static void svc_sock_setbufsize(struct svc_sock *svsk, unsigned int nreqs)
298298
static void svc_sock_secure_port(struct svc_rqst *rqstp)
299299
{
300300
if (svc_port_is_privileged(svc_addr(rqstp)))
301-
__set_bit(RQ_SECURE, &rqstp->rq_flags);
301+
set_bit(RQ_SECURE, &rqstp->rq_flags);
302302
else
303-
__clear_bit(RQ_SECURE, &rqstp->rq_flags);
303+
clear_bit(RQ_SECURE, &rqstp->rq_flags);
304304
}
305305

306306
/*
@@ -1008,9 +1008,9 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
10081008
rqstp->rq_xprt_ctxt = NULL;
10091009
rqstp->rq_prot = IPPROTO_TCP;
10101010
if (test_bit(XPT_LOCAL, &svsk->sk_xprt.xpt_flags))
1011-
__set_bit(RQ_LOCAL, &rqstp->rq_flags);
1011+
set_bit(RQ_LOCAL, &rqstp->rq_flags);
10121012
else
1013-
__clear_bit(RQ_LOCAL, &rqstp->rq_flags);
1013+
clear_bit(RQ_LOCAL, &rqstp->rq_flags);
10141014

10151015
p = (__be32 *)rqstp->rq_arg.head[0].iov_base;
10161016
calldir = p[1];

net/sunrpc/xprtrdma/svc_rdma_transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static int svc_rdma_has_wspace(struct svc_xprt *xprt)
602602

603603
static void svc_rdma_secure_port(struct svc_rqst *rqstp)
604604
{
605-
__set_bit(RQ_SECURE, &rqstp->rq_flags);
605+
set_bit(RQ_SECURE, &rqstp->rq_flags);
606606
}
607607

608608
static void svc_rdma_kill_temp_xprt(struct svc_xprt *xprt)

0 commit comments

Comments
 (0)