ocssd: hold lock when calling nvme_ctrlr_submit_admin_request

nvme_ctrlr_submit_admin_request() will access admin queue, and we
should hold ctrl->ctrlr_lock when access it.

Change-Id: Iff576fe5e14e854eb38dbc64d6c6d9ec1ba17056
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/c/444793
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
wuzhouhui 2019-02-15 09:36:48 +08:00 committed by Jim Harris
parent 64faa14d6e
commit 6b0d7b82c9

View File

@ -63,6 +63,7 @@ spdk_nvme_ocssd_ctrlr_cmd_geometry(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid,
{
struct nvme_request *req;
struct spdk_nvme_cmd *cmd;
int rc;
if (!payload || (payload_size != sizeof(struct spdk_ocssd_geometry_data))) {
return -EINVAL;
@ -79,7 +80,9 @@ spdk_nvme_ocssd_ctrlr_cmd_geometry(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid,
cmd = &req->cmd;
cmd->opc = SPDK_OCSSD_OPC_GEOMETRY;
cmd->nsid = nsid;
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
return nvme_ctrlr_submit_admin_request(ctrlr, req);
rc = nvme_ctrlr_submit_admin_request(ctrlr, req);
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
return rc;
}