From: Nicolas Droux Date: Fri, 17 Nov 2017 23:51:45 +0000 (-0700) Subject: DTrace: IO wait probes b_flags can contain incorrect operation X-Git-Tag: v4.1.12-124.31.3~1474 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=688b978c413ab49585d188c3c41bd178e7ecc302;p=users%2Fjedix%2Flinux-maple.git DTrace: IO wait probes b_flags can contain incorrect operation 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 Reviewed-by: Darrick J. Wong --- diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 00741c979ffe..91d31aa6e250 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -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;