diff mbox series

generic/260: f2fs is also special

Message ID 20210611112211.1408767-3-sunke32@huawei.com (mailing list archive)
State New, archived
Headers show
Series generic/260: f2fs is also special | expand

Commit Message

Sun Ke June 11, 2021, 11:22 a.m. UTC
It seem that f2fs also special like btrfs.

 [+] Default length with start set (should succeed)
 [+] Length beyond the end of fs (should succeed)
 [+] Length beyond the end of fs with start set (should succeed)
+After the full fs discard 0 bytes were discarded however the file system is 12882804736 bytes long.
+It seems that fs logic handling len argument overflows

Signed-off-by: Sun Ke <sunke32@huawei.com>
---
I am not sure about that. o(╯□╰)o

 tests/generic/260 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sun Ke June 15, 2021, 3:29 a.m. UTC | #1
to linux-f2fs-devel@lists.sourceforge.net

在 2021/6/11 19:22, Sun Ke 写道:
> It seem that f2fs also special like btrfs.
> 
>   [+] Default length with start set (should succeed)
>   [+] Length beyond the end of fs (should succeed)
>   [+] Length beyond the end of fs with start set (should succeed)
> +After the full fs discard 0 bytes were discarded however the file system is 12882804736 bytes long.
> +It seems that fs logic handling len argument overflows
> 
> Signed-off-by: Sun Ke <sunke32@huawei.com>
> ---
> I am not sure about that. o(╯□╰)o
> 
>   tests/generic/260 | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/260 b/tests/generic/260
> index 8021aa68..6bd861d2 100755
> --- a/tests/generic/260
> +++ b/tests/generic/260
> @@ -100,7 +100,7 @@ fi
>   # It is because btrfs does not have not-yet-used parts of the device
>   # mapped and since we got here right after the mkfs, there is not
>   # enough free extents in the root tree.
> -if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
> +if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && [ $FSTYP != "f2fs" ]; then
>   	status=1
>   	echo "After the full fs discard $bytes bytes were discarded"\
>   	     "however the file system is $(_math "$fssize*1024") bytes long."
> @@ -160,7 +160,7 @@ _scratch_mount
>   # mapped and since we got here right after the mkfs, there is not
>   # enough free extents in the root tree.
>   bytes=$($FSTRIM_PROG -v -l$len $SCRATCH_MNT | _filter_fstrim)
> -if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
> +if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && [ $FSTYP != "f2fs" ]; then
>   	status=1
>   	echo "It seems that fs logic handling len argument overflows"
>   fi
>
Chao Yu June 16, 2021, 1:43 p.m. UTC | #2
On 2021/6/15 11:29, Sun Ke wrote:
> to linux-f2fs-devel@lists.sourceforge.net
> 
> 在 2021/6/11 19:22, Sun Ke 写道:
>> It seem that f2fs also special like btrfs.
>>
>>   [+] Default length with start set (should succeed)
>>   [+] Length beyond the end of fs (should succeed)
>>   [+] Length beyond the end of fs with start set (should succeed)
>> +After the full fs discard 0 bytes were discarded however the file system is 12882804736 bytes long.
>> +It seems that fs logic handling len argument overflows

Well, the root cause is f2fs can tag a special flag TRIMMED_FLAG to
indicate the whole filesystem is trimmed, so after mkfs/fstrim(),
following fstrim() won't trim any block.

Can you please update commit message and add comments in script?

Thanks,

>>
>> Signed-off-by: Sun Ke <sunke32@huawei.com>
>> ---
>> I am not sure about that. o(╯□╰)o
>>
>>   tests/generic/260 | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/generic/260 b/tests/generic/260
>> index 8021aa68..6bd861d2 100755
>> --- a/tests/generic/260
>> +++ b/tests/generic/260
>> @@ -100,7 +100,7 @@ fi
>>   # It is because btrfs does not have not-yet-used parts of the device
>>   # mapped and since we got here right after the mkfs, there is not
>>   # enough free extents in the root tree.
>> -if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
>> +if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && [ $FSTYP != "f2fs" ]; then
>>       status=1
>>       echo "After the full fs discard $bytes bytes were discarded"\
>>            "however the file system is $(_math "$fssize*1024") bytes long."
>> @@ -160,7 +160,7 @@ _scratch_mount
>>   # mapped and since we got here right after the mkfs, there is not
>>   # enough free extents in the root tree.
>>   bytes=$($FSTRIM_PROG -v -l$len $SCRATCH_MNT | _filter_fstrim)
>> -if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
>> +if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && [ $FSTYP != "f2fs" ]; then
>>       status=1
>>       echo "It seems that fs logic handling len argument overflows"
>>   fi
>>
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sun Ke June 17, 2021, 6:38 a.m. UTC | #3
在 2021/6/16 21:43, Chao Yu 写道:
> On 2021/6/15 11:29, Sun Ke wrote:
>> to linux-f2fs-devel@lists.sourceforge.net
>>
>> 在 2021/6/11 19:22, Sun Ke 写道:
>>> It seem that f2fs also special like btrfs.
>>>
>>>   [+] Default length with start set (should succeed)
>>>   [+] Length beyond the end of fs (should succeed)
>>>   [+] Length beyond the end of fs with start set (should succeed)
>>> +After the full fs discard 0 bytes were discarded however the file 
>>> system is 12882804736 bytes long.
>>> +It seems that fs logic handling len argument overflows
> 
> Well, the root cause is f2fs can tag a special flag TRIMMED_FLAG to
> indicate the whole filesystem is trimmed, so after mkfs/fstrim(),
> following fstrim() won't trim any block.
> 
> Can you please update commit message and add comments in script?
> 
> Thanks,

Glad to do that.

Thanks,
Sun Ke
> 
>>>
>>> Signed-off-by: Sun Ke <sunke32@huawei.com>
>>> ---
>>> I am not sure about that. o(╯□╰)o
>>>
>>>   tests/generic/260 | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/generic/260 b/tests/generic/260
>>> index 8021aa68..6bd861d2 100755
>>> --- a/tests/generic/260
>>> +++ b/tests/generic/260
>>> @@ -100,7 +100,7 @@ fi
>>>   # It is because btrfs does not have not-yet-used parts of the device
>>>   # mapped and since we got here right after the mkfs, there is not
>>>   # enough free extents in the root tree.
>>> -if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
>>> +if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && 
>>> [ $FSTYP != "f2fs" ]; then
>>>       status=1
>>>       echo "After the full fs discard $bytes bytes were discarded"\
>>>            "however the file system is $(_math "$fssize*1024") bytes 
>>> long."
>>> @@ -160,7 +160,7 @@ _scratch_mount
>>>   # mapped and since we got here right after the mkfs, there is not
>>>   # enough free extents in the root tree.
>>>   bytes=$($FSTRIM_PROG -v -l$len $SCRATCH_MNT | _filter_fstrim)
>>> -if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
>>> +if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && 
>>> [ $FSTYP != "f2fs" ]; then
>>>       status=1
>>>       echo "It seems that fs logic handling len argument overflows"
>>>   fi
>>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
diff mbox series

Patch

diff --git a/tests/generic/260 b/tests/generic/260
index 8021aa68..6bd861d2 100755
--- a/tests/generic/260
+++ b/tests/generic/260
@@ -100,7 +100,7 @@  fi
 # It is because btrfs does not have not-yet-used parts of the device
 # mapped and since we got here right after the mkfs, there is not
 # enough free extents in the root tree.
-if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
+if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && [ $FSTYP != "f2fs" ]; then
 	status=1
 	echo "After the full fs discard $bytes bytes were discarded"\
 	     "however the file system is $(_math "$fssize*1024") bytes long."
@@ -160,7 +160,7 @@  _scratch_mount
 # mapped and since we got here right after the mkfs, there is not
 # enough free extents in the root tree.
 bytes=$($FSTRIM_PROG -v -l$len $SCRATCH_MNT | _filter_fstrim)
-if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
+if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ] && [ $FSTYP != "f2fs" ]; then
 	status=1
 	echo "It seems that fs logic handling len argument overflows"
 fi