numam-spdk/lib/scsi
Darek Stojaczyk 7a1c568598 Revert "SCSI: Stop I/O flooding to hot-removing LUN from iSCSI target"
Hotremoving a bdev exposed as a vhost-scsi LUN which
has an allocated io_channel is broken now. By detaching
LUNs from their SCSI devices at the start of LUN
hotremoval, we can end up with the LUN's descriptor
completely leaked.

Upon hotremove, each LUN fires a hotremove_cb to the
upper layer (iscsi/vhost) and starts a poller to
periodically check if lun->io_channel has been closed
already. While iSCSI allocates and frees io_channels
for particular LUNs separately using
spdk_scsi_lun_allocate_io_channel(), vhost allocates
and frees io_channels for the entire SCSI device using
spdk_scsi_dev_free_io_channels(), as it knows there's
only one LUN per SCSI device.

Since LUNs are removed from SCSI devices at the start
of LUN hotremoval, the spdk_scsi_dev_free_io_channels()
is not able to close the io_channel of the child LUN.
That LUN is no longer referenced there, and the function
returns immediately without any error.

By reverting this patch, we practically defer removing
LUN from SCSI device until the bdev descriptor is closed,
that is, until that spdk_scsi_dev_free_io_channels()
and the subsequent spdk_scsi_dev_destruct() in vhost
is called.

Historically, spdk_scsi_lun_free_io_channel() was
introduced after vhost-scsi already supported hotremove,
so before we can introduce a change like this one we
have to refactor vhost to use the new APIs first.

This reverts commit 497997bc60.

Change-Id: I58a9988a22694f5b5b927173098ac8218270462e
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455371
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-24 23:46:53 +00:00
..
dev.c lib/scsi: Make spdk_scsi_dev_destruct asynchronous 2019-04-22 18:22:59 +00:00
lun.c Revert "SCSI: Stop I/O flooding to hot-removing LUN from iSCSI target" 2019-05-24 23:46:53 +00:00
Makefile scsi: add persistent reservation out with register feature support 2019-05-24 23:04:03 +00:00
port.c scsi: add iSCSI initiator port TransportID 2018-12-05 16:04:06 +00:00
scsi_bdev.c scsi: add persistent reservation out with register feature support 2019-05-24 23:04:03 +00:00
scsi_internal.h scsi: add persistent reservation out with register feature support 2019-05-24 23:04:03 +00:00
scsi_pr.c scsi: add persistent reservation out command with preempt service action support 2019-05-24 23:04:03 +00:00
scsi_rpc.c scsi: Use spdk_json_write_named_* APIs throughout 2019-02-04 07:08:04 +00:00
scsi.c trace: remove short_name 2019-05-02 08:41:56 +00:00
task.c scsi: alloc temporary data buffer with regular calloc 2019-05-01 17:59:34 +00:00