nvme-rdma: give up reconnect if state change fails
authorSagi Grimberg <sagi@grimberg.me>
Thu, 21 Sep 2017 14:01:37 +0000 (17:01 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Sep 2017 18:42:11 +0000 (12:42 -0600)
If we failed to transition to state LIVE after a successful reconnect,
then controller deletion already started. In this case there is no
point moving forward with reconnect.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/rdma.c

index 58983000964be4c2ce3280ca9f4dda768979ed76..8441f6b3f617d5a27dfe8235ae82d64d8221a6f7 100644 (file)
@@ -942,7 +942,12 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work)
        }
 
        changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
-       WARN_ON_ONCE(!changed);
+       if (!changed) {
+               /* state change failure is ok if we're in DELETING state */
+               WARN_ON_ONCE(ctrl->ctrl.state != NVME_CTRL_DELETING);
+               return;
+       }
+
        ctrl->ctrl.nr_reconnects = 0;
 
        nvme_start_ctrl(&ctrl->ctrl);