From 83154f853d9ca39deb1add01e032aff1f0678514 Mon Sep 17 00:00:00 2001 From: tegge Date: Tue, 26 Sep 2006 04:12:49 +0000 Subject: Use mount interlock to protect all changes to mnt_flag and mnt_kern_flag. This eliminates a race where MNT_UPDATE flag could be lost when nmount() raced against sync(), sync_fsync() or quotactl(). --- sys/fs/cd9660/cd9660_vfsops.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/fs/cd9660/cd9660_vfsops.c') diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 30aba51..9a5e836 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -137,7 +137,9 @@ cd9660_mount(struct mount *mp, struct thread *td) /* * Unconditionally mount as read-only. */ + MNT_ILOCK(mp); mp->mnt_flag |= MNT_RDONLY; + MNT_IUNLOCK(mp); fspec = vfs_getopts(mp->mnt_optnew, "from", &error); if (error) @@ -378,7 +380,9 @@ iso_mountfs(devvp, mp, td) mp->mnt_stat.f_fsid.val[0] = dev2udev(dev); mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; mp->mnt_maxsymlinklen = 0; + MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; + MNT_IUNLOCK(mp); isomp->im_mountp = mp; isomp->im_dev = dev; isomp->im_devvp = devvp; @@ -528,7 +532,9 @@ cd9660_unmount(mp, mntflags, td) vrele(isomp->im_devvp); free((caddr_t)isomp, M_ISOFSMNT); mp->mnt_data = (qaddr_t)0; + MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_LOCAL; + MNT_IUNLOCK(mp); return (error); } -- cgit v1.1