Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1701600 > unrolled thread
| Started by | Akinobu Mita <akinobu.mita@gmail.com> |
|---|---|
| First post | 2017-08-02 02:30 +0200 |
| Last post | 2017-08-02 06:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] fault-inject: fix wrong should_fail() decision in task context Akinobu Mita <akinobu.mita@gmail.com> - 2017-08-02 02:30 +0200
Re: [PATCH] fault-inject: fix wrong should_fail() decision in task context Lu Fengqi <lufq.fnst@cn.fujitsu.com> - 2017-08-02 06:20 +0200
| From | Akinobu Mita <akinobu.mita@gmail.com> |
|---|---|
| Date | 2017-08-02 02:30 +0200 |
| Subject | [PATCH] fault-inject: fix wrong should_fail() decision in task context |
| Message-ID | <u9PHX-2zV-1@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Lu Fengqi <lufq.fnst@cn.fujitsu.com> |
|---|---|
| Date | 2017-08-02 06:20 +0200 |
| Subject | Re: [PATCH] fault-inject: fix wrong should_fail() decision in task context |
| Message-ID | <u9Tix-4ZC-1@gated-at.bofh.it> |
| In reply to | #1701600 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web