]> git.itanic.dy.fi Git - linux-stable/commitdiff
s390/dasd: fix possibly missed path verification
authorStefan Haberland <sth@linux.ibm.com>
Wed, 20 Oct 2021 11:51:24 +0000 (13:51 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 20 Oct 2021 14:10:42 +0000 (08:10 -0600)
__dasd_device_check_path_events() calls the discipline path event handler.
This handler can leave the 'to be verified pathmask' populated for an
additional verification.

There is a race window where the worker has finished before
dasd_path_clear_all_verify() is called which resets the tbvpm.

Due to this there could be outstanding path verifications missed.

Fix by clearing the pathmasks before calling the handler and add them
again in case of an error.

Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Link: https://lore.kernel.org/r/20211020115124.1735254-8-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/s390/block/dasd.c
drivers/s390/block/dasd_int.h

index e34c6cc61983b4cf38e3ec399e94627c376c7ac3..8e87a31e329d047c0172f55d31bb9e6989d71755 100644 (file)
@@ -2077,12 +2077,15 @@ static void __dasd_device_check_path_events(struct dasd_device *device)
 
        if (device->stopped & ~(DASD_STOPPED_DC_WAIT))
                return;
+
+       dasd_path_clear_all_verify(device);
+       dasd_path_clear_all_fcsec(device);
+
        rc = device->discipline->pe_handler(device, tbvpm, fcsecpm);
        if (rc) {
+               dasd_path_add_tbvpm(device, tbvpm);
+               dasd_path_add_fcsecpm(device, fcsecpm);
                dasd_device_set_timer(device, 50);
-       } else {
-               dasd_path_clear_all_verify(device);
-               dasd_path_clear_all_fcsec(device);
        }
 };
 
index 15d8731c1eeeb5baa28ef4f92cadc44ecf1c7428..8b458010f88a16434f8d29c23f2ac530d18db027 100644 (file)
@@ -1305,6 +1305,15 @@ static inline void dasd_path_add_ppm(struct dasd_device *device, __u8 pm)
                        dasd_path_preferred(device, chp);
 }
 
+static inline void dasd_path_add_fcsecpm(struct dasd_device *device, __u8 pm)
+{
+       int chp;
+
+       for (chp = 0; chp < 8; chp++)
+               if (pm & (0x80 >> chp))
+                       dasd_path_fcsec(device, chp);
+}
+
 /*
  * set functions for path masks
  * the existing path mask will be replaced by the given path mask