Skip to content

Commit 4db69a3

Browse files
ChaitanayaKulkarniaxboe
authored andcommitted
nvmet: add ns tear down label for pt-cmd handling
In the current implementation before submitting the passthru cmd we may come across error e.g. getting ns from passthru controller, allocating a request from passthru controller, etc. For all the failure cases it only uses single goto label fail_out. In the target code, we follow the pattern to have a separate label for each error out the case when setting up multiple things before the actual action. This patch follows the same pattern and renames generic fail_out label to out_put_ns and updates the error out cases in the nvmet_passthru_execute_cmd() where it is needed. Signed-off-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Logan Gunthorpe <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e398863 commit 4db69a3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/nvme/target/passthru.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
230230
if (unlikely(!ns)) {
231231
pr_err("failed to get passthru ns nsid:%u\n", nsid);
232232
status = NVME_SC_INVALID_NS | NVME_SC_DNR;
233-
goto fail_out;
233+
goto out;
234234
}
235235

236236
q = ns->queue;
@@ -240,14 +240,14 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
240240
if (IS_ERR(rq)) {
241241
rq = NULL;
242242
status = NVME_SC_INTERNAL;
243-
goto fail_out;
243+
goto out_put_ns;
244244
}
245245

246246
if (req->sg_cnt) {
247247
ret = nvmet_passthru_map_sg(req, rq);
248248
if (unlikely(ret)) {
249249
status = NVME_SC_INTERNAL;
250-
goto fail_out;
250+
goto out_put_ns;
251251
}
252252
}
253253

@@ -274,9 +274,10 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
274274

275275
return;
276276

277-
fail_out:
277+
out_put_ns:
278278
if (ns)
279279
nvme_put_ns(ns);
280+
out:
280281
nvmet_req_complete(req, status);
281282
blk_put_request(rq);
282283
}

0 commit comments

Comments
 (0)