* Re: [PATCH v5] ext4: Regression test of ext4_lblk_t overflow
2023-11-24 11:53 [PATCH v5] ext4: Regression test of ext4_lblk_t overflow Baokun Li
@ 2023-11-25 0:37 ` Darrick J. Wong
2023-11-29 5:38 ` Darrick J. Wong
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2023-11-25 0:37 UTC (permalink / raw)
To: Baokun Li; +Cc: fstests, zlang, guaneryu, amir73il, ritesh.list, yangerkun
On Fri, Nov 24, 2023 at 07:53:56PM +0800, Baokun Li wrote:
> Append writes to a file with logical block numbers close to 0xffffffff and
> observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
Looks fine to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> V1->V2:
> Changes to make the use case more generic, not just for testing
> ext4.(ext4 and xfs have been tested)
> V2->V3:
> Clean up the code and remove hardcoding.
> V3->V4:
> Correct the description and modify finsert related code to
> make the test case easier to understand.
> V4->V5:
> Modify the image size to 80M.
> Modify the space reserved in the file to 2M.
> Now the test case can trigger the original problem at ext4
> 1k,4k,64k block size.
>
> tests/generic/737 | 54 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/737.out | 2 ++
> 2 files changed, 56 insertions(+)
> create mode 100755 tests/generic/737
> create mode 100644 tests/generic/737.out
>
> diff --git a/tests/generic/737 b/tests/generic/737
> new file mode 100755
> index 00000000..b4bf33e4
> --- /dev/null
> +++ b/tests/generic/737
> @@ -0,0 +1,54 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 HUAWEI. All Rights Reserved.
> +#
> +# FS QA Test No. 737
> +#
> +# Append writes to a file with logical block numbers close to 0xffffffff
> +# and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> +# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> +# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> +#
> +. ./common/preamble
> +. ./common/populate
> +_begin_fstest auto quick insert prealloc
> +
> +# real QA test starts here
> +[[ "$FSTYP" =~ ext* ]] && _fixed_by_kernel_commit bc056e7163ac \
> + "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +
> +_require_odirect
> +_require_xfs_io_command "falloc"
> +_require_xfs_io_command "finsert"
> +
> +dev_size=$((80 * 1024 * 1024))
> +_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
> +
> +_scratch_mount
> +file_blksz="$(_get_file_block_size ${SCRATCH_MNT})"
> +
> +# Reserve 1M space
> +$XFS_IO_PROG -f -c "falloc 0 1M" "${SCRATCH_MNT}/tmp" >> $seqres.full
> +
> +# Create a file with logical block numbers close to 0xffffffff
> +$XFS_IO_PROG -f -c "falloc 0 10M" "${SCRATCH_MNT}/file" >> $seqres.full
> +max_pos=$(( 0xffffffff * file_blksz ))
> +finsert_len=$(( max_pos - ((10 + 2) << 20) ))
> +$XFS_IO_PROG -f -c "finsert 1M ${finsert_len}" "${SCRATCH_MNT}/file" >> $seqres.full
> +
> +# Filling up the free space ensures that the pre-allocated space is the reserved space.
> +nr_free=$(stat -f -c '%f' ${SCRATCH_MNT})
> +_fill_fs $((nr_free * file_blksz)) ${SCRATCH_MNT}/fill $file_blksz 0 >> $seqres.full 2>&1
> +sync
> +
> +# Remove reserved space to gain free space for allocation
> +rm -f ${SCRATCH_MNT}/tmp
> +
> +# Trying to allocate two blocks triggers BUG_ON.
> +$XFS_IO_PROG -c "open -ad ${SCRATCH_MNT}/file" -c "pwrite -S 0xff 0 $((2 * file_blksz))" >> $seqres.full
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/737.out b/tests/generic/737.out
> new file mode 100644
> index 00000000..67b83d78
> --- /dev/null
> +++ b/tests/generic/737.out
> @@ -0,0 +1,2 @@
> +QA output created by 737
> +Silence is golden
> --
> 2.31.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v5] ext4: Regression test of ext4_lblk_t overflow
2023-11-24 11:53 [PATCH v5] ext4: Regression test of ext4_lblk_t overflow Baokun Li
2023-11-25 0:37 ` Darrick J. Wong
@ 2023-11-29 5:38 ` Darrick J. Wong
2023-12-04 14:12 ` Zorro Lang
2023-12-09 5:49 ` Zorro Lang
3 siblings, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2023-11-29 5:38 UTC (permalink / raw)
To: Baokun Li; +Cc: fstests, zlang, guaneryu, amir73il, ritesh.list, yangerkun
On Fri, Nov 24, 2023 at 07:53:56PM +0800, Baokun Li wrote:
> Append writes to a file with logical block numbers close to 0xffffffff and
> observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
Looks good to me now,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> V1->V2:
> Changes to make the use case more generic, not just for testing
> ext4.(ext4 and xfs have been tested)
> V2->V3:
> Clean up the code and remove hardcoding.
> V3->V4:
> Correct the description and modify finsert related code to
> make the test case easier to understand.
> V4->V5:
> Modify the image size to 80M.
> Modify the space reserved in the file to 2M.
> Now the test case can trigger the original problem at ext4
> 1k,4k,64k block size.
>
> tests/generic/737 | 54 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/737.out | 2 ++
> 2 files changed, 56 insertions(+)
> create mode 100755 tests/generic/737
> create mode 100644 tests/generic/737.out
>
> diff --git a/tests/generic/737 b/tests/generic/737
> new file mode 100755
> index 00000000..b4bf33e4
> --- /dev/null
> +++ b/tests/generic/737
> @@ -0,0 +1,54 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 HUAWEI. All Rights Reserved.
> +#
> +# FS QA Test No. 737
> +#
> +# Append writes to a file with logical block numbers close to 0xffffffff
> +# and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> +# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> +# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> +#
> +. ./common/preamble
> +. ./common/populate
> +_begin_fstest auto quick insert prealloc
> +
> +# real QA test starts here
> +[[ "$FSTYP" =~ ext* ]] && _fixed_by_kernel_commit bc056e7163ac \
> + "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +
> +_require_odirect
> +_require_xfs_io_command "falloc"
> +_require_xfs_io_command "finsert"
> +
> +dev_size=$((80 * 1024 * 1024))
> +_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
> +
> +_scratch_mount
> +file_blksz="$(_get_file_block_size ${SCRATCH_MNT})"
> +
> +# Reserve 1M space
> +$XFS_IO_PROG -f -c "falloc 0 1M" "${SCRATCH_MNT}/tmp" >> $seqres.full
> +
> +# Create a file with logical block numbers close to 0xffffffff
> +$XFS_IO_PROG -f -c "falloc 0 10M" "${SCRATCH_MNT}/file" >> $seqres.full
> +max_pos=$(( 0xffffffff * file_blksz ))
> +finsert_len=$(( max_pos - ((10 + 2) << 20) ))
> +$XFS_IO_PROG -f -c "finsert 1M ${finsert_len}" "${SCRATCH_MNT}/file" >> $seqres.full
> +
> +# Filling up the free space ensures that the pre-allocated space is the reserved space.
> +nr_free=$(stat -f -c '%f' ${SCRATCH_MNT})
> +_fill_fs $((nr_free * file_blksz)) ${SCRATCH_MNT}/fill $file_blksz 0 >> $seqres.full 2>&1
> +sync
> +
> +# Remove reserved space to gain free space for allocation
> +rm -f ${SCRATCH_MNT}/tmp
> +
> +# Trying to allocate two blocks triggers BUG_ON.
> +$XFS_IO_PROG -c "open -ad ${SCRATCH_MNT}/file" -c "pwrite -S 0xff 0 $((2 * file_blksz))" >> $seqres.full
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/737.out b/tests/generic/737.out
> new file mode 100644
> index 00000000..67b83d78
> --- /dev/null
> +++ b/tests/generic/737.out
> @@ -0,0 +1,2 @@
> +QA output created by 737
> +Silence is golden
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v5] ext4: Regression test of ext4_lblk_t overflow
2023-11-24 11:53 [PATCH v5] ext4: Regression test of ext4_lblk_t overflow Baokun Li
2023-11-25 0:37 ` Darrick J. Wong
2023-11-29 5:38 ` Darrick J. Wong
@ 2023-12-04 14:12 ` Zorro Lang
2023-12-09 5:49 ` Zorro Lang
3 siblings, 0 replies; 6+ messages in thread
From: Zorro Lang @ 2023-12-04 14:12 UTC (permalink / raw)
To: Baokun Li; +Cc: fstests, guaneryu, amir73il, ritesh.list, djwong, yangerkun
On Fri, Nov 24, 2023 at 07:53:56PM +0800, Baokun Li wrote:
> Append writes to a file with logical block numbers close to 0xffffffff and
> observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
> V1->V2:
> Changes to make the use case more generic, not just for testing
> ext4.(ext4 and xfs have been tested)
> V2->V3:
> Clean up the code and remove hardcoding.
> V3->V4:
> Correct the description and modify finsert related code to
> make the test case easier to understand.
> V4->V5:
> Modify the image size to 80M.
> Modify the space reserved in the file to 2M.
> Now the test case can trigger the original problem at ext4
> 1k,4k,64k block size.
Thanks for making this case to be generic, this version looks good to me now,
Reviewed-by: Zorro Lang <zlang@redhat.com>
>
> tests/generic/737 | 54 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/737.out | 2 ++
> 2 files changed, 56 insertions(+)
> create mode 100755 tests/generic/737
> create mode 100644 tests/generic/737.out
>
> diff --git a/tests/generic/737 b/tests/generic/737
> new file mode 100755
> index 00000000..b4bf33e4
> --- /dev/null
> +++ b/tests/generic/737
> @@ -0,0 +1,54 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 HUAWEI. All Rights Reserved.
> +#
> +# FS QA Test No. 737
> +#
> +# Append writes to a file with logical block numbers close to 0xffffffff
> +# and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> +# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> +# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> +#
> +. ./common/preamble
> +. ./common/populate
> +_begin_fstest auto quick insert prealloc
> +
> +# real QA test starts here
> +[[ "$FSTYP" =~ ext* ]] && _fixed_by_kernel_commit bc056e7163ac \
> + "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +
> +_require_odirect
> +_require_xfs_io_command "falloc"
> +_require_xfs_io_command "finsert"
> +
> +dev_size=$((80 * 1024 * 1024))
> +_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
> +
> +_scratch_mount
> +file_blksz="$(_get_file_block_size ${SCRATCH_MNT})"
> +
> +# Reserve 1M space
> +$XFS_IO_PROG -f -c "falloc 0 1M" "${SCRATCH_MNT}/tmp" >> $seqres.full
> +
> +# Create a file with logical block numbers close to 0xffffffff
> +$XFS_IO_PROG -f -c "falloc 0 10M" "${SCRATCH_MNT}/file" >> $seqres.full
> +max_pos=$(( 0xffffffff * file_blksz ))
> +finsert_len=$(( max_pos - ((10 + 2) << 20) ))
> +$XFS_IO_PROG -f -c "finsert 1M ${finsert_len}" "${SCRATCH_MNT}/file" >> $seqres.full
> +
> +# Filling up the free space ensures that the pre-allocated space is the reserved space.
> +nr_free=$(stat -f -c '%f' ${SCRATCH_MNT})
> +_fill_fs $((nr_free * file_blksz)) ${SCRATCH_MNT}/fill $file_blksz 0 >> $seqres.full 2>&1
> +sync
> +
> +# Remove reserved space to gain free space for allocation
> +rm -f ${SCRATCH_MNT}/tmp
> +
> +# Trying to allocate two blocks triggers BUG_ON.
> +$XFS_IO_PROG -c "open -ad ${SCRATCH_MNT}/file" -c "pwrite -S 0xff 0 $((2 * file_blksz))" >> $seqres.full
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/737.out b/tests/generic/737.out
> new file mode 100644
> index 00000000..67b83d78
> --- /dev/null
> +++ b/tests/generic/737.out
> @@ -0,0 +1,2 @@
> +QA output created by 737
> +Silence is golden
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v5] ext4: Regression test of ext4_lblk_t overflow
2023-11-24 11:53 [PATCH v5] ext4: Regression test of ext4_lblk_t overflow Baokun Li
` (2 preceding siblings ...)
2023-12-04 14:12 ` Zorro Lang
@ 2023-12-09 5:49 ` Zorro Lang
2023-12-09 6:06 ` Baokun Li
3 siblings, 1 reply; 6+ messages in thread
From: Zorro Lang @ 2023-12-09 5:49 UTC (permalink / raw)
To: Baokun Li; +Cc: fstests, guaneryu, amir73il, ritesh.list, djwong, yangerkun
On Fri, Nov 24, 2023 at 07:53:56PM +0800, Baokun Li wrote:
> Append writes to a file with logical block numbers close to 0xffffffff and
> observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
> V1->V2:
> Changes to make the use case more generic, not just for testing
> ext4.(ext4 and xfs have been tested)
> V2->V3:
> Clean up the code and remove hardcoding.
> V3->V4:
> Correct the description and modify finsert related code to
> make the test case easier to understand.
> V4->V5:
> Modify the image size to 80M.
> Modify the space reserved in the file to 2M.
> Now the test case can trigger the original problem at ext4
> 1k,4k,64k block size.
>
> tests/generic/737 | 54 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/737.out | 2 ++
> 2 files changed, 56 insertions(+)
> create mode 100755 tests/generic/737
> create mode 100644 tests/generic/737.out
>
> diff --git a/tests/generic/737 b/tests/generic/737
> new file mode 100755
> index 00000000..b4bf33e4
> --- /dev/null
> +++ b/tests/generic/737
> @@ -0,0 +1,54 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 HUAWEI. All Rights Reserved.
> +#
> +# FS QA Test No. 737
> +#
> +# Append writes to a file with logical block numbers close to 0xffffffff
> +# and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> +# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> +# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> +#
> +. ./common/preamble
> +. ./common/populate
> +_begin_fstest auto quick insert prealloc
> +
> +# real QA test starts here
> +[[ "$FSTYP" =~ ext* ]] && _fixed_by_kernel_commit bc056e7163ac \
I just noticed this regex, I think the "ext*" matches "ex", "ext", "extxxx". So
if FSTYP=exfat, then it will matchi the "ext*".
It's better to be "ext.*" or "ext.+" or "ext[0-9]+". I'll change it when I
merge it.
> + "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +
> +_require_odirect
> +_require_xfs_io_command "falloc"
> +_require_xfs_io_command "finsert"
> +
> +dev_size=$((80 * 1024 * 1024))
> +_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
> +
> +_scratch_mount
> +file_blksz="$(_get_file_block_size ${SCRATCH_MNT})"
> +
> +# Reserve 1M space
> +$XFS_IO_PROG -f -c "falloc 0 1M" "${SCRATCH_MNT}/tmp" >> $seqres.full
> +
> +# Create a file with logical block numbers close to 0xffffffff
> +$XFS_IO_PROG -f -c "falloc 0 10M" "${SCRATCH_MNT}/file" >> $seqres.full
> +max_pos=$(( 0xffffffff * file_blksz ))
> +finsert_len=$(( max_pos - ((10 + 2) << 20) ))
> +$XFS_IO_PROG -f -c "finsert 1M ${finsert_len}" "${SCRATCH_MNT}/file" >> $seqres.full
> +
> +# Filling up the free space ensures that the pre-allocated space is the reserved space.
> +nr_free=$(stat -f -c '%f' ${SCRATCH_MNT})
> +_fill_fs $((nr_free * file_blksz)) ${SCRATCH_MNT}/fill $file_blksz 0 >> $seqres.full 2>&1
> +sync
> +
> +# Remove reserved space to gain free space for allocation
> +rm -f ${SCRATCH_MNT}/tmp
> +
> +# Trying to allocate two blocks triggers BUG_ON.
> +$XFS_IO_PROG -c "open -ad ${SCRATCH_MNT}/file" -c "pwrite -S 0xff 0 $((2 * file_blksz))" >> $seqres.full
> +
> +echo "Silence is golden"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/737.out b/tests/generic/737.out
> new file mode 100644
> index 00000000..67b83d78
> --- /dev/null
> +++ b/tests/generic/737.out
> @@ -0,0 +1,2 @@
> +QA output created by 737
> +Silence is golden
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v5] ext4: Regression test of ext4_lblk_t overflow
2023-12-09 5:49 ` Zorro Lang
@ 2023-12-09 6:06 ` Baokun Li
0 siblings, 0 replies; 6+ messages in thread
From: Baokun Li @ 2023-12-09 6:06 UTC (permalink / raw)
To: Zorro Lang
Cc: fstests, guaneryu, amir73il, ritesh.list, djwong, yangerkun,
Baokun Li
On 2023/12/9 13:49, Zorro Lang wrote:
> On Fri, Nov 24, 2023 at 07:53:56PM +0800, Baokun Li wrote:
>> Append writes to a file with logical block numbers close to 0xffffffff and
>> observe if a kernel crash is caused by ext4_lblk_t overflow triggering
>> BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
>> bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
>>
>> Signed-off-by: Baokun Li <libaokun1@huawei.com>
>> ---
>> V1->V2:
>> Changes to make the use case more generic, not just for testing
>> ext4.(ext4 and xfs have been tested)
>> V2->V3:
>> Clean up the code and remove hardcoding.
>> V3->V4:
>> Correct the description and modify finsert related code to
>> make the test case easier to understand.
>> V4->V5:
>> Modify the image size to 80M.
>> Modify the space reserved in the file to 2M.
>> Now the test case can trigger the original problem at ext4
>> 1k,4k,64k block size.
>>
>> tests/generic/737 | 54 +++++++++++++++++++++++++++++++++++++++++++
>> tests/generic/737.out | 2 ++
>> 2 files changed, 56 insertions(+)
>> create mode 100755 tests/generic/737
>> create mode 100644 tests/generic/737.out
>>
>> diff --git a/tests/generic/737 b/tests/generic/737
>> new file mode 100755
>> index 00000000..b4bf33e4
>> --- /dev/null
>> +++ b/tests/generic/737
>> @@ -0,0 +1,54 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2023 HUAWEI. All Rights Reserved.
>> +#
>> +# FS QA Test No. 737
>> +#
>> +# Append writes to a file with logical block numbers close to 0xffffffff
>> +# and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
>> +# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
>> +# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
>> +#
>> +. ./common/preamble
>> +. ./common/populate
>> +_begin_fstest auto quick insert prealloc
>> +
>> +# real QA test starts here
>> +[[ "$FSTYP" =~ ext* ]] && _fixed_by_kernel_commit bc056e7163ac \
> I just noticed this regex, I think the "ext*" matches "ex", "ext", "extxxx". So
> if FSTYP=exfat, then it will matchi the "ext*".
>
> It's better to be "ext.*" or "ext.+" or "ext[0-9]+". I'll change it when I
> merge it.
Okay. Thanks a lot!
>> + "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
>> +
>> +_require_odirect
>> +_require_xfs_io_command "falloc"
>> +_require_xfs_io_command "finsert"
>> +
>> +dev_size=$((80 * 1024 * 1024))
>> +_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
>> +
>> +_scratch_mount
>> +file_blksz="$(_get_file_block_size ${SCRATCH_MNT})"
>> +
>> +# Reserve 1M space
>> +$XFS_IO_PROG -f -c "falloc 0 1M" "${SCRATCH_MNT}/tmp" >> $seqres.full
>> +
>> +# Create a file with logical block numbers close to 0xffffffff
>> +$XFS_IO_PROG -f -c "falloc 0 10M" "${SCRATCH_MNT}/file" >> $seqres.full
>> +max_pos=$(( 0xffffffff * file_blksz ))
>> +finsert_len=$(( max_pos - ((10 + 2) << 20) ))
>> +$XFS_IO_PROG -f -c "finsert 1M ${finsert_len}" "${SCRATCH_MNT}/file" >> $seqres.full
>> +
>> +# Filling up the free space ensures that the pre-allocated space is the reserved space.
>> +nr_free=$(stat -f -c '%f' ${SCRATCH_MNT})
>> +_fill_fs $((nr_free * file_blksz)) ${SCRATCH_MNT}/fill $file_blksz 0 >> $seqres.full 2>&1
>> +sync
>> +
>> +# Remove reserved space to gain free space for allocation
>> +rm -f ${SCRATCH_MNT}/tmp
>> +
>> +# Trying to allocate two blocks triggers BUG_ON.
>> +$XFS_IO_PROG -c "open -ad ${SCRATCH_MNT}/file" -c "pwrite -S 0xff 0 $((2 * file_blksz))" >> $seqres.full
>> +
>> +echo "Silence is golden"
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/generic/737.out b/tests/generic/737.out
>> new file mode 100644
>> index 00000000..67b83d78
>> --- /dev/null
>> +++ b/tests/generic/737.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 737
>> +Silence is golden
>> --
>> 2.31.1
>>
^ permalink raw reply [flat|nested] 6+ messages in thread