nvmf: stop paused subsystem correctly

For live migration support in vfio-user transport, we need to pause
the subsystem when starting migration in source VM, then after
migration, the subsystem is in paused state, when exiting the
application, we will call spdk_nvmf_subsystem_stop() at last,
and existing code will assert this case.

Change-Id: If5214c45973b27f6092c4a6d71ede336e54d89e8
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9407
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
This commit is contained in:
Changpeng Liu 2021-09-07 20:39:15 +08:00
parent ae7019417e
commit fa949b0c14

View File

@ -539,6 +539,11 @@ nvmf_subsystem_set_state(struct spdk_nvmf_subsystem *subsystem,
state == SPDK_NVMF_SUBSYSTEM_PAUSING) {
expected_old_state = SPDK_NVMF_SUBSYSTEM_RESUMING;
}
/* This is for the case when stopping paused subsystem */
if (actual_old_state == SPDK_NVMF_SUBSYSTEM_PAUSED &&
state == SPDK_NVMF_SUBSYSTEM_DEACTIVATING) {
expected_old_state = SPDK_NVMF_SUBSYSTEM_PAUSED;
}
actual_old_state = expected_old_state;
__atomic_compare_exchange_n(&subsystem->state, &actual_old_state, state, false,
__ATOMIC_RELAXED, __ATOMIC_RELAXED);