xfs
[Top] [All Lists]

Re: [PATCH] 260: Add another corner case where length is zero

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH] 260: Add another corner case where length is zero
From: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
Date: Tue, 9 Oct 2012 10:39:58 -0300
In-reply-to: <1349785012-28588-1-git-send-email-lczerner@xxxxxxxxxx>
Mail-followup-to: xfs@xxxxxxxxxxx
References: <1349785012-28588-1-git-send-email-lczerner@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Oct 09, 2012 at 02:16:52PM +0200, Lukas Czerner wrote:
> 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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

Looks good,

Reviewed-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
-- 
--Carlos

<Prev in Thread] Current Thread [Next in Thread>