[PATCH] null_blk: Set mq device as blocking with zoned mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit aa1c09cb65e2 ("null_blk: Fix locking in zoned mode") changed zone
locking to using the potentially sleeping wait_on_bit_io() function. A
zoned null_blk device must thus be marked as blocking to avoid calls to
queue_rq() from invalid contexts triggering might_sleep() warnings.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Fixes: aa1c09cb65e2 ("null_blk: Fix locking in zoned mode")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx>
---
 drivers/block/null_blk_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 4685ea401d5b..9b4e22c8cc78 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1736,10 +1736,11 @@ static int null_validate_conf(struct nullb_device *dev)
 	dev->queue_mode = min_t(unsigned int, dev->queue_mode, NULL_Q_MQ);
 	dev->irqmode = min_t(unsigned int, dev->irqmode, NULL_IRQ_TIMER);
 
-	/* Do memory allocation, so set blocking */
-	if (dev->memory_backed)
+	/* Memory allocation and zone handling may sleep, so set blocking */
+	if (dev->memory_backed || dev->zoned)
 		dev->blocking = true;
-	else /* cache is meaningless */
+	/* Cache is meaningless without memory backing */
+	if (!dev->memory_backed)
 		dev->cache_size = 0;
 	dev->cache_size = min_t(unsigned long, ULONG_MAX / 1024 / 1024,
 						dev->cache_size);
-- 
2.26.2




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux