EROFS ("Read-only file system") error is incorretly returned when trying to open already existing file with 'O_CREAT' on a read-only filesystem
04시 25분 2013년 10월 18일 업데이트
문제
환경
- Red Hat Enterprise Linux 6
해결
¶Update to kernel version 2.6.32-358.10.1.el6 or later. See RHSA-2013:0911 for more details.
근본 원인
¶A bug in the do_filp_open() function caused it to exit early if any write access was requested on a read-only file system. This prevented the opening of device nodes on a read-only file system. With this update, the do_filp_open() has been fixed to no longer exit if a write request is made on a read-only file system.
¶The problem has been tracked in Bugzilla #920752.
진단 단계
¶Example steps to confirm this behaviour:
- prepare a filesystem:
dd if=/dev/zero of=foo bs=1M count=10
losetup -vf foo
mkfs.ext3 /dev/loop0
mount /dev/loop0 /mnt
mknod /mnt/null c 1 3
umount /mnt
- mount the filesystem read-only:
mount -o ro /dev/loop0 /mnt
- Try to write to the filesystem:
echo foo >> /mnt/null