Commit 943c7c69 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvme: hold ctrlr_lock when setting timeout callback



The per-process controller data may only be touched while holding the
ctrlr_lock.

Change-Id: I18c8c4e43db4d58e6b86f0c0fd222f6d30830b85
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/410952


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent cbd9c241
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1986,12 +1986,16 @@ spdk_nvme_ctrlr_register_timeout_callback(struct spdk_nvme_ctrlr *ctrlr,
{
	struct spdk_nvme_ctrlr_process	*active_proc;

	nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);

	active_proc = spdk_nvme_ctrlr_get_current_process(ctrlr);
	if (active_proc) {
		active_proc->timeout_ticks = nvme_timeout * spdk_get_ticks_hz();
		active_proc->timeout_cb_fn = cb_fn;
		active_proc->timeout_cb_arg = cb_arg;
	}

	nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
}

bool