This allows userspace to distinguish what is going on. EACCES is returned when user lacks required capability, not that device is read-only. Signed-off-by: Milan Broz <mbroz@xxxxxxxxxx> --- fs/block_dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index c9cf9f7..db2c8db 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1219,7 +1219,7 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) /* __blkdev_get() may alter read only status, check it afterwards */ if (!res && (mode & FMODE_WRITE) && bdev_read_only(bdev)) { __blkdev_put(bdev, mode, 0); - res = -EACCES; + res = -EROFS; } if (whole) { -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel