All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: remove the bd_openers checks in blk_drop_partitions
@ 2020-04-28  8:52 Christoph Hellwig
  2020-04-28 10:20 ` Michal Koutný
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2020-04-28  8:52 UTC (permalink / raw)
  To: axboe; +Cc: sandeen, linux-block, Michal Koutný, Yang Xu

When replacing the bd_super check with a bd_openers I followed a logical
conclusion, which turns out to be utterly wrong.  When a block device has
bd_super sets it has a mount file system on it (although not every
mounted file system sets bd_super), but that also implies it doesn't even
have partitions to start with.

So instead of trying to come up with a logical check for all openers,
just remove the check entirely.

Fixes: d3ef5536274f ("block: fix busy device checking in blk_drop_partitions")
Fixes: cb6b771b05c3 ("block: fix busy device checking in blk_drop_partitions again")
Reported-by: Michal Koutný <mkoutny@suse.com>
Reported-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
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 bc1ded1331b14..9ef48a8cff867 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 > 1)
+	if (bdev->bd_part_count)
 		return -EBUSY;
 	res = invalidate_partition(disk, 0);
 	if (res)
-- 
2.26.1


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

* Re: [PATCH] block: remove the bd_openers checks in blk_drop_partitions
  2020-04-28  8:52 [PATCH] block: remove the bd_openers checks in blk_drop_partitions Christoph Hellwig
@ 2020-04-28 10:20 ` Michal Koutný
  2020-04-30 16:01 ` Christoph Hellwig
  2020-04-30 16:26 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Koutný @ 2020-04-28 10:20 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, sandeen, linux-block, Yang Xu

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

Hi.

On Tue, Apr 28, 2020 at 10:52:03AM +0200, Christoph Hellwig <hch@lst.de> wrote:
> So instead of trying to come up with a logical check for all openers,
> just remove the check entirely.
I ignored the original suppression patch and I just confirm that
v5.7-rc3 has still broken partscan, whereas v5.7-rc3 + this patch works
as expected.

Michal

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

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

* Re: [PATCH] block: remove the bd_openers checks in blk_drop_partitions
  2020-04-28  8:52 [PATCH] block: remove the bd_openers checks in blk_drop_partitions Christoph Hellwig
  2020-04-28 10:20 ` Michal Koutný
@ 2020-04-30 16:01 ` Christoph Hellwig
  2020-04-30 16:26 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2020-04-30 16:01 UTC (permalink / raw)
  To: axboe; +Cc: sandeen, linux-block, Michal Koutný, Yang Xu

Jens,

can you pick this one up?

On Tue, Apr 28, 2020 at 10:52:03AM +0200, Christoph Hellwig wrote:
> When replacing the bd_super check with a bd_openers I followed a logical
> conclusion, which turns out to be utterly wrong.  When a block device has
> bd_super sets it has a mount file system on it (although not every
> mounted file system sets bd_super), but that also implies it doesn't even
> have partitions to start with.
> 
> So instead of trying to come up with a logical check for all openers,
> just remove the check entirely.
> 
> Fixes: d3ef5536274f ("block: fix busy device checking in blk_drop_partitions")
> Fixes: cb6b771b05c3 ("block: fix busy device checking in blk_drop_partitions again")
> Reported-by: Michal Koutný <mkoutny@suse.com>
> Reported-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> 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 bc1ded1331b14..9ef48a8cff867 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 > 1)
> +	if (bdev->bd_part_count)
>  		return -EBUSY;
>  	res = invalidate_partition(disk, 0);
>  	if (res)
> -- 
> 2.26.1
---end quoted text---

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

* Re: [PATCH] block: remove the bd_openers checks in blk_drop_partitions
  2020-04-28  8:52 [PATCH] block: remove the bd_openers checks in blk_drop_partitions Christoph Hellwig
  2020-04-28 10:20 ` Michal Koutný
  2020-04-30 16:01 ` Christoph Hellwig
@ 2020-04-30 16:26 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2020-04-30 16:26 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: sandeen, linux-block, Michal Koutný, Yang Xu

On 4/28/20 2:52 AM, Christoph Hellwig wrote:
> When replacing the bd_super check with a bd_openers I followed a logical
> conclusion, which turns out to be utterly wrong.  When a block device has
> bd_super sets it has a mount file system on it (although not every
> mounted file system sets bd_super), but that also implies it doesn't even
> have partitions to start with.
> 
> So instead of trying to come up with a logical check for all openers,
> just remove the check entirely.

Applied, thanks.

-- 
Jens Axboe


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  8:52 [PATCH] block: remove the bd_openers checks in blk_drop_partitions Christoph Hellwig
2020-04-28 10:20 ` Michal Koutný
2020-04-30 16:01 ` Christoph Hellwig
2020-04-30 16:26 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.