Skip to content

Commit 4c527c7

Browse files
Stefan Haberlandaxboe
authored andcommitted
s390/dasd: Copy detected format information to secondary device
During online processing for a DASD device an IO operation is started to determine the format of the device. CDL format contains specifically sized blocks at the beginning of the disk. For a PPRC secondary device no real IO operation is possible therefore this IO request can not be started and this step is skipped for online processing of secondary devices. This is generally fine since the secondary is a copy of the primary device. In case of an additional partition detection that is run after a swap operation the format information is needed to properly drive partition detection IO. Currently the information is not passed leading to IO errors during partition detection and a wrongly detected partition table which in turn might lead to data corruption on the disk with the wrong partition table. Fix by passing the format information from primary to secondary device. Fixes: 413862c ("s390/dasd: add copy pair swap capability") Cc: stable@vger.kernel.org khadas#6.1 Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com> Acked-by: Eduard Shishkin <edward6@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://patch.msgid.link/20260310142330.4080106-3-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 40e9cd4 commit 4c527c7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/s390/block/dasd_eckd.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6135,6 +6135,7 @@ static void copy_pair_set_active(struct dasd_copy_relation *copy, char *new_busi
61356135
static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid,
61366136
char *sec_busid)
61376137
{
6138+
struct dasd_eckd_private *prim_priv, *sec_priv;
61386139
struct dasd_device *primary, *secondary;
61396140
struct dasd_copy_relation *copy;
61406141
struct dasd_block *block;
@@ -6155,6 +6156,9 @@ static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid
61556156
if (!secondary)
61566157
return DASD_COPYPAIRSWAP_SECONDARY;
61576158

6159+
prim_priv = primary->private;
6160+
sec_priv = secondary->private;
6161+
61586162
/*
61596163
* usually the device should be quiesced for swap
61606164
* for paranoia stop device and requeue requests again
@@ -6187,6 +6191,13 @@ static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid
61876191
dasd_device_remove_stop_bits(primary, DASD_STOPPED_QUIESCE);
61886192
}
61896193

6194+
/*
6195+
* The secondary device never got through format detection, but since it
6196+
* is a copy of the primary device, the format is exactly the same;
6197+
* therefore, the detected layout can simply be copied.
6198+
*/
6199+
sec_priv->uses_cdl = prim_priv->uses_cdl;
6200+
61906201
/* re-enable device */
61916202
dasd_device_remove_stop_bits(primary, DASD_STOPPED_PPRC);
61926203
dasd_device_remove_stop_bits(secondary, DASD_STOPPED_PPRC);

0 commit comments

Comments
 (0)