Skip to content

Commit

Permalink
ubd: move set_disk_ro to ubd_add
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Feb 27, 2024
1 parent 58ebe3e commit 5e4e1ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5e4e1ff

Please sign in to comment.