linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfstests: add another fallocate test to 214
@ 2010-01-04 23:18 Eric Sandeen
  2010-01-06 16:49 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2010-01-04 23:18 UTC (permalink / raw)
  To: xfs mailing list, ext4 development; +Cc: Theodore Tso

ext4 had a regression where it double-accounted used blocks
if you fallocated on top of delalloc blocks.  Ted sent a
c program to exploit it (see "fsstress-induced corruption reproduced"
on linux-ext4 on 12/31/2009) and it's trivial to do the same thing
within the xfstests framework using xfs_io.

This also changes the handcrafted xfs_io tests to use the
_require_xfs_io_falloc helper, not sure how that got missed.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/214 b/214
index 98cfc3a..35ec2cb 100755
--- a/214
+++ b/214
@@ -52,14 +52,7 @@ _supported_os Linux
 
 rm -f $seq.full
 
-testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $TEST_DIR/$tmp.io 2>&1`
-
-# Old xfs_io doesn't have fallocate support
-echo $testio | grep -q "not found" && \
-	_notrun "xfs_io fallocate support is missing"
-# Old glibc, old kernels, and some filesystems don't have fallocate support
-echo $testio | grep -q "Operation not supported" && \
-	_notrun "xfs_io fallocate command failed (old kernel? wrong fs?)"
+_require_xfs_io_falloc
 
 # Ok, off we go.
 
@@ -126,6 +119,20 @@ $XFS_IO_PROG -F -f -d				\
 
 rm -f $TEST_DIR/ouch
 
+# Reported by Ted Ts'o on linux-ext4, 12/31/2009
+# double-allocation on ext4 when fallocating over delalloc blocks
+# Regression due to d21cd8f163ac44b15c465aab7306db931c606908
+
+echo "=== delalloc write 16k; fallocate same range ==="
+# delalloc write 16k, fallocate same range.
+# Should get caught on fsck when we're done.
+
+$XFS_IO_PROG -F -f				\
+	-c "pwrite 0 16k"			\
+	-c "falloc 0 16k"			\
+	-c "fsync"				\
+	$TEST_DIR/ouch2 | _filter_xfs_io_unique
+
 # success, all done
 status=0
 exit


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfstests: add another fallocate test to 214
  2010-01-04 23:18 [PATCH] xfstests: add another fallocate test to 214 Eric Sandeen
@ 2010-01-06 16:49 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2010-01-06 16:49 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs mailing list, ext4 development, Theodore Tso

On Mon, Jan 04, 2010 at 05:18:09PM -0600, Eric Sandeen wrote:
> ext4 had a regression where it double-accounted used blocks
> if you fallocated on top of delalloc blocks.  Ted sent a
> c program to exploit it (see "fsstress-induced corruption reproduced"
> on linux-ext4 on 12/31/2009) and it's trivial to do the same thing
> within the xfstests framework using xfs_io.
> 
> This also changes the handcrafted xfs_io tests to use the
> _require_xfs_io_falloc helper, not sure how that got missed.

Looks good,


Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-06 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-04 23:18 [PATCH] xfstests: add another fallocate test to 214 Eric Sandeen
2010-01-06 16:49 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).