linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] null_blk: fix race and oops at removing device with bandwidth limit
@ 2019-04-01  8:30 Konstantin Khlebnikov
  0 siblings, 0 replies; only message in thread
From: Konstantin Khlebnikov @ 2019-04-01  8:30 UTC (permalink / raw)
  To: linux-block, Jens Axboe, linux-kernel; +Cc: Shaohua Li

Function null_del_dev should disable throttling before canceling timer,
otherwise timer could be restarted by null_handle_cmd().

Remove bump of cur_bytes - without NULLB_DEV_FL_THROTTLED it has no effect.

Fixes: eff2c4f10873 ("nullb: bandwidth control")
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 drivers/block/null_blk_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 417a9f15c116..757b58e0fec7 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1383,8 +1383,8 @@ static void null_del_dev(struct nullb *nullb)
 	del_gendisk(nullb->disk);
 
 	if (test_bit(NULLB_DEV_FL_THROTTLED, &nullb->dev->flags)) {
+		clear_bit(NULLB_DEV_FL_THROTTLED, &nullb->dev->flags);
 		hrtimer_cancel(&nullb->bw_timer);
-		atomic_long_set(&nullb->cur_bytes, LONG_MAX);
 		null_restart_queue_async(nullb);
 	}
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-01  8:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01  8:30 [PATCH] null_blk: fix race and oops at removing device with bandwidth limit Konstantin Khlebnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).