diff options
author | tegge <tegge@FreeBSD.org> | 2006-09-26 04:12:49 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 2006-09-26 04:12:49 +0000 |
commit | 83154f853d9ca39deb1add01e032aff1f0678514 (patch) | |
tree | ac46e0b5a80f88127d3d14dc940a5f2746573c00 /sys/fs/unionfs | |
parent | d7fe3e736512a1dd37a985037184eecf7df1f26d (diff) | |
download | FreeBSD-src-83154f853d9ca39deb1add01e032aff1f0678514.zip FreeBSD-src-83154f853d9ca39deb1add01e032aff1f0678514.tar.gz |
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().
Diffstat (limited to 'sys/fs/unionfs')
-rw-r--r-- | sys/fs/unionfs/union_vfsops.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index 0a65ea7..1d0d58e 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -86,7 +86,9 @@ union_mount(mp, td) /* * Disable clustered write, otherwise system becomes unstable. */ + MNT_ILOCK(mp); mp->mnt_flag |= MNT_NOCLUSTERW; + MNT_IUNLOCK(mp); if (mp->mnt_flag & MNT_ROOTFS) return (EOPNOTSUPP); @@ -246,8 +248,11 @@ union_mount(mp, td) if (um->um_op == UNMNT_ABOVE) { if (((um->um_lowervp == NULLVP) || (um->um_lowervp->v_mount->mnt_flag & MNT_LOCAL)) && - (um->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) + (um->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) { + MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; + MNT_IUNLOCK(mp); + } } /* @@ -257,7 +262,9 @@ union_mount(mp, td) * mount of the underlying filesystem to go from rdonly to rdwr * will leave the unioned view as read-only. */ + MNT_ILOCK(mp); mp->mnt_flag |= (um->um_uppervp->v_mount->mnt_flag & MNT_RDONLY); + MNT_IUNLOCK(mp); mp->mnt_data = (qaddr_t) um; vfs_getnewfsid(mp); |