Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

s390/dasd: Fix gendisk parent after copy pair swap

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: 413862caad6f ("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>

authored by

Stefan Haberland and committed by
Jens Axboe
c943bfc6 7d09a8e2

+8
+8
drivers/s390/block/dasd_eckd.c
··· 6150 6150 struct dasd_copy_relation *copy; 6151 6151 struct dasd_block *block; 6152 6152 struct gendisk *gdp; 6153 + int rc; 6153 6154 6154 6155 copy = device->copy; 6155 6156 if (!copy) ··· 6185 6184 /* swap blocklayer device link */ 6186 6185 gdp = block->gdp; 6187 6186 dasd_add_link_to_gendisk(gdp, secondary); 6187 + rc = device_move(disk_to_dev(gdp), &secondary->cdev->dev, DPM_ORDER_NONE); 6188 + if (rc) { 6189 + dev_err(&primary->cdev->dev, 6190 + "copy_pair_swap: moving blockdevice parent %s->%s failed (%d)\n", 6191 + dev_name(&primary->cdev->dev), 6192 + dev_name(&secondary->cdev->dev), rc); 6193 + } 6188 6194 6189 6195 /* re-enable device */ 6190 6196 dasd_device_remove_stop_bits(primary, DASD_STOPPED_PPRC);