summaryrefslogtreecommitdiffstats
path: root/include/linux/blktrace_api.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2020-03-21 09:35:44 +0100
committerIngo Molnar <mingo@kernel.org>2020-03-21 09:35:44 +0100
commitdf10846ff2ac3b0a7b295be2de2e9215877982f3 (patch)
tree9e5ff5583aa1547afd3c577815af81c2f328e288 /include/linux/blktrace_api.h
parenta4654e9bde4ecedb4921e6c8fe2088114bdff1b3 (diff)
parent5ad0ec0b86525d0c5d3d250d3cfad7f183b00cfa (diff)
downloadlinux-df10846ff2ac3b0a7b295be2de2e9215877982f3.tar.gz
linux-df10846ff2ac3b0a7b295be2de2e9215877982f3.tar.bz2
linux-df10846ff2ac3b0a7b295be2de2e9215877982f3.zip
Merge branch 'linus' into locking/kcsan, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/blktrace_api.h')
-rw-r--r--include/linux/blktrace_api.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7bb2d8de9f30..3b6ff5902edc 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -51,9 +51,13 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f
**/
#define blk_add_cgroup_trace_msg(q, cg, fmt, ...) \
do { \
- struct blk_trace *bt = (q)->blk_trace; \
+ struct blk_trace *bt; \
+ \
+ rcu_read_lock(); \
+ bt = rcu_dereference((q)->blk_trace); \
if (unlikely(bt)) \
__trace_note_message(bt, cg, fmt, ##__VA_ARGS__);\
+ rcu_read_unlock(); \
} while (0)
#define blk_add_trace_msg(q, fmt, ...) \
blk_add_cgroup_trace_msg(q, NULL, fmt, ##__VA_ARGS__)
@@ -61,10 +65,14 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f
static inline bool blk_trace_note_message_enabled(struct request_queue *q)
{
- struct blk_trace *bt = q->blk_trace;
- if (likely(!bt))
- return false;
- return bt->act_mask & BLK_TC_NOTIFY;
+ struct blk_trace *bt;
+ bool ret;
+
+ rcu_read_lock();
+ bt = rcu_dereference(q->blk_trace);
+ ret = bt && (bt->act_mask & BLK_TC_NOTIFY);
+ rcu_read_unlock();
+ return ret;
}
extern void blk_add_driver_data(struct request_queue *q, struct request *rq,