Skip to content

Commit aceaa18

Browse files
Stefan Haberlandgregkh
authored andcommitted
s390/dasd: Fix gendisk parent after copy pair swap
commit c943bfc upstream. After a copy pair swap the block device's "device" symlink points to the secondary CCW device, but the gendisk's parent remained the primary, leaving /sys/block/<dasdx> under the wrong parent. Move the gendisk to the secondary's device with device_move(), keeping the sysfs topology consistent after the swap. Fixes: 413862c ("s390/dasd: add copy pair swap capability") Cc: stable@vger.kernel.org #6.1 Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3b95fdb commit aceaa18

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/s390/block/dasd_eckd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6150,6 +6150,7 @@ static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid
61506150
struct dasd_copy_relation *copy;
61516151
struct dasd_block *block;
61526152
struct gendisk *gdp;
6153+
int rc;
61536154

61546155
copy = device->copy;
61556156
if (!copy)
@@ -6184,6 +6185,13 @@ static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid
61846185
/* swap blocklayer device link */
61856186
gdp = block->gdp;
61866187
dasd_add_link_to_gendisk(gdp, secondary);
6188+
rc = device_move(disk_to_dev(gdp), &secondary->cdev->dev, DPM_ORDER_NONE);
6189+
if (rc) {
6190+
dev_err(&primary->cdev->dev,
6191+
"copy_pair_swap: moving blockdevice parent %s->%s failed (%d)\n",
6192+
dev_name(&primary->cdev->dev),
6193+
dev_name(&secondary->cdev->dev), rc);
6194+
}
61876195

61886196
/* re-enable device */
61896197
dasd_device_remove_stop_bits(primary, DASD_STOPPED_PPRC);

0 commit comments

Comments
 (0)