aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Wilck <[email protected]>2023-06-14 12:36:16 +0200
committerMartin K. Petersen <[email protected]>2023-06-16 12:19:59 -0400
commit6d7160c7da6fa3010252910a1680c62ababa6c2f (patch)
treeb3ce2a2d0b1f3b1ef3a262e469429b097b9325ae
parent31950192d939a969415d0e1da4c62598023b0850 (diff)
scsi: core: Improve warning message in scsi_device_block()
If __scsi_internal_device_block() returns an error, it is always -EINVAL because of an invalid state transition. For debugging purposes, it makes more sense to print the device state. Signed-off-by: Martin Wilck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r--drivers/scsi/scsi_lib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 55a327b2dd8b..ea21e11ed51e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2784,9 +2784,11 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait);
static void scsi_device_block(struct scsi_device *sdev, void *data)
{
int err;
+ enum scsi_device_state state;
mutex_lock(&sdev->state_mutex);
err = __scsi_internal_device_block_nowait(sdev);
+ state = sdev->sdev_state;
if (err == 0)
/*
* scsi_stop_queue() must be called with the state_mutex
@@ -2797,8 +2799,8 @@ static void scsi_device_block(struct scsi_device *sdev, void *data)
mutex_unlock(&sdev->state_mutex);
- WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n",
- dev_name(&sdev->sdev_gendev), err);
+ WARN_ONCE(err, "%s: failed to block %s in state %d\n",
+ __func__, dev_name(&sdev->sdev_gendev), state);
}
/**