https://bugzilla.novell.com/show_bug.cgi?id=300694#c20
--- Comment #20 from Bernhard Kaindl 2007-08-21 17:53:58 MST ---
Created an attachment (id=158857)
--> (https://bugzilla.novell.com/attachment.cgi?id=158857)
[PATCH] If the new mount option "rwonly" is not given, automatically fall back
to read-only mount if volume is dirty
The attached patch implements a new mount option which I called "rwonly",
which, if given, disables the fallback to a read-only mount if the volume is
dirty and makes mount fail in this case, which is the current behaviour of
ntfs-3g.
Otherwise, if rwonly is not given, it works like the previous patch, which
adds the fall-back to read-only mode if the volume is given (and also allows
to manually use the "ro" option to force read-only mode wihtout using force
on a dirty volume.
This patch does not yet log mount errors to syslog(3), but if any mount error
happens during system boot, it is found /var/log/boot.msg:
Mounting local file systems...
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
debugfs on /sys/kernel/debug type debugfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
/dev/sda6 on /home type reiserfs (rw)
Volume is scheduled for check. Please boot into Windows TWICE, or
use the 'force' mount option. For example type on the command line:
mount -t ntfs-3g /ntfs.image /media/ntfs -o force
Or add the option to the relevant row in the /etc/fstab file:
/ntfs.image /media/ntfs ntfs-3g defaults,force 0 0
failed<notice>'boot.localfs start' exits with status 0
<notice>boot.apparmor start
Loading AppArmor module done
BTW, a colleague told me that hfsplus has already a such fallback from
read-write to read-only -- from fs/hfsplus/super.c:
if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
printk("hfs: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
} else if (sbi->flags & HFSPLUS_SB_FORCE) {
/* nothing */
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
printk("hfs: Filesystem is marked locked, mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
printk("hfs: write access to a jounaled filesystem is not supported, "
"use the force option at your own risk, mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
}
As Szaka prefers the rw-only behaviour and as I'd find it handy to be able to
change the default mount flags of ntfs-3g in system-wide and user-specifc
config files, and if he (or we) like the idea, I'd also like to implement
those.
In Szaka's upstream code, the defaults could then implement rw-only by default
and we or other admins could specify e.g. 'mount_dirty_ro' (which is what we
want) and e.g. 'fmask=133,dmask=022' using /etc/ntfs3grc (and ~/.ntfs3grc for
users which do not like the settings in /etc) so that a user or admin who
simply mounts an ntfs-filesystem gets safer defaults than the default 777
permissions and if that would be accepted by Skzaka, we would not have to patch
ntfs-3g but only need to provide config files.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.