The checks done by e2fsck for mounted vs. read-only runs is confusing. On the one hand, if e2fsck is NOT run with the "-n" flag (i.e. it might modify the filesystem), there is no guarantee that it will open the filesystem with the EXCLUSIVE flag (i.e. O_EXCL) to prevent the block device from being used later (i.e. mounted while e2fsck is running). On the other hand, if e2fsck IS run with "-n" (i.e. read-only), and the /etc/fstab or /proc/mounts does not report the same block device to match the mountpoint (which happens for Lustre, and can also happen if there is an overlay mount) then the e2fsck incorrectly thinks the filesystem is unmounted, but fails because the EXCLUSIVE flag is set even though it is running read-only. Fix this so that "e2fsck -n" never sets EXCLUSIVE, and when run without "-n" it will always set EXCLUSIVE unless the user answered "yes" to: /dev/sda1 is mounted. WARNING!!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage. Do you really want to continue (y/n)? Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.
Attachment:
e2fsprogs-e2fsck_exclusive.patch
Description: Binary data