[31/78] loop: use set_disk_ro

Message ID 20201116145809.410558-32-hch@lst.de
State New
Headers show
Series
  • [01/78] block: remove the call to __invalidate_device in check_disk_size_change
Related show

Commit Message

Christoph Hellwig Nov. 16, 2020, 2:57 p.m.
Use set_disk_ro instead of set_device_ro to match all other block
drivers and to ensure all partitions mirror the read-only flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hannes Reinecke Nov. 20, 2020, 7:20 a.m. | #1
On 11/16/20 3:57 PM, Christoph Hellwig wrote:
> Use set_disk_ro instead of set_device_ro to match all other block

> drivers and to ensure all partitions mirror the read-only flag.

> 

> Signed-off-by: Christoph Hellwig <hch@lst.de>

> ---

>   drivers/block/loop.c | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/block/loop.c b/drivers/block/loop.c

> index 84a36c242e5550..41caf799df721f 100644

> --- a/drivers/block/loop.c

> +++ b/drivers/block/loop.c

> @@ -1134,7 +1134,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,

>   	if (error)

>   		goto out_unlock;

>   

> -	set_device_ro(bdev, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);

> +	set_disk_ro(lo->lo_disk, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);

>   

>   	lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;

>   	lo->lo_device = bdev;

> 

Reviewed-by: Hannes Reinecke <hare@suse.de>


Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 84a36c242e5550..41caf799df721f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1134,7 +1134,7 @@  static int loop_configure(struct loop_device *lo, fmode_t mode,
 	if (error)
 		goto out_unlock;
 
-	set_device_ro(bdev, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
+	set_disk_ro(lo->lo_disk, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
 
 	lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
 	lo->lo_device = bdev;