Received: from mout.gmx.net ([212.227.17.21]:41643 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbfEHKoy (ORCPT ); Wed, 8 May 2019 06:44:54 -0400 Subject: Re: [PATCH v2] fstests: generic: Test if we can still do operations which don't take extra data space on a fs without data space References: <20190508094504.15474-1-wqu@suse.com> From: Qu Wenruo Message-ID: Date: Wed, 8 May 2019 18:44:39 +0800 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AaGLY4zXlIlOjfziuaTu4fbJJu19zGopg" Sender: fstests-owner@vger.kernel.org To: fdmanana@gmail.com, Qu Wenruo Cc: linux-btrfs , fstests List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AaGLY4zXlIlOjfziuaTu4fbJJu19zGopg Content-Type: multipart/mixed; boundary="G5zbZN9FGwnimqRZcIgRHVvbU5SpBEX1M"; protected-headers="v1" From: Qu Wenruo To: fdmanana@gmail.com, Qu Wenruo Cc: linux-btrfs , fstests Message-ID: Subject: Re: [PATCH v2] fstests: generic: Test if we can still do operations which don't take extra data space on a fs without data space References: <20190508094504.15474-1-wqu@suse.com> In-Reply-To: --G5zbZN9FGwnimqRZcIgRHVvbU5SpBEX1M Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2019/5/8 =E4=B8=8B=E5=8D=886:38, Filipe Manana wrote: > On Wed, May 8, 2019 at 11:06 AM Qu Wenruo wrote: >> >> This test will test if we can still do the following operations when a= >> fs has no extra data space: >> - buffered write into unpopulated preallocated extent >> - clone the untouched preallocated extent >> - fsync >> Above operations in a row should not fail, as they takes no extra data= space. >> >> Xfs passes the test, while btrfs fails at fsync. >> >> Signed-off-by: Qu Wenruo >> --- >> changelog: >> v2: >> - Change the comment and commit message to make it describe the test >> itself, not the btrfs specific part. >> - Use $XFS_IO_PROG to replace xfs_io. >> --- >> tests/generic/545 | 70 ++++++++++++++++++++++++++++++++++++++++++= + >> tests/generic/545.out | 2 ++ >> tests/generic/group | 1 + >> 3 files changed, 73 insertions(+) >> create mode 100755 tests/generic/545 >> create mode 100644 tests/generic/545.out >> >> diff --git a/tests/generic/545 b/tests/generic/545 >> new file mode 100755 >> index 00000000..9efaf58c >> --- /dev/null >> +++ b/tests/generic/545 >> @@ -0,0 +1,70 @@ >> +#! /bin/bash >> +# SPDX-License-Identifier: GPL-2.0 >> +# Copyright (C) 2019 SUSE Linux Products GmbH. All Rights Reserved. >> +# >> +# FS QA Test 545 >> +# >> +# Test when a fs is full we can still: >> +# - Do buffered write into a unpopulated preallocated extent >> +# - Clone the untouched part of that preallocated extent >> +# - Fsync >> +# All operations above should not fail. >> +# >> +# Xfs passes the test while btrfs fails. The fix for btrfs is: >> +# "btrfs: Flush before reflinking any extent to prevent NOCOW write f= alling >> +# back to CoW without data reservation" >=20 > Again, this part that says it currently fails on btrfs, passes on xfs > and which patch fixes the problem for btrfs, should be in the > changelog and not on the test description. >=20 >> +# >> +seq=3D`basename $0` >> +seqres=3D$RESULT_DIR/$seq >> +echo "QA output created by $seq" >> + >> +here=3D`pwd` >> +tmp=3D/tmp/$$ >> +status=3D1 # failure is the default! >> +trap "_cleanup; exit \$status" 0 1 2 3 15 >> + >> +_cleanup() >> +{ >> + cd / >> + rm -f $tmp.* >> +} >> + >> +# get standard environment, filters and checks >> +. ./common/rc >> +. ./common/filter >> +. ./common/reflink >> + >> +# remove previous $seqres.full before test >> +rm -f $seqres.full >> + >> +# real QA test starts here >> + >> +# Modify as appropriate. >> +_supported_fs generic >> +_supported_os Linux >> +_require_scratch >=20 > Not needed, because below you do _require_scratch_reflink >=20 >> +_require_scratch_reflink >> + >> +_scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1 >> +_scratch_mount >> + >> +# Create preallocated extent where we can write into >> +$XFS_IO_PROG -f -c 'falloc 8k 64m' "$SCRATCH_MNT/foobar" >> $seqres.f= ull >> + >> +# Use up all data space, to test later write-into-preallocate behavio= r >> +_pwrite_byte 0x00 0 512m "$SCRATCH_MNT/padding" >> $seqres.full 2>&1 >> + >> +# This should not fail >> +_pwrite_byte 0xcd 1m 16m "$SCRATCH_MNT/foobar" >> $seqres.full >> + >> +# Do reflink here, we shouldn't use extra data space, thus it should = not fail >> +$XFS_IO_PROG -c "reflink ${SCRATCH_MNT}/foobar 8k 0 4k" "$SCRATCH_MNT= /foobar" \ >> + >> $seqres.full >> + >> +# Fsync to check if writeback is ok >> +$XFS_IO_PROG -c 'fsync' "$SCRATCH_MNT/foobar" >=20 > It would be more useful to not only check that fsync does not return > an error, but also to check that if a power failure happens, when we > mount the fs again all the data previously written is there. A quick glance into the group shows no enospc test with reflink/clone and log/replay. So it makes sense. Thanks, Qu >=20 > Thanks. >=20 >> + >> +echo "Silence is golden" >> +# success, all done >> +status=3D0 >> +exit >> diff --git a/tests/generic/545.out b/tests/generic/545.out >> new file mode 100644 >> index 00000000..920d7244 >> --- /dev/null >> +++ b/tests/generic/545.out >> @@ -0,0 +1,2 @@ >> +QA output created by 545 >> +Silence is golden >> diff --git a/tests/generic/group b/tests/generic/group >> index 40deb4d0..f26b91fe 100644 >> --- a/tests/generic/group >> +++ b/tests/generic/group >> @@ -547,3 +547,4 @@ >> 542 auto quick clone >> 543 auto quick clone >> 544 auto quick clone >> +545 auto quick clone enospc >> -- >> 2.21.0 >> >=20 >=20 --G5zbZN9FGwnimqRZcIgRHVvbU5SpBEX1M-- --AaGLY4zXlIlOjfziuaTu4fbJJu19zGopg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEELd9y5aWlW6idqkLhwj2R86El/qgFAlzSsxcACgkQwj2R86El /qjcfwf+L5Yst7xzoxqnMNTEeP327ySkjCIMSlLqc2Qmvmpqapi3UWQffh0lc7sB LDEUvNt5SngCnAF2RVPm19REtkoUu1j/fx4W097zEm9fnP1oaahO+SOVQxSGhs0q iEOdL347Fop6ky/WHAeWGozlZqM9dBOP6GgLYjxwUO9kNGcIzCV8R/FpM2Q66J5T s0Y1bHNzIZGhRwwpW+wPjTdG4VguYGQApZD8aCY4Z7n4ustm91CzfqUfaqzi+Ey6 a+TKaRW8RjdwV5ImS7awADhnRx5S0nUdxntkiPsYBs9VeME3Ap6swhevDD0u3yD+ Z+/LhK0NCe262om45BKBDdW9b7ElPw== =++Tq -----END PGP SIGNATURE----- --AaGLY4zXlIlOjfziuaTu4fbJJu19zGopg--