Home Home > GIT Browse > SLE12-SP3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2019-01-11 15:12:56 +0100
committerHannes Reinecke <hare@suse.de>2019-01-11 15:13:54 +0100
commitff6abf83a5aa5824aa34962e3e79921a3656707f (patch)
tree85f5368861a6f117a3053c27a1fb0a0fb412e9fa
parent7b195cb287b54b4cb3e1bcfea19f9487b8168b70 (diff)
scsi: Make __scsi_remove_device go straight from BLOCKED to DEL
(bsc#1119877).
-rw-r--r--patches.fixes/scsi-Make-__scsi_remove_device-go-straight-from-BLOC.patch94
-rw-r--r--series.conf1
2 files changed, 95 insertions, 0 deletions
diff --git a/patches.fixes/scsi-Make-__scsi_remove_device-go-straight-from-BLOC.patch b/patches.fixes/scsi-Make-__scsi_remove_device-go-straight-from-BLOC.patch
new file mode 100644
index 0000000000..d5dd8e234d
--- /dev/null
+++ b/patches.fixes/scsi-Make-__scsi_remove_device-go-straight-from-BLOC.patch
@@ -0,0 +1,94 @@
+From: Bart Van Assche <bart.vanassche@sandisk.com>
+Date: Fri, 2 Jun 2017 14:21:57 -0700
+Subject: [PATCH] scsi: Make __scsi_remove_device go straight from BLOCKED to
+ DEL
+Git-commit: 255ee9320e5dc46173bb94dbcd68e32f11fc10a9
+References: bsc#1119877
+Patch-Mainline: v4.13-rc1
+
+If a device is blocked, make __scsi_remove_device() cause it to
+transition to the DEL state. This means that all the commands issued in
+.shutdown() will error in the mid-layer, thus making the removal proceed
+without being stopped.
+
+This patch is a slightly modified version of a patch from James
+Bottomley. This patch avoids that the following lockup occurs:
+
+Call Trace:
+ schedule+0x35/0x80
+ schedule_timeout+0x237/0x2d0
+ io_schedule_timeout+0xa6/0x110
+ wait_for_completion_io+0xa3/0x110
+ blk_execute_rq+0xdf/0x120
+ scsi_execute+0xce/0x150 [scsi_mod]
+ scsi_execute_req_flags+0x8f/0xf0 [scsi_mod]
+ sd_sync_cache+0xa9/0x190 [sd_mod]
+ sd_shutdown+0x6a/0x100 [sd_mod]
+ sd_remove+0x64/0xc0 [sd_mod]
+ __device_release_driver+0x8d/0x120
+ device_release_driver+0x1e/0x30
+ bus_remove_device+0xf9/0x170
+ device_del+0x127/0x240
+ __scsi_remove_device+0xc1/0xd0 [scsi_mod]
+ scsi_forget_host+0x57/0x60 [scsi_mod]
+ scsi_remove_host+0x72/0x110 [scsi_mod]
+ srp_remove_work+0x8b/0x200 [ib_srp]
+
+Reported-by: Israel Rukshin <israelr@mellanox.com>
+Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
+Cc: Israel Rukshin <israelr@mellanox.com>
+Cc: Max Gurtovoy <maxg@mellanox.com>
+Cc: Benjamin Block <bblock@linux.vnet.ibm.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+---
+ drivers/scsi/scsi_lib.c | 2 +-
+ drivers/scsi/scsi_sysfs.c | 10 ++++++++++
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
+index ed744668b984..0554a6a7ea55 100644
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -2625,7 +2625,6 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
+ case SDEV_QUIESCE:
+ case SDEV_OFFLINE:
+ case SDEV_TRANSPORT_OFFLINE:
+- case SDEV_BLOCK:
+ break;
+ default:
+ goto illegal;
+@@ -2639,6 +2638,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
+ case SDEV_OFFLINE:
+ case SDEV_TRANSPORT_OFFLINE:
+ case SDEV_CANCEL:
++ case SDEV_BLOCK:
+ case SDEV_CREATED_BLOCK:
+ break;
+ default:
+diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
+index a91537a3abbf..ce470f62a8ae 100644
+--- a/drivers/scsi/scsi_sysfs.c
++++ b/drivers/scsi/scsi_sysfs.c
+@@ -1290,7 +1290,17 @@ void __scsi_remove_device(struct scsi_device *sdev)
+ * wait until it has finished before changing the device state.
+ */
+ mutex_lock(&sdev->state_mutex);
++ /*
++ * If blocked, we go straight to DEL and restart the queue so
++ * any commands issued during driver shutdown (like sync
++ * cache) are errored immediately.
++ */
+ res = scsi_device_set_state(sdev, SDEV_CANCEL);
++ if (res != 0) {
++ res = scsi_device_set_state(sdev, SDEV_DEL);
++ if (res == 0)
++ scsi_start_queue(sdev);
++ }
+ mutex_unlock(&sdev->state_mutex);
+
+ if (res != 0)
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 470a1f3da0..82d5789d6b 100644
--- a/series.conf
+++ b/series.conf
@@ -21170,6 +21170,7 @@
patches.fixes/scsi-Create-two-versions-of-scsi_internal_device_unb.patch
patches.fixes/scsi-Protect-SCSI-device-state-changes-with-a-mutex.patch
patches.fixes/scsi-Introduce-scsi_start_queue.patch
+ patches.fixes/scsi-Make-__scsi_remove_device-go-straight-from-BLOC.patch
patches.drivers/scsi-qla2xxx-remove-redundant-null-check-on-tgt.patch
patches.drivers/scsi-qla2xxx-Fix-compile-warning.patch
patches.drivers/0019-scsi-qedf-Fix-a-return-value-in-case-of-error-in-qed.patch