scsi: core: Complain if scsi_target_block() fails
authorBart Van Assche <bvanassche@acm.org>
Thu, 1 Aug 2019 22:38:13 +0000 (15:38 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 8 Aug 2019 01:45:10 +0000 (21:45 -0400)
If scsi_target_block() fails that can break the code that calls this
function. Hence complain loudly if scsi_target_block() fails.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c

index 7a4ac7a8e907fb2340fdc046e041c38a57df7c01..d47d637e6be256c8fa0d0309398c5c212d7ee258 100644 (file)
@@ -2772,7 +2772,12 @@ static int scsi_internal_device_unblock(struct scsi_device *sdev,
 static void
 device_block(struct scsi_device *sdev, void *data)
 {
-       scsi_internal_device_block(sdev);
+       int ret;
+
+       ret = scsi_internal_device_block(sdev);
+
+       WARN_ONCE(ret, "scsi_internal_device_block(%s) failed: ret = %d\n",
+                 dev_name(&sdev->sdev_gendev), ret);
 }
 
 static int