ubd: move set_disk_ro to ubd_add
No need to delay this until open time. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Richard Weinberger <richard@nod.at> Link: https://lore.kernel.org/r/20240222072417.3773131-6-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
58ebe3e748
commit
5e4e1ff820
@ -903,6 +903,7 @@ static int ubd_add(int n, char **error_out)
|
||||
set_capacity(disk, ubd_dev->size / 512);
|
||||
sprintf(disk->disk_name, "ubd%c", 'a' + n);
|
||||
disk->private_data = ubd_dev;
|
||||
set_disk_ro(disk, !ubd_dev->openflags.w);
|
||||
|
||||
ubd_dev->pdev.id = n;
|
||||
ubd_dev->pdev.name = DRIVER_NAME;
|
||||
@ -1159,7 +1160,6 @@ static int ubd_open(struct gendisk *disk, blk_mode_t mode)
|
||||
}
|
||||
}
|
||||
ubd_dev->count++;
|
||||
set_disk_ro(disk, !ubd_dev->openflags.w);
|
||||
out:
|
||||
mutex_unlock(&ubd_mutex);
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user