2020-04-09 23:35:02

by Qian Cai

[permalink] [raw]
Subject: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"

Reverted the linux-next commit on today’s tree,

d3ef5536274f (“block: fix busy device checking in blk_drop_partitions”)

makes IBM partition to be recognized again on s390 rootfs,

01: [ 83.443963] dasda:VOL1/ 0X0121: dasda1
01: [ 85.124667] qeth 0.0.8000 enc8000: renamed from eth0
01: [ 85.731860] dasd-eckd 0.0.0120: DASD with 4 KB/block, 72122400 KB total s
01: ize, 48 KB/track, compatible disk layout
01: [ 86.076722] dasdb:VOL1/ 0X0120: dasdb1 dasdb2

Otherwise, it is DOA,

00: Starting Show Plymouth Boot Screen...
00: [ 37.202263] qeth 0.0.8000: portname is deprecated and is ignored
00: [ 37.677993] qdio: 0.0.8002 OSA on SC 4 using AI:1 QEBSM:0 PRI:1 TDD:1 SIG
00: A:RW A
00: [ 37.770970] qeth 0.0.8000: MAC address 02:de:ad:be:ef:87 successfully reg
00: istered
00: [ 37.771547] qeth 0.0.8000: Device is a Virtual NIC QDIO card (level: V642
00: )
00: [ 37.771547] with link type Virt.NIC QDIO.
00: [ 38.036231] ccw_init (415) used greatest stack depth: 56496 bytes left
00: Starting dracut initqueue hook...
00: [ 39.176304] dasd-eckd 0.0.0120: A channel path to the device has become o
00: perational
00: [ 39.453273] dasd-eckd 0.0.0120: New DASD 3390/0E (CU 3990/01) with 100170
00: cylinders, 15 heads, 224 sectors
00: [ 39.655564] dasd-eckd 0.0.0121: A channel path to the device has become o
00: perational
00: [ 39.722706] dasd-eckd 0.0.0121: New DASD 3390/0E (CU 3990/01) with 100170
00: cylinders, 15 heads, 224 sectors
01: [ 41.133963] dasd-eckd 0.0.0121: DASD with 4 KB/block, 72122400 KB total s
01: ize, 48 KB/track, compatible disk layout
01: [ 41.145510] dasd-eckd 0.0.0120: DASD with 4 KB/block, 72122400 KB total s
01: ize, 48 KB/track, compatible disk layout
01: [ 41.609625] qeth 0.0.8000 enc8000: renamed from eth0
01: [ 41.609625] qeth 0.0.8000 enc8000: renamed from eth0
01: Warning: /dev/mapper/rhel_ibm--z--135-root does not exist
01: Warning: /dev/rhel_ibm-z-135/root does not exist
01: Warning: /dev/rhel_ibm-z-135/swap does not exist
01:
01: Generating "/run/initramfs/rdsosreport.txt"
01:
01:
01: Entering emergency mode. Exit the shell to continue.
01: Type "journalctl" to view system logs.
01: You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /b
01: oot
01: after mounting them and attach it to a bug report.
01:
01:
00: dracut:/#


2020-04-10 05:47:59

by Christoph Hellwig

[permalink] [raw]
Subject: Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"

Please try this patch:

---
From f42fb98cc627f9b960fd5b9a3a229da5c5dcf54a Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <[email protected]>
Date: Fri, 10 Apr 2020 07:14:13 +0200
Subject: block: fix busy device checking in blk_drop_partitions again

The previous fix had an off by one in the bd_openers checking, counting
the callers blkdev_get.

Fixes: d3ef5536274f ("block: fix busy device checking in blk_drop_partitions")
Signed-off-by: Christoph Hellwig <[email protected]>
---
block/partitions/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/partitions/core.c b/block/partitions/core.c
index 1a0a829d8416..bc1ded1331b1 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)

if (!disk_part_scan_enabled(disk))
return 0;
- if (bdev->bd_part_count || bdev->bd_openers)
+ if (bdev->bd_part_count || bdev->bd_openers > 1)
return -EBUSY;
res = invalidate_partition(disk, 0);
if (res)
--
2.25.1

2020-04-10 12:21:24

by Qian Cai

[permalink] [raw]
Subject: Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"



> On Apr 10, 2020, at 1:45 AM, Christoph Hellwig <[email protected]> wrote:
>
> Please try this patch:

It works fine.

>
> ---
> From f42fb98cc627f9b960fd5b9a3a229da5c5dcf54a Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <[email protected]>
> Date: Fri, 10 Apr 2020 07:14:13 +0200
> Subject: block: fix busy device checking in blk_drop_partitions again
>
> The previous fix had an off by one in the bd_openers checking, counting
> the callers blkdev_get.
>
> Fixes: d3ef5536274f ("block: fix busy device checking in blk_drop_partitions")
> Signed-off-by: Christoph Hellwig <[email protected]>
> ---
> block/partitions/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/partitions/core.c b/block/partitions/core.c
> index 1a0a829d8416..bc1ded1331b1 100644
> --- a/block/partitions/core.c
> +++ b/block/partitions/core.c
> @@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)
>
> if (!disk_part_scan_enabled(disk))
> return 0;
> - if (bdev->bd_part_count || bdev->bd_openers)
> + if (bdev->bd_part_count || bdev->bd_openers > 1)
> return -EBUSY;
> res = invalidate_partition(disk, 0);
> if (res)
> --
> 2.25.1
>

2020-04-23 11:11:51

by Michal Koutný

[permalink] [raw]
Subject: Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"

Hi.

On Fri, Apr 10, 2020 at 07:45:44AM +0200, Christoph Hellwig <[email protected]> wrote:
> @@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)
> - if (bdev->bd_part_count || bdev->bd_openers)
> + if (bdev->bd_part_count || bdev->bd_openers > 1)
> return -EBUSY;
I noticed this (and the previous patch) change unmasks race between
ioctl(LOOP_SET_STATUS64, ... lo_flags=LO_FLAGS_PARTSCAN ...) and udev
processing loop device uevents. See [1] for details.

Should the condition be changed in the case of newly setup loop devices?
(Or shouldn't the ioctl propagate EBUSY in its return value?)

Thanks,
Michal

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=1169932


Attachments:
(No filename) (722.00 B)
signature.asc (849.00 B)
Digital signature
Download all attachments

2020-04-27 16:12:19

by Christoph Hellwig

[permalink] [raw]
Subject: Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"

Hi Michal,

can you try the patch below? That should solve the udev race for real
hopefully.

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index da693e6a834e5..20dbe4cf62cf9 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1318,6 +1318,9 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
if (err)
goto out_unfreeze;

+ /* don't send uevents until we've finished the partition scan */
+ dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 1);
+
if (lo->lo_offset != info->lo_offset ||
lo->lo_sizelimit != info->lo_sizelimit) {
/* kill_bdev should have truncated all the pages */
@@ -1377,6 +1380,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
if (partscan)
loop_reread_partitions(lo, bdev);

+ dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0);
return err;
}