path: root/include
diff options
authorBart Van Assche <>2017-06-14 13:27:50 -0600
committerJens Axboe <>2017-06-14 13:27:50 -0600
commitdc9edc44de6cd7cc8cc7f5b36c1adb221eda3207 (patch)
treef749db9a9accb61b5b6e7d0d88b4e45b16326a46 /include
parent63f700aab4c11d46626de3cd051dae56cf7e9056 (diff)
block: Fix a blk_exit_rl() regression
Avoid that the following complaint is reported: BUG: sleeping function called from invalid context at kernel/workqueue.c:2790 in_atomic(): 1, irqs_disabled(): 0, pid: 41, name: rcuop/3 1 lock held by rcuop/3/41: #0: (rcu_callback){......}, at: [<ffffffff8111f9a2>] rcu_nocb_kthread+0x282/0x500 Call Trace: dump_stack+0x86/0xcf ___might_sleep+0x174/0x260 __might_sleep+0x4a/0x80 flush_work+0x7e/0x2e0 __cancel_work_timer+0x143/0x1c0 cancel_work_sync+0x10/0x20 blk_throtl_exit+0x25/0x60 blkcg_exit_queue+0x35/0x40 blk_release_queue+0x42/0x130 kobject_put+0xa9/0x190 This happens since we invoke callbacks that need to block from the queue release handler. Fix this by pushing the final release to a workqueue. Reported-by: Ross Zwisler <> Fixes: commit b425e5049258 ("block: Avoid that blk_exit_rl() triggers a use-after-free") Signed-off-by: Bart Van Assche <> Tested-by: Ross Zwisler <> Updated changelog Signed-off-by: Jens Axboe <>
Diffstat (limited to 'include')
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ab92c4ea138b..b74a3edcb3da 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -586,6 +586,8 @@ struct request_queue {
size_t cmd_size;
void *rq_alloc_data;
+ struct work_struct release_work;
#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */