linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"
@ 2020-04-09 23:33 Qian Cai
  2020-04-10  5:45 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Qian Cai @ 2020-04-09 23:33 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	linux-block, linux-s390, LKML

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:/# 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"
  2020-04-09 23:33 s390 boot woe due to "block: fix busy device checking in blk_drop_partitions" Qian Cai
@ 2020-04-10  5:45 ` Christoph Hellwig
  2020-04-10 12:20   ` Qian Cai
  2020-04-23 11:07   ` Michal Koutný
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-04-10  5:45 UTC (permalink / raw)
  To: Qian Cai
  Cc: Christoph Hellwig, Jens Axboe, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, linux-block, linux-s390, LKML

Please try this patch:

---
From f42fb98cc627f9b960fd5b9a3a229da5c5dcf54a Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
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 <hch@lst.de>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"
  2020-04-10  5:45 ` Christoph Hellwig
@ 2020-04-10 12:20   ` Qian Cai
  2020-04-23 11:07   ` Michal Koutný
  1 sibling, 0 replies; 5+ messages in thread
From: Qian Cai @ 2020-04-10 12:20 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	linux-block, linux-s390, LKML



> On Apr 10, 2020, at 1:45 AM, Christoph Hellwig <hch@lst.de> wrote:
> 
> Please try this patch:

It works fine.

> 
> ---
> From f42fb98cc627f9b960fd5b9a3a229da5c5dcf54a Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> 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 <hch@lst.de>
> ---
> 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
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"
  2020-04-10  5:45 ` Christoph Hellwig
  2020-04-10 12:20   ` Qian Cai
@ 2020-04-23 11:07   ` Michal Koutný
  2020-04-27 16:10     ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Michal Koutný @ 2020-04-23 11:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Qian Cai, Jens Axboe, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, linux-block, linux-s390, LKML

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

Hi.

On Fri, Apr 10, 2020 at 07:45:44AM +0200, Christoph Hellwig <hch@lst.de> 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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: s390 boot woe due to "block: fix busy device checking in blk_drop_partitions"
  2020-04-23 11:07   ` Michal Koutný
@ 2020-04-27 16:10     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-04-27 16:10 UTC (permalink / raw)
  To: Michal Koutný
  Cc: Christoph Hellwig, Qian Cai, Jens Axboe, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, linux-block, linux-s390,
	LKML

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;
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-27 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09 23:33 s390 boot woe due to "block: fix busy device checking in blk_drop_partitions" Qian Cai
2020-04-10  5:45 ` Christoph Hellwig
2020-04-10 12:20   ` Qian Cai
2020-04-23 11:07   ` Michal Koutný
2020-04-27 16:10     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).