Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: disable IRQs until data is written to relay channel

As we may run relay_reserve from interrupt context we must always disable
IRQs. This is because a call to relay_reserve may expose previously written
data to use space.

Updated new message code and an old but related comment.

Signed-off-by: Carl Henrik Lunde <chlunde@ping.uio.no>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Carl Henrik Lunde and committed by
Linus Torvalds
14a73f54 95dcf835

+4 -6
+4 -6
block/blktrace.c
··· 79 79 { 80 80 int n; 81 81 va_list args; 82 + unsigned long flags; 82 83 char *buf; 83 84 84 - preempt_disable(); 85 + local_irq_save(flags); 85 86 buf = per_cpu_ptr(bt->msg_data, smp_processor_id()); 86 87 va_start(args, fmt); 87 88 n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args); 88 89 va_end(args); 89 90 90 91 trace_note(bt, 0, BLK_TN_MESSAGE, buf, n); 91 - preempt_enable(); 92 + local_irq_restore(flags); 92 93 } 93 94 EXPORT_SYMBOL_GPL(__trace_note_message); 94 95 ··· 159 158 /* 160 159 * A word about the locking here - we disable interrupts to reserve 161 160 * some space in the relay per-cpu buffer, to prevent an irq 162 - * from coming in and stepping on our toes. Once reserved, it's 163 - * enough to get preemption disabled to prevent read of this data 164 - * before we are through filling it. get_cpu()/put_cpu() does this 165 - * for us 161 + * from coming in and stepping on our toes. 166 162 */ 167 163 local_irq_save(flags); 168 164