Re: [PATCH 5/8] nbd: use blk_mq_queue_tag_busy_iter

From: Bart Van Assche
Date: Mon Mar 18 2019 - 13:16:30 EST


On Fri, 2019-03-15 at 16:57 +-0800, Jianchao Wang wrote:
+AD4 blk+AF8-mq+AF8-tagset+AF8-busy+AF8-iter is not safe that it could get stale request
+AD4 in tags-+AD4-rqs+AFsAXQ. Use blk+AF8-mq+AF8-queue+AF8-tag+AF8-busy+AF8-iter here.
+AD4
+AD4 Signed-off-by: Jianchao Wang +ADw-jianchao.w.wang+AEA-oracle.com+AD4
+AD4 ---
+AD4 drivers/block/nbd.c +AHw 2 +-
+AD4 1 file changed, 1 insertion(), 1 deletion(-)
+AD4
+AD4 diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+AD4 index 7c9a949..9e7e828 100644
+AD4 --- a/drivers/block/nbd.c
+AD4 +-+-+- b/drivers/block/nbd.c
+AD4 +AEAAQA -747,7 +-747,7 +AEAAQA static bool nbd+AF8-clear+AF8-req(struct request +ACo-req, void +ACo-data, bool reserved)
+AD4 static void nbd+AF8-clear+AF8-que(struct nbd+AF8-device +ACo-nbd)
+AD4 +AHs
+AD4 blk+AF8-mq+AF8-quiesce+AF8-queue(nbd-+AD4-disk-+AD4-queue)+ADs
+AD4 - blk+AF8-mq+AF8-tagset+AF8-busy+AF8-iter(+ACY-nbd-+AD4-tag+AF8-set, nbd+AF8-clear+AF8-req, NULL)+ADs
+AD4 +- blk+AF8-mq+AF8-queue+AF8-tag+AF8-busy+AF8-iter(nbd-+AD4-disk-+AD4-queue, nbd+AF8-clear+AF8-req, NULL, true)+ADs
+AD4 blk+AF8-mq+AF8-unquiesce+AF8-queue(nbd-+AD4-disk-+AD4-queue)+ADs
+AD4 dev+AF8-dbg(disk+AF8-to+AF8-dev(nbd-+AD4-disk), +ACI-queue cleared+AFw-n+ACI)+ADs
+AD4 +AH0

Hi Jianchao,

The nbd driver calls nbd+AF8-clear+AF8-que() after having called sock+AF8-shutdown(). So
what makes you think that it's not safe to call blk+AF8-mq+AF8-tagset+AF8-busy+AF8-iter()
from nbd+AF8-clear+AF8-que()?

Thanks,

Bart.