Skip to content

Commit 5e4e1ff

Browse files
Christoph Hellwigaxboe
authored andcommitted
ubd: move set_disk_ro to ubd_add
No need to delay this until open time. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Richard Weinberger <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 58ebe3e commit 5e4e1ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/um/drivers/ubd_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,7 @@ static int ubd_add(int n, char **error_out)
903903
set_capacity(disk, ubd_dev->size / 512);
904904
sprintf(disk->disk_name, "ubd%c", 'a' + n);
905905
disk->private_data = ubd_dev;
906+
set_disk_ro(disk, !ubd_dev->openflags.w);
906907

907908
ubd_dev->pdev.id = n;
908909
ubd_dev->pdev.name = DRIVER_NAME;
@@ -1159,7 +1160,6 @@ static int ubd_open(struct gendisk *disk, blk_mode_t mode)
11591160
}
11601161
}
11611162
ubd_dev->count++;
1162-
set_disk_ro(disk, !ubd_dev->openflags.w);
11631163
out:
11641164
mutex_unlock(&ubd_mutex);
11651165
return err;

0 commit comments

Comments
 (0)