public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: xfs@oss.sgi.com
Cc: Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH] 260: Add another corner case where length is zero
Date: Tue,  9 Oct 2012 14:16:52 +0200	[thread overview]
Message-ID: <1349785012-28588-1-git-send-email-lczerner@redhat.com> (raw)

This commit adds another corner case to test FITRIM argument handling.
In this case we set length to zero and we expect the number of discarded
bytes to be obviously zero, however we've had bug in both ext4 and xfs
where the internal variable would underflow. This test case will be able
to catch that in future.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 260 |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/260 b/260
index b005cd3..2ade9b3 100755
--- a/260
+++ b/260
@@ -98,6 +98,19 @@ _scratch_unmount
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
+# This should return zero
+out=$("$FSTRIM" -v -s0 -l0 $SCRATCH_MNT)
+bytes=${out%% *}
+if [ $bytes -ne 0 ]; then
+	status=1
+	echo "We requested zero bytes to be discarded, however $bytes bytes"\
+	     "were discarded instead. Length handling probably underflowed."
+fi
+
+_scratch_unmount
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
 # This is a bit fuzzy, but since the file system is fresh
 # there should be at least (fssize/2) free space to trim.
 # This is supposed to catch wrong FITRIM argument handling
-- 
1.7.7.6

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2012-10-09 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 12:16 Lukas Czerner [this message]
2012-10-09 13:39 ` [PATCH] 260: Add another corner case where length is zero Carlos Maiolino
2012-10-09 19:40 ` Dave Chinner
2012-10-09 21:23   ` Lukáš Czerner
2012-10-09 21:39     ` Dave Chinner
2012-10-10  6:53       ` Lukáš Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349785012-28588-1-git-send-email-lczerner@redhat.com \
    --to=lczerner@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox