summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_extattr.c
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2006-09-26 04:15:59 +0000
committertegge <tegge@FreeBSD.org>2006-09-26 04:15:59 +0000
commitf42473d76b149849661d41c1f44a36dd01096d40 (patch)
tree3bc9361221d5a734023278052dddd20fb2025bee /sys/kern/vfs_extattr.c
parentb500b0ae92746b6a7309c0f88afadb7c588fd859 (diff)
downloadFreeBSD-src-f42473d76b149849661d41c1f44a36dd01096d40.zip
FreeBSD-src-f42473d76b149849661d41c1f44a36dd01096d40.tar.gz
Add mnt_noasync counter to better handle interleaved calls to nmount(),
sync() and sync_fsync() without losing MNT_ASYNC. Add MNTK_ASYNC flag which is set only when MNT_ASYNC is set and mnt_noasync is zero, and check that flag instead of MNT_ASYNC before initiating async io.
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r--sys/kern/vfs_extattr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 147b31e..d23f19b 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -122,7 +122,6 @@ sync(td, uap)
{
struct mount *mp, *nmp;
int vfslocked;
- int asyncflag;
mtx_lock(&mountlist_mtx);
for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
@@ -134,13 +133,16 @@ sync(td, uap)
if ((mp->mnt_flag & MNT_RDONLY) == 0 &&
vn_start_write(NULL, &mp, V_NOWAIT) == 0) {
MNT_ILOCK(mp);
- asyncflag = mp->mnt_flag & MNT_ASYNC;
- mp->mnt_flag &= ~MNT_ASYNC;
+ mp->mnt_noasync++;
+ mp->mnt_kern_flag &= ~MNTK_ASYNC;
MNT_IUNLOCK(mp);
vfs_msync(mp, MNT_NOWAIT);
VFS_SYNC(mp, MNT_NOWAIT, td);
MNT_ILOCK(mp);
- mp->mnt_flag |= asyncflag;
+ mp->mnt_noasync--;
+ if ((mp->mnt_flag & MNT_ASYNC) != 0 &&
+ mp->mnt_noasync == 0)
+ mp->mnt_kern_flag |= MNTK_ASYNC;
MNT_IUNLOCK(mp);
vn_finished_write(mp);
}
OpenPOWER on IntegriCloud