From: Matthew Wilcox <willy@infradead.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: jaegeuk@kernel.org, chao@kernel.org, corbet@lwn.net,
linux-f2fs-devel@lists.sourceforge.net,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: support fault injection for flush submission error
Date: Wed, 9 Nov 2022 19:21:25 +0000 [thread overview]
Message-ID: <Y2v9tZEXxSyF0LnZ@casper.infradead.org> (raw)
In-Reply-To: <20221109183549.11012-1-frank.li@vivo.com>
On Thu, Nov 10, 2022 at 02:35:49AM +0800, Yangtao Li wrote:
> +++ b/fs/f2fs/segment.c
> @@ -486,7 +486,17 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg)
> static int __submit_flush_wait(struct f2fs_sb_info *sbi,
> struct block_device *bdev)
> {
> - int ret = blkdev_issue_flush(bdev);
> + int ret;
> +
> + if (time_to_inject(sbi, FAULT_FLUSH)) {
> + f2fs_show_injection_info(sbi, FAULT_FLUSH);
> + ret = -EIO;
> + goto submit;
submit? You don't submit anything at the 'submit' label. it should
be called 'skip' or something. But I think this is just badly written
and you don't need a goto at all.
What I don't understand about this patch is why you want it at all.
What failure are you simulating? It appears to me that you're
simulating a bug in the filesystem, or maybe a bug in the device
firmware. But why do you want to do that?
> + }
> +
> + ret = blkdev_issue_flush(bdev);
> +
> +submit:
>
> trace_f2fs_issue_flush(bdev, test_opt(sbi, NOBARRIER),
> test_opt(sbi, FLUSH_MERGE), ret);
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index a43d8a46a6e5..3d3d22ac527b 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -62,6 +62,7 @@ const char *f2fs_fault_name[FAULT_MAX] = {
> [FAULT_DQUOT_INIT] = "dquot initialize",
> [FAULT_LOCK_OP] = "lock_op",
> [FAULT_BLKADDR] = "invalid blkaddr",
> + [FAULT_FLUSH] = "flush error",
> };
>
> void f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned int rate,
> --
> 2.25.1
>
prev parent reply other threads:[~2022-11-09 19:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 18:35 [PATCH] f2fs: support fault injection for flush submission error Yangtao Li
2022-11-09 19:21 ` Matthew Wilcox [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=Y2v9tZEXxSyF0LnZ@casper.infradead.org \
--to=willy@infradead.org \
--cc=chao@kernel.org \
--cc=corbet@lwn.net \
--cc=frank.li@vivo.com \
--cc=jaegeuk@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.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