From: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <akpm@linux-foundation.org>, <linux-kernel@vger.kernel.org>,
Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH] fault-inject: fix wrong should_fail() decision in task context
Date: Wed, 2 Aug 2017 12:15:38 +0800 [thread overview]
Message-ID: <20170802041538.GE3359@fnst> (raw)
In-Reply-To: <1501633700-3488-1-git-send-email-akinobu.mita@gmail.com>
On Wed, Aug 02, 2017 at 09:28:20AM +0900, Akinobu Mita wrote:
>Commit 1203c8e6fb0a ("fault-inject: simplify access check for fail-nth")
>unintentionally broke a conditional statement in should_fail(). Any faults
>are not injected in the task context by the change when the systematic
>fault injection is not used.
>
>This change restores to the previous correct behaviour.
>
>Fixes: 1203c8e6fb0a ("fault-inject: simplify access check for fail-nth")
>Cc: Dmitry Vyukov <dvyukov@google.com>
>Cc: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
>Reported-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
>Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>---
> lib/fault-inject.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/lib/fault-inject.c b/lib/fault-inject.c
>index 7d315fd..cf7b129 100644
>--- a/lib/fault-inject.c
>+++ b/lib/fault-inject.c
>@@ -110,10 +110,12 @@ bool should_fail(struct fault_attr *attr, ssize_t size)
> if (in_task()) {
> unsigned int fail_nth = READ_ONCE(current->fail_nth);
>
>- if (fail_nth && !WRITE_ONCE(current->fail_nth, fail_nth - 1))
>- goto fail;
>+ if (fail_nth) {
>+ if (!WRITE_ONCE(current->fail_nth, fail_nth - 1))
>+ goto fail;
>
>- return false;
>+ return false;
>+ }
> }
>
> /* No need to check any other properties if the probability is 0 */
>--
>2.7.4
>
>
>
With this fix, I can produce the IO ERROR by the fail_make_request.
--
Thanks,
Lu
prev parent reply other threads:[~2017-08-02 4:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 0:28 [PATCH] fault-inject: fix wrong should_fail() decision in task context Akinobu Mita
2017-08-02 4:15 ` Lu Fengqi [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=20170802041538.GE3359@fnst \
--to=lufq.fnst@cn.fujitsu.com \
--cc=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--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