Q. block: check bdev_read_only() from blkdev_get()

J. R. Okajima
2011-01-21T13:23:51Z

By the commit 75f1dc0
2010-11-13 block: check bdev_read_only() from blkdev_get()
bdev_read_only() call is added into blkdev_get().

This check makes the loopback block device unable to be mounted as
writable once it is set to readonly, even if the corresponding is
detached and the device becomes free.
We may need to re-initialize the readonly/writable status flag somewhere?

# simple tests with loopback

# mount as writable, succeed
+ sudo mount -o loop ./ext2.img /mnt
+ sudo umount /mnt

# mount as readonly, succeed
+ sudo mount -o ro,loop ./ext2.img /mnt
+ sudo umount /mnt

# mount as writable again, fail
+ sudo mount -o loop ./ext2.img /mnt
/dev/loop0: Permission denied

Now /dev/loop0 is fixed as readonly.

J. R. Okajima