diff options
author | Trond Myklebust <trondmy@gmail.com> | 2019-01-03 09:17:12 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2019-02-06 15:37:14 -0500 |
commit | 1602a7b7d33741d0490682e620bb29e96ad684d7 (patch) | |
tree | 28331ddd85596bfb631950c5ad51c602a946f0c4 /net/sunrpc/svc_xprt.c | |
parent | 1c3da4452d185e4be663e76a1b9842184d8f9c4c (diff) |
SUNRPC: Don't allow compiler optimisation of svc_xprt_release_slot()
Use READ_ONCE() to tell the compiler to not optimse away the read of
xprt->xpt_flags in svc_xprt_release_slot().
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 4eb8fbf2508d..c3af1aaef551 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -363,9 +363,13 @@ static void svc_xprt_release_slot(struct svc_rqst *rqstp) | |||
363 | 363 | ||
364 | static bool svc_xprt_has_something_to_do(struct svc_xprt *xprt) | 364 | static bool svc_xprt_has_something_to_do(struct svc_xprt *xprt) |
365 | { | 365 | { |
366 | if (xprt->xpt_flags & ((1<<XPT_CONN)|(1<<XPT_CLOSE))) | 366 | unsigned long xpt_flags; |
367 | |||
368 | xpt_flags = READ_ONCE(xprt->xpt_flags); | ||
369 | |||
370 | if (xpt_flags & (BIT(XPT_CONN) | BIT(XPT_CLOSE))) | ||
367 | return true; | 371 | return true; |
368 | if (xprt->xpt_flags & ((1<<XPT_DATA)|(1<<XPT_DEFERRED))) { | 372 | if (xpt_flags & (BIT(XPT_DATA) | BIT(XPT_DEFERRED))) { |
369 | if (xprt->xpt_ops->xpo_has_wspace(xprt) && | 373 | if (xprt->xpt_ops->xpo_has_wspace(xprt) && |
370 | svc_xprt_slots_in_range(xprt)) | 374 | svc_xprt_slots_in_range(xprt)) |
371 | return true; | 375 | return true; |