Tejun Heo
ecca47ce82
kernfs: kernfs_notify() must be useable from non-sleepable contexts
...
d911d98748 ("kernfs: make kernfs_notify() trigger inotify events
too") added fsnotify triggering to kernfs_notify() which requires a
sleepable context. There are already existing users of
kernfs_notify() which invoke it from an atomic context and in general
it's silly to require a sleepable context for triggering a
notification.
The following is an invalid context bug triggerd by md invoking
sysfs_notify() from IO completion path.
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:586
in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
2 locks held by swapper/1/0:
#0 : (&(&vblk->vq_lock)->rlock){-.-...}, at: [<ffffffffa0039042>] virtblk_done+0x42/0xe0 [virtio_blk]
#1 : (&(&bitmap->counts.lock)->rlock){-.....}, at: [<ffffffff81633718>] bitmap_endwrite+0x68/0x240
irq event stamp: 33518
hardirqs last enabled at (33515): [<ffffffff8102544f>] default_idle+0x1f/0x230
hardirqs last disabled at (33516): [<ffffffff818122ed>] common_interrupt+0x6d/0x72
softirqs last enabled at (33518): [<ffffffff810a1272>] _local_bh_enable+0x22/0x50
softirqs last disabled at (33517): [<ffffffff810a29e0>] irq_enter+0x60/0x80
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.16.0-0.rc2.git2.1.fc21.x86_64 #1
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
0000000000000000 f90db13964f4ee05 ffff88007d403b80 ffffffff81807b4c
0000000000000000 ffff88007d403ba8 ffffffff810d4f14 0000000000000000
0000000000441800 ffff880078fa1780 ffff88007d403c38 ffffffff8180caf2
Call Trace:
<IRQ> [<ffffffff81807b4c>] dump_stack+0x4d/0x66
[<ffffffff810d4f14>] __might_sleep+0x184/0x240
[<ffffffff8180caf2>] mutex_lock_nested+0x42/0x440
[<ffffffff812d76a0>] kernfs_notify+0x90/0x150
[<ffffffff8163377c>] bitmap_endwrite+0xcc/0x240
[<ffffffffa00de863>] close_write+0x93/0xb0 [raid1]
[<ffffffffa00df029>] r1_bio_write_done+0x29/0x50 [raid1]
[<ffffffffa00e0474>] raid1_end_write_request+0xe4/0x260 [raid1]
[<ffffffff813acb8b>] bio_endio+0x6b/0xa0
[<ffffffff813b46c4>] blk_update_request+0x94/0x420
[<ffffffff813bf0ea>] blk_mq_end_io+0x1a/0x70
[<ffffffffa00392c2>] virtblk_request_done+0x32/0x80 [virtio_blk]
[<ffffffff813c0648>] __blk_mq_complete_request+0x88/0x120
[<ffffffff813c070a>] blk_mq_complete_request+0x2a/0x30
[<ffffffffa0039066>] virtblk_done+0x66/0xe0 [virtio_blk]
[<ffffffffa002535a>] vring_interrupt+0x3a/0xa0 [virtio_ring]
[<ffffffff81116177>] handle_irq_event_percpu+0x77/0x340
[<ffffffff8111647d>] handle_irq_event+0x3d/0x60
[<ffffffff81119436>] handle_edge_irq+0x66/0x130
[<ffffffff8101c3e4>] handle_irq+0x84/0x150
[<ffffffff818146ad>] do_IRQ+0x4d/0xe0
[<ffffffff818122f2>] common_interrupt+0x72/0x72
<EOI> [<ffffffff8105f706>] ? native_safe_halt+0x6/0x10
[<ffffffff81025454>] default_idle+0x24/0x230
[<ffffffff81025f9f>] arch_cpu_idle+0xf/0x20
[<ffffffff810f5adc>] cpu_startup_entry+0x37c/0x7b0
[<ffffffff8104df1b>] start_secondary+0x25b/0x300
This patch fixes it by punting the notification delivery through a
work item. This ends up adding an extra pointer to kernfs_elem_attr
enlarging kernfs_node by a pointer, which is not ideal but not a very
big deal either. If this turns out to be an actual issue, we can move
kernfs_elem_attr->size to kernfs_node->iattr later.
Signed-off-by: Tejun Heo <tj@kernel.org >
Reported-by: Josh Boyer <jwboyer@fedoraproject.org >
Cc: Jens Axboe <axboe@kernel.dk >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2014-07-02 09:32:09 -07:00
..
2014-06-10 10:28:45 -07:00
2014-01-30 17:20:32 -08:00
2014-05-19 09:38:24 +02:00
2014-06-12 23:06:23 -07:00
2014-06-10 16:53:25 -07:00
2014-04-04 21:07:28 -07:00
2014-04-03 16:21:12 -07:00
2014-03-19 14:41:58 +09:00
2014-05-16 17:52:36 +02:00
2014-05-16 00:55:30 +02:00
2014-06-12 12:42:32 -07:00
2014-05-03 11:35:23 +01:00
2014-05-29 00:05:59 -07:00
2014-05-19 00:35:23 +00:00
2014-06-04 23:13:41 -07:00
2014-05-06 17:54:53 -04:00
2014-06-10 15:34:47 -07:00
2014-06-12 14:27:40 -07:00
2014-05-27 11:53:06 -07:00
2014-05-22 08:33:30 -04:00
2014-06-11 08:35:34 -07:00
2014-04-29 18:25:14 +02:00
2014-04-24 12:53:38 -07:00
2014-01-16 14:25:37 +01:00
2014-06-14 14:43:23 -07:00
2013-12-23 18:34:58 -08:00
2014-06-16 16:05:56 +01:00
2014-06-04 16:54:05 -07:00
2014-06-12 14:27:40 -07:00
2014-05-19 16:42:15 -04:00
2014-06-10 15:02:42 -07:00
2014-06-12 14:27:40 -07:00
2013-12-08 18:01:56 -08:00
2014-02-11 23:30:50 +05:30
2014-06-03 23:12:20 +02:00
2014-05-14 13:07:10 -04:00
2013-11-09 00:16:28 -05:00
2013-12-02 11:24:18 +00:00
2014-05-07 16:08:08 -04:00
2014-02-12 17:21:22 +00:00
2014-04-18 11:40:30 +02:00
2014-04-10 17:51:29 -04:00
2013-12-24 09:35:17 -08:00
2014-04-03 16:20:49 -07:00
2014-05-27 01:29:01 +02:00
2014-02-06 10:33:47 +01:00
2014-04-07 16:36:05 -07:00
2014-06-24 16:22:24 -06:00
2014-04-18 11:40:30 +02:00
2014-06-12 10:30:18 -07:00
2014-03-13 09:38:42 -06:00
2014-06-17 22:12:35 -07:00
2014-06-24 16:22:24 -06:00
2013-11-08 09:04:30 -07:00
2014-06-04 16:54:04 -07:00
2014-01-13 17:32:27 +01:00
2014-02-14 00:27:58 -05:00
2014-06-04 16:54:02 -07:00
2014-01-23 16:36:56 -08:00
2014-06-10 13:57:22 -07:00
2014-02-09 09:59:23 +08:00
2014-05-19 16:37:06 -04:00
2014-06-09 14:56:07 -07:00
2013-12-31 11:35:12 -08:00
2014-06-07 20:27:30 -07:00
2014-02-24 17:13:55 -08:00
2013-12-04 17:19:44 +01:00
2014-02-09 15:11:47 +01:00
2014-05-20 14:25:24 -05:00
2014-01-21 20:18:26 -08:00
2014-06-04 16:54:06 -07:00
2014-04-02 12:51:41 -07:00
2014-04-09 13:44:35 -07:00
2014-02-13 12:34:05 +01:00
2013-12-05 21:28:41 +08:00
2014-04-15 09:15:39 -07:00
2014-06-12 19:18:49 -07:00
2013-11-15 09:32:21 +09:00
2014-01-10 16:27:36 -08:00
2014-05-27 13:56:21 -07:00
2014-05-28 13:37:21 -07:00
2013-12-29 15:25:48 +01:00
2013-12-02 20:43:15 +01:00
2013-12-02 20:43:14 +01:00
2013-11-09 00:16:29 -05:00
2013-12-04 09:33:34 -04:00
2014-06-06 16:08:18 -07:00
2014-02-18 12:38:37 -08:00
2014-06-05 23:32:29 +02:00
2014-06-09 18:10:34 -07:00
2014-06-12 14:27:40 -07:00
2014-06-04 16:54:08 -07:00
2014-03-13 15:56:44 +01:00
2014-04-07 16:36:06 -07:00
2014-05-16 14:26:52 -04:00
2014-04-03 16:21:05 -07:00
2014-05-01 10:30:00 -04:00
2014-05-08 14:28:07 +08:00
2014-05-24 22:33:41 +09:00
2014-06-04 09:46:34 -04:00
2014-06-05 15:57:04 -07:00
2013-11-23 22:33:51 -08:00
2014-01-09 12:43:40 +01:00
2014-02-13 10:08:52 +05:30
2014-06-04 16:53:57 -07:00
2014-01-21 16:19:41 -08:00
2014-06-05 15:57:04 -07:00
2014-06-10 10:28:45 -07:00
2014-03-24 14:05:08 +00:00
2014-02-17 16:46:48 +01:00
2014-04-30 13:46:56 -06:00
2014-02-17 14:16:54 +05:30
2013-12-11 18:06:47 +01:00
2014-04-30 19:49:57 +01:00
2014-06-22 16:34:11 -06:00
2013-11-09 00:16:24 -05:00
2013-11-09 00:16:23 -05:00
2014-04-03 16:21:06 -07:00
2014-01-15 15:39:33 -08:00
2014-06-03 02:42:44 +01:00
2014-01-16 10:23:02 +10:30
2014-04-29 09:45:56 +09:00
2014-06-04 13:34:30 +09:00
2014-05-02 15:57:42 +03:00
2014-04-01 23:19:14 -04:00
2014-03-10 11:44:42 -04:00
2014-06-11 00:13:16 -07:00
2014-05-26 14:33:10 +02:00
2013-12-08 18:22:32 -08:00
2014-01-21 23:17:20 -08:00
2014-02-28 15:12:09 -08:00
2014-06-21 16:40:30 -10:00
2014-02-18 12:20:45 -08:00
2014-04-03 16:20:51 -07:00
2014-05-15 11:29:37 -04:00
2014-06-09 16:39:15 -07:00
2014-03-03 11:32:08 +01:00
2014-01-23 16:36:52 -08:00
2014-04-18 14:20:48 +02:00
2013-11-19 16:39:06 -05:00
2014-06-04 16:54:10 -07:00
2014-05-20 10:30:40 +09:00
2014-05-14 16:39:49 -07:00
2014-02-20 14:54:28 +01:00
2014-02-19 17:22:44 +01:00
2013-12-17 14:27:17 -05:00
2014-03-13 12:48:32 +01:00
2014-05-05 10:59:49 +01:00
2014-04-29 22:11:53 +01:00
2014-06-04 13:09:43 +02:00
2014-04-04 09:12:49 +02:00
2014-03-20 12:35:45 +01:00
2014-03-04 07:55:47 -08:00
2014-02-08 10:36:58 -05:00
2014-06-04 16:54:12 -07:00
2014-05-19 09:26:40 +09:30
2014-05-03 19:24:26 -04:00
2014-01-16 11:15:50 +01:00
2014-01-29 20:40:08 +01:00
2014-03-05 17:16:45 +01:00
2013-12-07 01:03:14 +01:00
2014-06-06 16:08:13 -07:00
2014-05-28 16:22:47 +02:00
2014-06-10 23:50:47 -07:00
2014-05-23 15:04:02 -04:00
2014-06-02 16:05:24 -07:00
2014-06-02 14:56:01 -07:00
2014-01-04 20:10:24 -05:00
2014-05-24 00:32:30 -04:00
2013-12-29 16:34:25 -05:00
2013-12-11 14:47:40 -05:00
2014-03-07 11:41:32 -05:00
2014-05-27 14:26:31 -07:00
2014-05-14 16:40:04 -07:00
2014-03-24 14:07:31 +00:00
2014-06-12 13:46:37 +02:00
2014-04-07 16:36:11 -07:00
2014-01-09 13:06:59 +01:00
2014-02-26 14:42:09 -07:00
2014-03-04 17:51:06 +01:00
2014-02-25 15:25:45 -08:00
2014-01-27 21:02:39 -08:00
2014-04-17 12:30:40 -07:00
2014-04-17 12:23:07 -07:00
2014-01-19 19:53:18 -08:00
2014-02-21 21:49:07 +01:00
2014-05-16 14:05:22 +02:00
2014-05-03 23:15:39 +02:00
2013-11-19 19:06:41 +01:00
2014-03-13 12:11:00 +10:30
2013-12-07 01:24:33 +01:00
2014-03-31 00:45:09 -04:00
2014-01-16 00:08:12 +01:00
2014-06-04 16:54:08 -07:00
2014-04-01 11:22:57 -07:00
2013-11-13 12:09:07 +09:00
2014-04-06 09:38:07 -07:00
2014-07-02 09:32:09 -07:00
2014-03-06 16:30:46 +01:00
2014-06-10 10:05:36 -07:00
2014-02-19 14:58:17 +01:00
2014-01-25 08:55:09 +01:00
2014-06-06 16:08:17 -07:00
2014-04-25 12:00:49 -07:00
2014-06-12 19:18:49 -07:00
2014-01-21 16:19:45 -08:00
2014-06-11 12:23:17 -07:00
2014-06-12 19:42:15 -07:00
2014-04-07 16:36:14 -07:00
2014-04-18 15:56:03 -04:00
2014-05-05 16:07:37 -07:00
2014-04-03 16:21:01 -07:00
2013-11-13 12:09:24 +09:00
2013-11-15 09:32:22 +09:00
2014-03-31 14:13:25 -07:00
2013-12-20 12:25:45 -08:00
2013-12-11 15:52:34 +01:00
2014-03-18 19:19:41 -04:00
2014-04-24 05:00:36 +00:00
2014-06-06 16:08:07 -07:00
2014-05-27 17:38:11 -07:00
2014-04-16 15:09:51 -04:00
2013-12-26 13:29:35 -05:00
2014-06-04 16:53:57 -07:00
2014-06-04 16:54:08 -07:00
2014-06-04 16:53:59 -07:00
2013-12-20 12:20:26 -08:00
2014-06-04 16:53:51 -07:00
2013-12-11 13:54:13 -05:00
2014-06-04 16:54:06 -07:00
2014-05-27 17:43:11 -07:00
2014-06-05 08:05:29 -07:00
2014-06-05 08:05:29 -07:00
2014-01-21 16:19:44 -08:00
2014-06-04 16:53:58 -07:00
2014-06-04 16:54:09 -07:00
2014-04-09 13:44:35 -07:00
2014-04-06 09:38:07 -07:00
2014-04-28 11:48:34 +09:30
2014-04-01 23:19:08 -04:00
2014-03-04 13:51:06 -05:00
2014-01-27 21:02:39 -08:00
2013-12-13 08:44:30 -07:00
2014-03-11 12:14:56 +01:00
2013-11-09 00:16:19 -05:00
2014-04-01 23:19:10 -04:00
2014-05-14 00:37:34 -04:00
2014-06-15 01:00:49 -07:00
2014-06-15 01:00:49 -07:00
2014-06-03 23:32:12 -07:00
2014-03-29 17:58:37 -04:00
2014-06-06 19:22:49 -04:00
2014-06-12 10:30:18 -07:00
2014-05-29 11:11:45 -04:00
2014-05-29 11:11:48 -04:00
2014-05-29 11:11:48 -04:00
2014-04-03 16:21:26 -07:00
2014-05-16 17:23:41 -04:00
2014-01-25 03:14:05 -05:00
2014-06-23 16:47:44 -07:00
2014-04-07 10:59:19 -07:00
2014-06-13 10:43:34 -04:00
2014-06-05 15:57:04 -07:00
2014-02-05 10:04:37 -06:00
2014-05-20 15:19:25 -05:00
2014-05-21 11:14:46 +02:00
2014-03-07 16:02:46 +01:00
2014-05-23 11:40:25 +09:00
2014-05-29 15:23:29 -07:00
2014-03-10 22:42:28 -07:00
2014-06-04 04:45:46 -05:00
2014-06-04 08:50:34 -07:00
2014-05-20 14:25:24 -05:00
2014-06-04 10:02:38 -07:00
2014-06-10 14:35:22 -07:00
2014-06-10 14:35:22 -07:00
2013-11-13 12:09:04 +09:00
2014-06-23 16:47:43 -07:00
2014-06-04 16:54:09 -07:00
2014-06-04 16:54:10 -07:00
2014-04-03 16:21:00 -07:00
2014-01-23 16:36:55 -08:00
2013-12-07 01:03:14 +01:00
2014-04-24 15:01:33 -06:00
2014-02-06 17:31:52 +01:00
2014-01-10 14:00:47 -07:00
2014-06-02 16:18:48 -06:00
2013-11-14 11:28:18 -07:00
2014-01-23 20:17:18 +00:00
2013-12-05 12:59:23 -05:00
2014-06-04 12:50:47 -04:00
2014-06-09 14:56:07 -07:00
2014-06-06 07:56:22 +02:00
2014-06-05 15:38:57 -07:00
2014-06-21 15:50:00 -07:00
2014-04-12 14:49:50 -07:00
2014-06-04 16:54:07 -07:00
2014-05-07 00:39:03 +02:00
2014-02-11 00:36:00 +01:00
2014-05-16 23:15:44 +02:00
2014-05-16 23:15:44 +02:00
2014-01-25 23:58:17 -05:00
2014-01-28 08:38:04 -08:00
2014-05-30 13:45:25 +02:00
2014-01-13 17:32:27 +01:00
2014-01-23 14:48:35 +01:00
2014-06-04 16:54:17 -07:00
2014-06-04 16:54:21 -07:00
2014-05-18 19:01:33 -07:00
2013-11-26 20:55:33 -08:00
2013-12-20 13:12:01 -08:00
2014-04-01 16:43:18 -04:00
2014-03-21 14:21:13 -04:00
2014-06-06 16:08:11 -07:00
2014-05-07 10:15:31 +02:00
2014-05-21 11:19:36 +02:00
2014-03-21 18:26:03 +01:00
2014-05-05 17:25:50 +10:00
2014-04-03 16:20:54 -07:00
2014-04-03 16:21:01 -07:00
2014-01-23 16:36:58 -08:00
2014-03-19 22:24:08 -04:00
2013-11-13 12:09:33 +09:00
2014-02-17 15:01:52 -08:00
2014-05-19 10:52:04 -07:00
2014-05-14 09:46:09 -07:00
2014-05-14 09:46:09 -07:00
2014-04-16 08:56:09 +02:00
2014-01-21 23:17:20 -08:00
2014-04-18 16:07:22 +01:00
2014-04-07 16:35:54 -07:00
2014-01-16 12:00:56 -08:00
2014-04-14 16:47:28 +02:00
2014-04-11 09:29:16 +02:00
2014-06-10 09:46:00 -04:00
2014-04-07 16:36:07 -07:00
2014-06-04 16:54:12 -07:00
2014-01-13 13:41:50 +01:00
2014-05-15 15:30:33 -04:00
2014-01-13 13:47:36 +01:00
2014-06-05 10:38:45 +02:00
2013-12-08 17:56:37 -08:00
2014-04-22 13:38:33 -07:00
2014-06-12 19:42:15 -07:00
2014-01-19 19:55:50 -08:00
2014-03-31 00:45:09 -04:00
2014-06-10 10:05:36 -07:00
2013-11-15 09:32:20 +09:00
2014-01-12 10:13:59 +01:00
2014-02-28 16:27:18 -08:00
2014-05-20 15:19:25 -05:00
2014-03-21 04:12:33 +09:00
2014-03-17 16:20:49 -07:00
2014-04-19 22:42:19 -07:00
2013-12-07 01:24:33 +01:00
2014-02-04 10:22:39 +09:00
2013-12-19 19:09:38 -05:00
2014-04-16 12:03:14 +02:00
2014-05-02 21:48:33 +05:30
2014-06-06 16:08:14 -07:00
2014-04-03 16:21:00 -07:00
2014-06-06 16:08:12 -07:00
2014-06-15 01:00:50 -07:00
2014-01-25 11:17:34 -08:00
2014-06-04 16:54:08 -07:00
2014-05-06 13:04:59 -07:00
2014-06-06 16:08:18 -07:00
2014-04-24 13:44:53 -04:00
2014-06-27 11:47:58 -07:00
2014-01-13 13:47:36 +01:00
2014-01-13 13:47:36 +01:00
2013-12-16 11:36:13 +01:00
2014-06-12 00:21:11 -04:00
2014-02-15 11:55:28 -08:00
2014-02-17 15:01:37 -08:00
2014-03-19 08:58:30 +00:00
2014-01-21 17:05:27 -08:00
2014-05-23 11:23:27 +09:00
2014-06-16 23:29:39 +02:00
2014-06-04 16:54:11 -07:00
2014-06-04 16:54:07 -07:00
2014-06-04 16:53:55 -07:00
2014-06-04 16:53:57 -07:00
2014-03-26 16:49:31 -04:00
2014-06-04 16:54:03 -07:00
2014-05-27 14:29:56 -07:00
2013-12-07 01:03:14 +01:00
2014-05-22 12:04:49 -04:00
2014-01-14 08:01:10 -08:00
2013-12-04 09:31:34 -04:00
2014-06-04 16:53:56 -07:00
2014-01-15 23:05:31 +01:00
2014-06-04 16:53:59 -07:00
2014-05-14 09:46:32 -07:00
2014-01-06 14:37:25 +01:00
2014-05-15 11:29:37 -04:00
2014-04-18 14:20:48 +02:00
2014-05-07 12:10:51 -04:00
2013-12-09 11:09:24 -08:00
2014-04-24 16:16:33 -07:00
2014-05-03 18:14:28 -04:00
2014-05-20 16:54:21 -06:00
2014-03-14 22:41:36 -04:00
2014-01-13 13:47:37 +01:00
2014-05-23 16:28:53 -04:00
2013-11-26 20:55:33 -08:00
2014-02-12 15:00:34 -08:00
2014-06-28 09:43:58 -07:00
2014-06-12 19:18:49 -07:00
2014-03-04 15:38:16 -08:00
2014-05-27 16:11:49 -07:00
2014-05-15 17:02:21 +01:00
2014-05-30 11:35:54 -06:00
2014-06-02 12:41:33 -07:00
2014-04-28 11:34:13 +09:30
2014-06-04 16:53:57 -07:00
2014-04-07 16:35:53 -07:00
2013-12-03 11:15:58 -08:00
2013-11-22 18:20:43 -05:00
2014-06-04 16:53:57 -07:00
2013-12-02 20:43:15 +01:00
2014-01-23 16:37:04 -08:00
2014-04-18 16:40:08 -07:00
2014-02-28 14:08:26 -05:00
2014-05-22 11:35:51 -04:00
2014-04-07 16:35:57 -07:00
2014-06-04 16:54:13 -07:00
2013-11-26 11:09:08 +01:00
2014-01-30 16:56:55 -08:00