block/rnbd-clt: Avoid flush_workqueue(system_long_wq) usage
Subsystems (2)
Jack Wang
maintainerPATCH 1/1 block/rnbd-clt: Avoid flush_workqueue(system_long_wq) usage
Flushing system-wide workqueues is dangerous and will be forbidden.
Replace system_long_wq with local rnbd_clt_wq.
Cc Tetsuo Handa <[email protected]>
Signed-off-by Jack Wang <[email protected]>
Reviewed-by Santosh Kumar Pradhan <[email protected]>
---
v2: return error as suggested by Tetsuo.
drivers/block/rnbd/rnbd-clt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/block/rnbd/rnbd-clt.c +12 -2
@@ -25,6 +25,7 @@ static int rnbd_client_major;static DEFINE_IDA (index_ida);static DEFINE_MUTEX (sess_lock);static LIST_HEAD (sess_list); +static struct workqueue_struct *rnbd_clt_wq;/* * Maximum number of partitions an instance can have.
@@ -1761,12 +1762,12 @@ static void rnbd_destroy_sessions(void)* procedure takes minutes. */ INIT_WORK (&dev->unmap_on_rmmod_work, unmap_device_work); -queue_work (system_long_wq, &dev->unmap_on_rmmod_work); +queue_work (rnbd_clt_wq, &dev->unmap_on_rmmod_work); }rnbd_clt_put_sess (sess); }/* Wait for all scheduled unmap works */ -flush_workqueue (system_long_wq); +flush_workqueue (rnbd_clt_wq);WARN_ON (!list_empty (&sess_list)); }
@@ -1791,6 +1792,14 @@ static int __init rnbd_client_init(void)pr_err ("Failed to load module, creating sysfs device files failed, err: %d\n" , err);unregister_blkdev (rnbd_client_major,"rnbd" ); +return err; + } + rnbd_clt_wq =alloc_workqueue ("rnbd_clt_wq" ,0 ,0 ); +if (!rnbd_clt_wq) { +pr_err ("Failed to load module, alloc_workqueue failed.\n" ); +rnbd_clt_destroy_sysfs_files (); +unregister_blkdev (rnbd_client_major,"rnbd" ); + err = -ENOMEM ; }return err;
@@ -1801,6 +1810,7 @@ static void __exit rnbd_client_exit(void)rnbd_destroy_sessions ();unregister_blkdev (rnbd_client_major,"rnbd" );ida_destroy (&index_ida); +destroy_workqueue (rnbd_clt_wq); }module_init (rnbd_client_init);
Signature · 1 line
2.25.1
Quoted 4 lines · Jack Wang
Flushing system-wide workqueues is dangerous and will be forbidden.
Replace
system_long_wqwith localrnbd_clt_wq.
Quoted 8 lines
Cc Tetsuo Handa <[email protected]>Signed-off-by Jack Wang <[email protected]>Reviewed-by Santosh Kumar Pradhan <[email protected]>---
v2: return error as suggested by Tetsuo.
Seems no more comments. Jens, please pick up.
Quoted 8 lines · Jack Wang
Flushing system-wide workqueues is dangerous and will be forbidden.
Replace
system_long_wqwith localrnbd_clt_wq.[...]
Applied, thanks!
[1/1] block/rnbd-clt: Avoid flush_workqueue(system_long_wq) usage
commit: 5ea7c1339e3ed094dd4df48d598f9018a2587283
Best regards,
Signature · 1 line
Jens Axboe