All of lore.kernel.org
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@gmail.com>
To: Anand Jain <anand.jain@oracle.com>
Cc: fstests <fstests@vger.kernel.org>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs/242: test case to fstrim on a degraded filesystem
Date: Mon, 5 Jul 2021 09:45:47 +0100	[thread overview]
Message-ID: <CAL3q7H6YZa6JLFhHbJB_FScD2wdm3NWEEDsE9C3EwVmoKMMkJQ@mail.gmail.com> (raw)
In-Reply-To: <a70c9f6b4e45d9bcdc5c2f19182f89ef8e22c074.1625237782.git.anand.jain@oracle.com>

On Sun, Jul 4, 2021 at 12:24 PM Anand Jain <anand.jain@oracle.com> wrote:
>
> Create a degraded btrfs filesystem and run fstrim on it.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  tests/btrfs/242     | 49 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/242.out |  2 ++
>  2 files changed, 51 insertions(+)
>  create mode 100755 tests/btrfs/242
>  create mode 100644 tests/btrfs/242.out
>
> diff --git a/tests/btrfs/242 b/tests/btrfs/242
> new file mode 100755
> index 000000000000..e946ee6ac7c2
> --- /dev/null
> +++ b/tests/btrfs/242
> @@ -0,0 +1,49 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (C) 2021 Oracle. All Rights Reserved.
> +#
> +# FS QA Test 242
> +#
> +# Test that fstrim can run on the degraded filesystem
> +#   Kernel requires fix for the null pointer deref in btrfs_trim_fs()
> +#     [patch] btrfs: check for missing device in btrfs_trim_fs
> +
> +
> +. ./common/preamble
> +_begin_fstest auto quick replace trim
> +
> +# Import common functions.
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs btrfs
> +_require_btrfs_forget_or_module_loadable
> +_require_scratch_dev_pool 2
> +#_require_command "$WIPEFS_PROG" wipefs
> +
> +_scratch_dev_pool_get 2
> +dev1=$(echo $SCRATCH_DEV_POOL | $AWK_PROG '{ print $1 }')
> +
> +_scratch_pool_mkfs "-m raid1 -d raid1"
> +_scratch_mount
> +_require_batched_discard $SCRATCH_MNT
> +
> +# Add a test file with some data.
> +$XFS_IO_PROG -f -c "pwrite -S 0xab 0 10M" $SCRATCH_MNT/foo > /dev/null

What's the point of adding this file (which you copied exactly from
btrfs/223) if it's not needed to trigger the bug and it's not used
anywhere in the test?
Or at the very least, check that reading it after the fstrim returns
the correct data, as it might help prevent some regression in the
future.

Thanks.

> +
> +# Unmount the filesystem.
> +_scratch_unmount
> +
> +# Mount the filesystem in degraded mode
> +_btrfs_forget_or_module_reload
> +_mount -o degraded $dev1 $SCRATCH_MNT
> +
> +# Run fstrim
> +$FSTRIM_PROG $SCRATCH_MNT
> +
> +_scratch_dev_pool_put
> +
> +echo Silence is golden
> +
> +status=0
> +exit
> diff --git a/tests/btrfs/242.out b/tests/btrfs/242.out
> new file mode 100644
> index 000000000000..a46d77702f23
> --- /dev/null
> +++ b/tests/btrfs/242.out
> @@ -0,0 +1,2 @@
> +QA output created by 242
> +Silence is golden
> --
> 2.27.0
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

  parent reply	other threads:[~2021-07-05  8:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 11:20 Anand Jain
2021-07-05  0:17 ` Qu Wenruo
2021-07-05  3:41 ` [PATCH v2] " Anand Jain
2021-07-05  8:45 ` Filipe Manana [this message]
2021-07-05 10:20   ` [PATCH] " Anand Jain
2021-07-05  8:50 ` Filipe Manana
2021-07-05 10:04   ` Anand Jain
2021-07-05 10:43 ` [PATCH v3] " Anand Jain
2021-07-05 11:38   ` Filipe Manana
2021-07-05 11:51   ` Qu Wenruo

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=CAL3q7H6YZa6JLFhHbJB_FScD2wdm3NWEEDsE9C3EwVmoKMMkJQ@mail.gmail.com \
    --to=fdmanana@gmail.com \
    --cc=anand.jain@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --subject='Re: [PATCH] btrfs/242: test case to fstrim on a degraded filesystem' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.