Skip to content

Commit 420dc73

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvme: fix regression upon hot device removal and insertion
When we validate the new controller id, we want to skip controllers that are either deleting or dead. Fix the check to do that and not on the newly added controller. Fixes: 1b1031c ("nvme: validate cntlid during controller initialisation") Reported-by: Jon Derrick <[email protected]> Tested-by: Jon Derrick <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 4c73cbd commit 420dc73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/nvme/host/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,8 +2416,8 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
24162416
lockdep_assert_held(&nvme_subsystems_lock);
24172417

24182418
list_for_each_entry(tmp, &subsys->ctrls, subsys_entry) {
2419-
if (ctrl->state == NVME_CTRL_DELETING ||
2420-
ctrl->state == NVME_CTRL_DEAD)
2419+
if (tmp->state == NVME_CTRL_DELETING ||
2420+
tmp->state == NVME_CTRL_DEAD)
24212421
continue;
24222422

24232423
if (tmp->cntlid == ctrl->cntlid) {

0 commit comments

Comments
 (0)