diff mbox series

[2/9] block: assert the locking state in delete_partition

Message ID 20210722075402.983367-3-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/9] block: delay freeing the gendisk | expand

Commit Message

Christoph Hellwig July 22, 2021, 7:53 a.m. UTC
Add a lockdep assert instead of the outdated locking comment.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
---
 block/partitions/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Chaitanya Kulkarni July 22, 2021, 6:38 p.m. UTC | #1
On 7/22/2021 12:53 AM, Christoph Hellwig wrote:
> Add a lockdep assert instead of the outdated locking comment.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
> Reviewed-by: Ming Lei <ming.lei@redhat.com>
> ---
>   block/partitions/core.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/block/partitions/core.c b/block/partitions/core.c
> index 4230d4f71879..9902b1635b7d 100644
> --- a/block/partitions/core.c
> +++ b/block/partitions/core.c
> @@ -281,12 +281,10 @@ struct device_type part_type = {
>   	.uevent		= part_uevent,
>   };
>   
> -/*
> - * Must be called either with open_mutex held, before a disk can be opened or
> - * after all disk users are gone.
> - */
>   static void delete_partition(struct block_device *part)
>   {
> +	lockdep_assert_held(&part->bd_disk->open_mutex);
> +
>   	fsync_bdev(part);
>   	__invalidate_device(part, true);
>   
> 

Reviewed-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
diff mbox series

Patch

diff --git a/block/partitions/core.c b/block/partitions/core.c
index 4230d4f71879..9902b1635b7d 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -281,12 +281,10 @@  struct device_type part_type = {
 	.uevent		= part_uevent,
 };
 
-/*
- * Must be called either with open_mutex held, before a disk can be opened or
- * after all disk users are gone.
- */
 static void delete_partition(struct block_device *part)
 {
+	lockdep_assert_held(&part->bd_disk->open_mutex);
+
 	fsync_bdev(part);
 	__invalidate_device(part, true);