aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-01-23 21:50:55 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-02-12 01:02:20 +0000
commit1de1e2bfbf3c089418bbe67c096d60315c8ca5dd (patch)
tree584ae225bfdd242d30a3e74b8090aab907381232 /sys/ufs
parent89fd61d955ada4fdb20030253206201bc279cdf0 (diff)
downloadsrc-1de1e2bfbf3c089418bbe67c096d60315c8ca5dd.tar.gz
src-1de1e2bfbf3c089418bbe67c096d60315c8ca5dd.zip
ffs_syncvnode: only clear IN_NEEDSYNC after successfull sync
If it is cleaned before the sync, other threads might see the inode without the flag set, because syncing could unlock it. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_vnops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 68985d8715f3..be2653e32adc 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -257,7 +257,6 @@ ffs_syncvnode(struct vnode *vp, int waitfor, int flags)
bool still_dirty, unlocked, wait;
ip = VTOI(vp);
- ip->i_flag &= ~IN_NEEDSYNC;
bo = &vp->v_bufobj;
ump = VFSTOUFS(vp->v_mount);
@@ -445,6 +444,8 @@ next:
}
if (error == 0 && unlocked)
error = ERELOOKUP;
+ if (error == 0)
+ ip->i_flag &= ~IN_NEEDSYNC;
return (error);
}