public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandan.babu@oracle.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: fstests@vger.kernel.org, zlang@kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: Check if a direct write can result in a false ENOSPC error
Date: Wed, 24 Aug 2022 14:52:20 +0530	[thread overview]
Message-ID: <87pmgqdmgh.fsf@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <YwTkDrlpzPc2TXDC@magnolia>

On Tue, Aug 23, 2022 at 07:28:30 AM -0700, Darrick J. Wong wrote:
> On Tue, Aug 23, 2022 at 02:34:33PM +0530, Chandan Babu R wrote:
>> This commit adds a test to check if a direct write on a delalloc extent
>> present in CoW fork can result in a false ENOSPC error. The bug has been fixed
>> by upstream commit d62113303d691 ("xfs: Fix false ENOSPC when performing
>> direct write on a delalloc extent in cow fork").
>> 
>> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
>> ---
>>  tests/xfs/553     | 63 +++++++++++++++++++++++++++++++++++++++++++++++
>>  tests/xfs/553.out |  9 +++++++
>>  2 files changed, 72 insertions(+)
>>  create mode 100755 tests/xfs/553
>>  create mode 100644 tests/xfs/553.out
>> 
>> diff --git a/tests/xfs/553 b/tests/xfs/553
>> new file mode 100755
>> index 00000000..78ed0995
>> --- /dev/null
>> +++ b/tests/xfs/553
>> @@ -0,0 +1,63 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2022 Oracle.  All Rights Reserved.
>> +#
>> +# FS QA Test 553
>> +#
>> +# Test to check if a direct write on a delalloc extent present in CoW fork can
>> +# result in an ENOSPC error.
>> +#
>> +. ./common/preamble
>> +_begin_fstest auto quick clone
>> +
>> +# Import common functions.
>> +. ./common/reflink
>> +. ./common/inject
>> +
>> +# real QA test starts here
>> +_supported_fs xfs
>> +_fixed_by_kernel_commit d62113303d691 \
>> +	"xfs: Fix false ENOSPC when performing direct write on a delalloc extent in cow fork"
>> +_require_scratch_reflink
>> +_require_xfs_debug
>> +_require_test_program "punch-alternating"
>> +_require_xfs_io_error_injection "bmap_alloc_minlen_extent"
>> +_require_xfs_io_command "reflink"
>> +_require_xfs_io_command "cowextsize"
>> +
>> +source=${SCRATCH_MNT}/source
>> +destination=${SCRATCH_MNT}/destination
>> +fragmented_file=${SCRATCH_MNT}/fragmented_file
>> +
>> +echo "Format and mount fs"
>> +_scratch_mkfs >> $seqres.full
>> +_scratch_mount >> $seqres.full
>> +
>> +echo "Create source file"
>> +$XFS_IO_PROG -f -c "pwrite 0 32M" $source >> $seqres.full
>> +
>> +echo "Reflink destination file with source file"
>> +$XFS_IO_PROG -f -c "reflink $source" $destination >> $seqres.full
>> +
>> +echo "Set destination file's cowextsize"
>> +$XFS_IO_PROG -c "cowextsize 16M" $destination >> $seqres.full
>> +
>> +echo "Fragment FS"
>> +$XFS_IO_PROG -f -c "pwrite 0 64M" $fragmented_file >> $seqres.full
>> +sync
>> +$here/src/punch-alternating $fragmented_file >> $seqres.full
>> +
>> +echo "Inject bmap_alloc_minlen_extent error tag"
>> +_scratch_inject_error bmap_alloc_minlen_extent 1
>> +
>> +echo "Create 16MiB delalloc extent in destination file's CoW fork"
>> +$XFS_IO_PROG -c "pwrite 0 4k" $destination >> $seqres.full
>> +
>> +sync
>> +
>> +echo "Direct I/O write at 12k file offset in destination file"
>> +$XFS_IO_PROG -d -c "pwrite 12k 8k" $destination >> $seqres.full
>
> Does this still work if the blocksize is 64k? ;)
>

Thanks for pointing that out. I will convert the script to use file blocks as
units rather than bytes.

-- 
chandan

      reply	other threads:[~2022-08-24  9:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23  9:04 [PATCH] xfs: Check if a direct write can result in a false ENOSPC error Chandan Babu R
2022-08-23 14:28 ` Darrick J. Wong
2022-08-24  9:22   ` Chandan Babu R [this message]

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=87pmgqdmgh.fsf@debian-BULLSEYE-live-builder-AMD64 \
    --to=chandan.babu@oracle.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@kernel.org \
    /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