linux/drivers/nvme/target
James Smart 6cdefc6e2a nvme: if_ready checks to fail io to deleting controller
The revised if_ready checks skipped over the case of returning error when
the controller is being deleted.  Instead it was returning BUSY, which
caused the ios to retry, which caused the ns delete to hang waiting for
the ios to drain.

Stack trace of hang looks like:
 kworker/u64:2   D    0    74      2 0x80000000
 Workqueue: nvme-delete-wq nvme_delete_ctrl_work [nvme_core]
 Call Trace:
  ? __schedule+0x26d/0x820
  schedule+0x32/0x80
  blk_mq_freeze_queue_wait+0x36/0x80
  ? remove_wait_queue+0x60/0x60
  blk_cleanup_queue+0x72/0x160
  nvme_ns_remove+0x106/0x140 [nvme_core]
  nvme_remove_namespaces+0x7e/0xa0 [nvme_core]
  nvme_delete_ctrl_work+0x4d/0x80 [nvme_core]
  process_one_work+0x160/0x350
  worker_thread+0x1c3/0x3d0
  kthread+0xf5/0x130
  ? process_one_work+0x350/0x350
  ? kthread_bind+0x10/0x10
  ret_from_fork+0x1f/0x30

Extend nvmf_fail_nonready_command() to supply the controller pointer so
that the controller state can be looked at. Fail any io to a controller
that is deleting.

Fixes: 3bc32bb118 ("nvme-fabrics: refactor queue ready check")
Fixes: 35897b920c ("nvme-fabrics: fix and refine state checks in __nvmf_check_ready")
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
2018-07-24 13:44:40 +02:00
..
admin-cmd.c nvmet: free smart-log buffer after use 2018-06-11 16:18:05 +02:00
configfs.c nvmet: filter newlines from user input 2018-06-08 12:51:10 -06:00
core.c nvmet: reset keep alive timer in controller enable 2018-06-20 14:20:51 +02:00
discovery.c nvmet: remove duplicate NULL initialization for req->ns 2018-05-25 16:50:12 +02:00
fabrics-cmd.c nvmet: remove duplicate NULL initialization for req->ns 2018-05-25 16:50:12 +02:00
fc.c nvmet-fc: fix target sgl list on large transfers 2018-07-24 13:44:09 +02:00
fcloop.c Merge branch 'for-4.16/block' of git://git.kernel.dk/linux-block 2018-01-29 11:51:49 -08:00
io-cmd-bdev.c nvmet: add simple file backed ns support 2018-05-25 16:50:12 +02:00
io-cmd-file.c nvmet: fix error return code in nvmet_file_ns_enable() 2018-05-31 18:46:46 +02:00
Kconfig nvmet-rdma: depend on INFINIBAND_ADDR_TRANS 2018-04-27 11:15:43 -04:00
loop.c nvme: if_ready checks to fail io to deleting controller 2018-07-24 13:44:40 +02:00
Makefile nvmet: add simple file backed ns support 2018-05-25 16:50:12 +02:00
nvmet.h nvmet: mask pending AENs 2018-06-01 14:37:35 +02:00
rdma.c nvmet: constify struct nvmet_fabrics_ops 2018-03-26 08:53:43 -06:00