aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2001-12-13 05:07:48 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2001-12-13 05:07:48 +0000
commit9db12e5108cb95b8e1d82eba7ff5f2b32331e3a6 (patch)
treea98ceef299b1c81f7b5aaeec89abdf242330b72b /sys/ufs
parentbcb733d069ee3a1768be54caf89be82b6a902b52 (diff)
Notes
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_inode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index d0cd063eac162..9014a60988287 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -250,6 +250,18 @@ ffs_truncate(vp, length, flags, cred, td)
if (error) {
return (error);
}
+ /*
+ * When we are doing soft updates and the UFS_BALLOC
+ * above fills in a direct block hole with a full sized
+ * block that will be truncated down to a fragment below,
+ * we must flush out the block dependency with an FSYNC
+ * so that we do not get a soft updates inconsistency
+ * when we create the fragment below.
+ */
+ if (DOINGSOFTDEP(ovp) && lbn < NDADDR &&
+ fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize &&
+ (error = VOP_FSYNC(ovp, cred, MNT_WAIT, td)) != 0)
+ return (error);
oip->i_size = length;
size = blksize(fs, oip, lbn);
if (ovp->v_type != VDIR)