lib/iscsi: Close the being hot-removed LUN even if connection is in exiting

_iscsi_conn_remove_lun() which is the callback to LUN hot-removal
returns immediately without closing the LUN if the connecion is
already in exiting, then expects that the LUN will be closed by
after the connection moves to the exited state.

LUN hot removal process doesn't check any R2T task if it is not
pending in SCSI layer but connection close process checks any R2T
task even if it is not pending in SCSI layer.

LUN hot removal will not complete until all LUN accesses are closed.

iscsi_conn_close_lun() checks if the LUN is already closed or not,
and so it will be no harm even if _iscsi_conn_remove_lun() calls
iscsi_conn_close_lun(). If the connection is in exited state,
all LUNs are already closed.

This patch changes _iscsi_conn_remove_lun() to return immediately
if the connection is in exited state.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iad6ecdc37493fa9f2d7ccab262a2c75dac2fcd48
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472507
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-10-28 11:18:28 +09:00 committed by Tomasz Zawadzki
parent 84f59335c2
commit 1ef8449feb

View File

@ -500,8 +500,8 @@ _iscsi_conn_remove_lun(void *_ctx)
assert(spdk_io_channel_get_thread(spdk_io_channel_from_ctx(conn->pg)) ==
spdk_get_thread());
/* If a connection is already in stating status, just return */
if (conn->state >= ISCSI_CONN_STATE_EXITING) {
/* If a connection is exited, associated LUNs are already closed and just return */
if (conn->state >= ISCSI_CONN_STATE_EXITED) {
return;
}