Skip to content

Commit 6d7160c

Browse files
mwilckmartinkpetersen
authored andcommitted
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]>
1 parent 3195019 commit 6d7160c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2784,9 +2784,11 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait);
27842784
static void scsi_device_block(struct scsi_device *sdev, void *data)
27852785
{
27862786
int err;
2787+
enum scsi_device_state state;
27872788

27882789
mutex_lock(&sdev->state_mutex);
27892790
err = __scsi_internal_device_block_nowait(sdev);
2791+
state = sdev->sdev_state;
27902792
if (err == 0)
27912793
/*
27922794
* 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)
27972799

27982800
mutex_unlock(&sdev->state_mutex);
27992801

2800-
WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n",
2801-
dev_name(&sdev->sdev_gendev), err);
2802+
WARN_ONCE(err, "%s: failed to block %s in state %d\n",
2803+
__func__, dev_name(&sdev->sdev_gendev), state);
28022804
}
28032805

28042806
/**

0 commit comments

Comments
 (0)