aboutsummaryrefslogtreecommitdiff
path: root/sys/gnu/ext2fs/ext2_readwrite.c
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2000-12-17 23:57:05 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2000-12-17 23:57:05 +0000
commit6ddaf0f45e7b356053af082c8c7dac6b5b3312c6 (patch)
treeadb87a6ab6bf9d81a15f41a1876046e65e4d85a2 /sys/gnu/ext2fs/ext2_readwrite.c
parent6fce744ee340ce56c46936d097c5b07084699e8d (diff)
Notes
Diffstat (limited to 'sys/gnu/ext2fs/ext2_readwrite.c')
-rw-r--r--sys/gnu/ext2fs/ext2_readwrite.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/gnu/ext2fs/ext2_readwrite.c b/sys/gnu/ext2fs/ext2_readwrite.c
index f054a6e897b3..30a2f561c2fd 100644
--- a/sys/gnu/ext2fs/ext2_readwrite.c
+++ b/sys/gnu/ext2fs/ext2_readwrite.c
@@ -238,10 +238,19 @@ WRITE(ap)
if (uio->uio_offset + xfersize > ip->i_size)
vnode_pager_setsize(vp, uio->uio_offset + xfersize);
+ /*
+ * Avoid a data-consistency race between write() and mmap()
+ * by ensuring that newly allocated blocks are zerod. The
+ * race can occur even in the case where the write covers
+ * the entire block.
+ */
+ flags |= B_CLRBUF;
+#if 0
if (fs->s_frag_size > xfersize)
flags |= B_CLRBUF;
else
flags &= ~B_CLRBUF;
+#endif
error = ext2_balloc(ip,
lbn, blkoffset + xfersize, ap->a_cred, &bp, flags);