]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
SUNRPC: Don't allow compiler optimisation of svc_xprt_release_slot()
authorTrond Myklebust <trondmy@gmail.com>
Thu, 3 Jan 2019 14:17:12 +0000 (09:17 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 6 Feb 2019 20:37:14 +0000 (15:37 -0500)
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>
net/sunrpc/svc_xprt.c

index 4eb8fbf2508dc767e7a35c00a885a46146ee7e35..c3af1aaef551ad872387739a18ef63db485f92c5 100644 (file)
@@ -363,9 +363,13 @@ static void svc_xprt_release_slot(struct svc_rqst *rqstp)
 
 static bool svc_xprt_has_something_to_do(struct svc_xprt *xprt)
 {
-       if (xprt->xpt_flags & ((1<<XPT_CONN)|(1<<XPT_CLOSE)))
+       unsigned long xpt_flags;
+
+       xpt_flags = READ_ONCE(xprt->xpt_flags);
+
+       if (xpt_flags & (BIT(XPT_CONN) | BIT(XPT_CLOSE)))
                return true;
-       if (xprt->xpt_flags & ((1<<XPT_DATA)|(1<<XPT_DEFERRED))) {
+       if (xpt_flags & (BIT(XPT_DATA) | BIT(XPT_DEFERRED))) {
                if (xprt->xpt_ops->xpo_has_wspace(xprt) &&
                    svc_xprt_slots_in_range(xprt))
                        return true;