Skip to content

Commit b74487c

Browse files
Keith Buschjfvogel
authored andcommitted
nvme-pci: add missing unlock for reset error
The reset work holds a mutex to prevent races with removal modifying the same resources, but was unlocking only on success. Unlock on failure too. Fixes: 5c959d7 ("nvme-pci: fix rapid add remove sequence") Signed-off-by: Keith Busch <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> (cherry picked from commit 4726bcf) Orabug: 29933720 Signed-off-by: Alan Adamson <[email protected]> Reviewed-by: John Donnelly <[email protected]>
1 parent 7edaa46 commit b74487c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/nvme/host/pci.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,15 +2271,15 @@ static void nvme_reset_work(struct work_struct *work)
22712271
mutex_lock(&dev->shutdown_lock);
22722272
result = nvme_pci_enable(dev);
22732273
if (result)
2274-
goto out;
2274+
goto out_unlock;
22752275

22762276
result = nvme_pci_configure_admin_queue(dev);
22772277
if (result)
2278-
goto out;
2278+
goto out_unlock;
22792279

22802280
result = nvme_alloc_admin_tags(dev);
22812281
if (result)
2282-
goto out;
2282+
goto out_unlock;
22832283

22842284
/*
22852285
* Limit the max command size to prevent iod->sg allocations going
@@ -2362,6 +2362,8 @@ static void nvme_reset_work(struct work_struct *work)
23622362
nvme_start_ctrl(&dev->ctrl);
23632363
return;
23642364

2365+
out_unlock:
2366+
mutex_unlock(&dev->shutdown_lock);
23652367
out:
23662368
nvme_remove_dead_ctrl(dev, result);
23672369
}

0 commit comments

Comments
 (0)