[S390] dasd_pm: fix stop flag handling
[cascardo/linux.git] / drivers / s390 / block / dasd.c
index e5b84db..99e7153 100644 (file)
@@ -2503,15 +2503,25 @@ int dasd_generic_restore_device(struct ccw_device *cdev)
        if (IS_ERR(device))
                return PTR_ERR(device);
 
+       /* allow new IO again */
+       device->stopped &= ~DASD_STOPPED_PM;
+       device->stopped &= ~DASD_UNRESUMED_PM;
+
        dasd_schedule_device_bh(device);
        if (device->block)
                dasd_schedule_block_bh(device->block);
 
        if (device->discipline->restore)
                rc = device->discipline->restore(device);
+       if (rc)
+               /*
+                * if the resume failed for the DASD we put it in
+                * an UNRESUMED stop state
+                */
+               device->stopped |= DASD_UNRESUMED_PM;
 
        dasd_put_device(device);
-       return rc;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(dasd_generic_restore_device);