diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2007-01-06 20:46:02 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2007-01-06 20:46:02 +0000 |
commit | a533f9bcf630791d3f0d1f3537afbae114d8f145 (patch) | |
tree | ec58232f798b513b925dc497192dbd72e8a14e5f /sys/fs | |
parent | 9131a172735d17248d28f501ef0eb37ef082434f (diff) | |
download | FreeBSD-src-a533f9bcf630791d3f0d1f3537afbae114d8f145.zip FreeBSD-src-a533f9bcf630791d3f0d1f3537afbae114d8f145.tar.gz |
When performing a mount update to change a mount from read-only to read-write,
do not call markvoldirty() until the mount has been flagged as read-write.
Due to the nature of the msdosfs code, this bug only seemed to appear for
FAT-16 and FAT-32.
This fixes the testcase:
#!/bin/sh
dd if=/dev/zero bs=1m count=1 oseek=119 of=image.msdos
mdconfig -a -t vnode -f image.msdos
newfs_msdos -F 16 /dev/md0 fd120m
mount_msdosfs -o ro /dev/md0 /mnt
mount | grep md0
mount -u -o rw /dev/md0; echo $?
mount | grep md0
umount /mnt
mdconfig -d -u 0
PR: 105412
Tested by: Eugene Grosbein <eugen grosbein pp ru>
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index eb872bc..5bc7ba8 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -259,6 +259,7 @@ msdosfs_mount(struct mount *mp, struct thread *td) * read/write; if there is no device name, that's all we do. */ if (mp->mnt_flag & MNT_UPDATE) { + int ro_to_rw = 0; pmp = VFSTOMSDOSFS(mp); if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) { @@ -317,15 +318,20 @@ msdosfs_mount(struct mount *mp, struct thread *td) if (error) return (error); - /* Now that the volume is modifiable, mark it dirty. */ - error = markvoldirty(pmp, 1); - if (error) - return (error); + ro_to_rw = 1; } vfs_flagopt(mp->mnt_optnew, "ro", &pmp->pm_flags, MSDOSFSMNT_RONLY); vfs_flagopt(mp->mnt_optnew, "ro", &mp->mnt_flag, MNT_RDONLY); + + if (ro_to_rw) { + /* Now that the volume is modifiable, mark it dirty. */ + error = markvoldirty(pmp, 1); + if (error) + return (error); + } + if (vfs_getopt(mp->mnt_optnew, "from", NULL, NULL)) { #ifdef __notyet__ /* doesn't work correctly with current mountd XXX */ if (args.flags & MSDOSFSMNT_MNTOPT) { |