Commit 3e967963 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

nvmf: assert that subsystem cb_fn/cb_arg don't get set twice



nvmf_subsystem_state_change() protects against going
starting the pause/change/resume chain again if we
haven't completed the previous chain.  But add
some asserts to make sure the cb_fn and cb_args
never get set twice.  This also requires setting
them back to NULL after they've been used.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I56c6c89bfb108223f731d5ac28100abbb746ab2f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5531


Community-CI: Broadcom CI
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 392b0746
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3409,6 +3409,8 @@ _nvmf_request_complete(void *ctx)
		    sgroup->io_outstanding == 0) {
			sgroup->state = SPDK_NVMF_SUBSYSTEM_PAUSED;
			sgroup->cb_fn(sgroup->cb_arg, 0);
			sgroup->cb_fn = NULL;
			sgroup->cb_arg = NULL;
		}
	}

+2 −0
Original line number Diff line number Diff line
@@ -1424,7 +1424,9 @@ nvmf_poll_group_pause_subsystem(struct spdk_nvmf_poll_group *group,
	sgroup->state = SPDK_NVMF_SUBSYSTEM_PAUSING;

	if (sgroup->io_outstanding > 0) {
		assert(sgroup->cb_fn == NULL);
		sgroup->cb_fn = cb_fn;
		assert(sgroup->cb_arg == NULL);
		sgroup->cb_arg = cb_arg;
		return;
	}