[PATCH 4.4 147/190] s390/dasd: fix hanging safe offline

2018-04-11 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Stefan Haberland 


[ Upstream commit e8ac01555d9e464249e8bb122337d6d6e5589ccc ]

The safe offline processing may hang forever because it waits for I/O
which can not be started because of the offline flag that prevents new
I/O from being started.

Allow I/O to be started during safe offline processing because in this
special case we take care that the queues are empty before throwing away
the device.

Signed-off-by: Stefan Haberland 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/s390/block/dasd.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1881,8 +1881,12 @@ static int __dasd_device_is_unusable(str
 {
int mask = ~(DASD_STOPPED_DC_WAIT | DASD_UNRESUMED_PM);
 
-   if (test_bit(DASD_FLAG_OFFLINE, >flags)) {
-   /* dasd is being set offline. */
+   if (test_bit(DASD_FLAG_OFFLINE, >flags) &&
+   !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, >flags)) {
+   /*
+* dasd is being set offline
+* but it is no safe offline where we have to allow I/O
+*/
return 1;
}
if (device->stopped) {




[PATCH 4.4 147/190] s390/dasd: fix hanging safe offline

2018-04-11 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Stefan Haberland 


[ Upstream commit e8ac01555d9e464249e8bb122337d6d6e5589ccc ]

The safe offline processing may hang forever because it waits for I/O
which can not be started because of the offline flag that prevents new
I/O from being started.

Allow I/O to be started during safe offline processing because in this
special case we take care that the queues are empty before throwing away
the device.

Signed-off-by: Stefan Haberland 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/s390/block/dasd.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1881,8 +1881,12 @@ static int __dasd_device_is_unusable(str
 {
int mask = ~(DASD_STOPPED_DC_WAIT | DASD_UNRESUMED_PM);
 
-   if (test_bit(DASD_FLAG_OFFLINE, >flags)) {
-   /* dasd is being set offline. */
+   if (test_bit(DASD_FLAG_OFFLINE, >flags) &&
+   !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, >flags)) {
+   /*
+* dasd is being set offline
+* but it is no safe offline where we have to allow I/O
+*/
return 1;
}
if (device->stopped) {