nvme-pci: put error value when state change fails
PATCH 1/1 nvme-pci: put error value when state change fails
If state change to NVME_CTRL_CONNECTING fails, the dmesg is going to be like:
[ 293.689160] nvme nvme0: failed to mark controller CONNECTING [ 293.689160] nvme nvme0: Removing after probe failure status: 0
Even it prints the first line to indicate the situation, the second line is not proper because the status is 0 which means normally success of the previous operation.
This patch makes it indicate the proper error value when it fails.
[ 25.932367] nvme nvme0: failed to mark controller CONNECTING [ 25.932369] nvme nvme0: Removing after probe failure status: -16
This situation is able to be easily reproduced by:
root at target:~# rmmod nvme && modprobe nvme && rmmod nvme
--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
@@ -2524,6 +2524,7 @@ static void nvme_reset_work(struct work_struct *work)if (!nvme_change_ctrl_state (&dev->ctrl,NVME_CTRL_CONNECTING )) {dev_warn (dev->ctrl.device,"failed to mark controller CONNECTING\n" ); + result = -EBUSY ; goto out; }
Signature · 1 line
2.21.0
PATCH 1/1 nvme-pci: put error value when state change fails
Looks good to me.
Quoted 34 lines · Minwoo Im
If state change to
NVME_CTRL_CONNECTINGfails, the dmesg is going to be like:[ 293.689160] nvme nvme0: failed to mark controller CONNECTING [ 293.689160] nvme nvme0: Removing after probe failure status: 0Even it prints the first line to indicate the situation, the second line is not proper because the status is 0 which means normally success of the previous operation.
This patch makes it indicate the proper error value when it fails.
[ 25.932367] nvme nvme0: failed to mark controller CONNECTING [ 25.932369] nvme nvme0: Removing after probe failure status: -16This situation is able to be easily reproduced by:
root at target:~# rmmod nvme && modprobe nvme && rmmod nvmeSigned-off-by Minwoo Im <minwoo.im.dev at gmail.com>--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)drivers/nvme/host/pci.c +1
-0@@ -2524,6 +2524,7 @@ static void nvme_reset_work(struct work_struct *work)if (!nvme_change_ctrl_state (&dev->ctrl,NVME_CTRL_CONNECTING )) {dev_warn (dev->ctrl.device,"failed to mark controller CONNECTING\n" ); + result = -EBUSY ; goto out; }
PATCH 1/1 nvme-pci: put error value when state change fails
In reply to Minwoo ImThanks,
applied to nvme-5.3.