OSDN Git Service

nvme: allow calling nvme_change_ctrl_state from irq context
authorChristoph Hellwig <hch@lst.de>
Tue, 22 Aug 2017 09:42:24 +0000 (11:42 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 29 Aug 2017 08:22:23 +0000 (10:22 +0200)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/host/core.c

index 4c49ec4..d63e1fc 100644 (file)
@@ -176,9 +176,10 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                enum nvme_ctrl_state new_state)
 {
        enum nvme_ctrl_state old_state;
+       unsigned long flags;
        bool changed = false;
 
-       spin_lock_irq(&ctrl->lock);
+       spin_lock_irqsave(&ctrl->lock, flags);
 
        old_state = ctrl->state;
        switch (new_state) {
@@ -239,7 +240,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
        if (changed)
                ctrl->state = new_state;
 
-       spin_unlock_irq(&ctrl->lock);
+       spin_unlock_irqrestore(&ctrl->lock, flags);
 
        return changed;
 }