Skip to content

Commit 52bd456

Browse files
committed
Merge branch 'nvme-4.19' of git://git.infradead.org/nvme into for-linus
Pull NVMe fixes from Christoph. * 'nvme-4.19' of git://git.infradead.org/nvme: nvmet: free workqueue object if module init fails nvme-fcloop: Fix dropped LS's to removed target port nvme-pci: add a memory barrier to nvme_dbbuf_update_and_check_event
2 parents 8f3fafc + 04db0e5 commit 52bd456

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

drivers/nvme/host/pci.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@ static bool nvme_dbbuf_update_and_check_event(u16 value, u32 *dbbuf_db,
316316
old_value = *dbbuf_db;
317317
*dbbuf_db = value;
318318

319+
/*
320+
* Ensure that the doorbell is updated before reading the event
321+
* index from memory. The controller needs to provide similar
322+
* ordering to ensure the envent index is updated before reading
323+
* the doorbell.
324+
*/
325+
mb();
326+
319327
if (!nvme_dbbuf_need_event(*dbbuf_ei, value, old_value))
320328
return false;
321329
}

drivers/nvme/target/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ static int __init nvmet_init(void)
12101210

12111211
error = nvmet_init_discovery();
12121212
if (error)
1213-
goto out;
1213+
goto out_free_work_queue;
12141214

12151215
error = nvmet_init_configfs();
12161216
if (error)
@@ -1219,6 +1219,8 @@ static int __init nvmet_init(void)
12191219

12201220
out_exit_discovery:
12211221
nvmet_exit_discovery();
1222+
out_free_work_queue:
1223+
destroy_workqueue(buffered_io_wq);
12221224
out:
12231225
return error;
12241226
}

drivers/nvme/target/fcloop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ fcloop_tgt_lsrqst_done_work(struct work_struct *work)
311311
struct fcloop_tport *tport = tls_req->tport;
312312
struct nvmefc_ls_req *lsreq = tls_req->lsreq;
313313

314-
if (tport->remoteport)
314+
if (!tport || tport->remoteport)
315315
lsreq->done(lsreq, tls_req->status);
316316
}
317317

@@ -329,6 +329,7 @@ fcloop_ls_req(struct nvme_fc_local_port *localport,
329329

330330
if (!rport->targetport) {
331331
tls_req->status = -ECONNREFUSED;
332+
tls_req->tport = NULL;
332333
schedule_work(&tls_req->work);
333334
return ret;
334335
}

0 commit comments

Comments
 (0)