]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
DTrace: IO wait probes b_flags can contain incorrect operation
authorNicolas Droux <nicolas.droux@oracle.com>
Fri, 17 Nov 2017 23:51:45 +0000 (16:51 -0700)
committerNicolas Droux <nicolas.droux@oracle.com>
Tue, 12 Dec 2017 19:02:06 +0000 (12:02 -0700)
In the synchronous IO path, the xfs buffer flag value can change,
causing the IO provider io:::wait-start and io:::wait-done to report
an incorrect operation through the bufinfo_t b_flags field.

Orabug: 27193447

Signed-off-by: Nicolas Droux <nicolas.droux@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_buf.c

index 00741c979ffeed5fe94a30b421f4c84f3cc1a06f..91d31aa6e250fdabf9a3c271f7255cffb83361de 100644 (file)
@@ -57,12 +57,12 @@ static kmem_zone_t *xfs_buf_zone;
 #define xb_to_gfp(flags) \
        ((((flags) & XBF_READ_AHEAD) ? __GFP_NORETRY : GFP_NOFS) | __GFP_NOWARN)
 
-#define        DTRACE_IO_XFS_WAIT(name, bp)                                    \
+#define        DTRACE_IO_XFS_WAIT(name, bp, is_write)                          \
        if (DTRACE_IO_ENABLED(name)) {                                  \
                struct bio bio __maybe_unused = {                       \
                        .bi_iter.bi_sector = (bp)->b_bn,                \
                        .bi_iter.bi_size = (bp)->b_length,              \
-                       .bi_rw = ((bp)->b_flags & XBF_WRITE) != 0,      \
+                       .bi_rw = is_write ? REQ_WRITE : 0,              \
                        .bi_bdev = (bp)->b_target->bt_bdev,             \
                };                                                      \
                DTRACE_IO(name, struct bio * : (bufinfo_t *,            \
@@ -1449,6 +1449,7 @@ xfs_buf_submit_wait(
        struct xfs_buf  *bp)
 {
        int             error;
+       bool            is_write = bp->b_flags & XBF_WRITE;
 
        trace_xfs_buf_submit_wait(bp, _RET_IP_);
 
@@ -1492,9 +1493,9 @@ xfs_buf_submit_wait(
 
        /* wait for completion before gathering the error from the buffer */
        trace_xfs_buf_iowait(bp, _RET_IP_);
-       DTRACE_IO_XFS_WAIT(wait__start, bp);
+       DTRACE_IO_XFS_WAIT(wait__start, bp, is_write);
        wait_for_completion(&bp->b_iowait);
-       DTRACE_IO_XFS_WAIT(wait__done, bp);
+       DTRACE_IO_XFS_WAIT(wait__done, bp, is_write);
        trace_xfs_buf_iowait_done(bp, _RET_IP_);
        error = bp->b_error;