提交 c81e55e0 编写于 作者: J James Smart 提交者: Sagi Grimberg

nvmet_fc: correct logic in disconnect queue LS handling

Correct logic in disconnect queue LS handling.
Rework so that queue searching and error reporting is above the
section to send back a ls rjt
Signed-off-by: NJames Smart <james.smart@broadcom.com>
Signed-off-by: NSagi Grimberg <sagi@grimberg.me>
上级 d61b7f97
...@@ -1314,7 +1314,7 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, ...@@ -1314,7 +1314,7 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
(struct fcnvme_ls_disconnect_rqst *)iod->rqstbuf; (struct fcnvme_ls_disconnect_rqst *)iod->rqstbuf;
struct fcnvme_ls_disconnect_acc *acc = struct fcnvme_ls_disconnect_acc *acc =
(struct fcnvme_ls_disconnect_acc *)iod->rspbuf; (struct fcnvme_ls_disconnect_acc *)iod->rspbuf;
struct nvmet_fc_tgt_queue *queue; struct nvmet_fc_tgt_queue *queue = NULL;
struct nvmet_fc_tgt_assoc *assoc; struct nvmet_fc_tgt_assoc *assoc;
int ret = 0; int ret = 0;
bool del_assoc = false; bool del_assoc = false;
...@@ -1348,7 +1348,18 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, ...@@ -1348,7 +1348,18 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
assoc = nvmet_fc_find_target_assoc(tgtport, assoc = nvmet_fc_find_target_assoc(tgtport,
be64_to_cpu(rqst->associd.association_id)); be64_to_cpu(rqst->associd.association_id));
iod->assoc = assoc; iod->assoc = assoc;
if (!assoc) if (assoc) {
if (rqst->discon_cmd.scope ==
FCNVME_DISCONN_CONNECTION) {
queue = nvmet_fc_find_target_queue(tgtport,
be64_to_cpu(
rqst->discon_cmd.id));
if (!queue) {
nvmet_fc_tgt_a_put(assoc);
ret = VERR_NO_CONN;
}
}
} else
ret = VERR_NO_ASSOC; ret = VERR_NO_ASSOC;
} }
...@@ -1373,9 +1384,7 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, ...@@ -1373,9 +1384,7 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
FCNVME_LS_DISCONNECT); FCNVME_LS_DISCONNECT);
if (rqst->discon_cmd.scope == FCNVME_DISCONN_CONNECTION) { /* are we to delete a Connection ID (queue) */
queue = nvmet_fc_find_target_queue(tgtport,
be64_to_cpu(rqst->discon_cmd.id));
if (queue) { if (queue) {
int qid = queue->qid; int qid = queue->qid;
...@@ -1388,7 +1397,6 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, ...@@ -1388,7 +1397,6 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
if (!qid) if (!qid)
del_assoc = true; del_assoc = true;
} }
}
/* release get taken in nvmet_fc_find_target_assoc */ /* release get taken in nvmet_fc_find_target_assoc */
nvmet_fc_tgt_a_put(iod->assoc); nvmet_fc_tgt_a_put(iod->assoc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册