Skip to content

Commit db298d6

Browse files
committed
Revert "SUNRPC: Use RMW bitops in single-threaded hot paths"
Bugzilla: https://bugzilla.redhat.com/2138605 commit 7827c81 Author: Chuck Lever <chuck.lever@oracle.com> Date: Fri Jan 6 12:43:37 2023 -0500 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> Signed-off-by: Jeffrey Layton <jlayton@redhat.com>
1 parent 5ca6841 commit db298d6

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
@@ -945,7 +945,7 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
945945
* the client wants us to do more in this compound:
946946
*/
947947
if (!nfsd4_last_compound_op(rqstp))
948-
__clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
948+
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
949949

950950
/* check stateid */
951951
status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh,
@@ -2615,12 +2615,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
26152615
cstate->minorversion = args->minorversion;
26162616
fh_init(current_fh, NFS4_FHSIZE);
26172617
fh_init(save_fh, NFS4_FHSIZE);
2618-
26192618
/*
26202619
* Don't use the deferral mechanism for NFSv4; compounds make it
26212620
* too hard to avoid non-idempotency problems.
26222621
*/
2623-
__clear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
2622+
clear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
26242623

26252624
/*
26262625
* According to RFC3010, this takes precedence over all other errors.
@@ -2742,7 +2741,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
27422741
out:
27432742
cstate->status = status;
27442743
/* Reset deferral mechanism for RPC deferrals */
2745-
__set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
2744+
set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
27462745
return rpc_success;
27472746
}
27482747

fs/nfsd/nfs4xdr.c

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

24272427
if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack)
2428-
__clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags);
2428+
clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags);
24292429

24302430
return true;
24312431
}

net/sunrpc/auth_gss/svcauth_gss.c

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

905905
/* Did we already verify the signature on the original pass through? */
906906
if (rqstp->rq_deferred)
@@ -972,7 +972,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
972972
int pad, remaining_len, offset;
973973
u32 rseqno;
974974

975-
__clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
975+
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
976976

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

net/sunrpc/svc.c

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

12461246
/* Will be turned off by GSS integrity and privacy services */
1247-
__set_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
1247+
set_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
12481248
/* Will be turned off only when NFSv4 Sessions are used */
1249-
__set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
1250-
__clear_bit(RQ_DROPME, &rqstp->rq_flags);
1249+
set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
1250+
clear_bit(RQ_DROPME, &rqstp->rq_flags);
12511251

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

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
@@ -309,9 +309,9 @@ static void svc_sock_setbufsize(struct svc_sock *svsk, unsigned int nreqs)
309309
static void svc_sock_secure_port(struct svc_rqst *rqstp)
310310
{
311311
if (svc_port_is_privileged(svc_addr(rqstp)))
312-
__set_bit(RQ_SECURE, &rqstp->rq_flags);
312+
set_bit(RQ_SECURE, &rqstp->rq_flags);
313313
else
314-
__clear_bit(RQ_SECURE, &rqstp->rq_flags);
314+
clear_bit(RQ_SECURE, &rqstp->rq_flags);
315315
}
316316

317317
/*
@@ -1019,9 +1019,9 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
10191019
rqstp->rq_xprt_ctxt = NULL;
10201020
rqstp->rq_prot = IPPROTO_TCP;
10211021
if (test_bit(XPT_LOCAL, &svsk->sk_xprt.xpt_flags))
1022-
__set_bit(RQ_LOCAL, &rqstp->rq_flags);
1022+
set_bit(RQ_LOCAL, &rqstp->rq_flags);
10231023
else
1024-
__clear_bit(RQ_LOCAL, &rqstp->rq_flags);
1024+
clear_bit(RQ_LOCAL, &rqstp->rq_flags);
10251025

10261026
p = (__be32 *)rqstp->rq_arg.head[0].iov_base;
10271027
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)