diff options
Diffstat (limited to 'lib/fault-inject.c')
-rw-r--r-- | lib/fault-inject.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c index 7d315fdb9f13..cf7b129b0b2b 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) | |||
110 | if (in_task()) { | 110 | if (in_task()) { |
111 | unsigned int fail_nth = READ_ONCE(current->fail_nth); | 111 | unsigned int fail_nth = READ_ONCE(current->fail_nth); |
112 | 112 | ||
113 | if (fail_nth && !WRITE_ONCE(current->fail_nth, fail_nth - 1)) | 113 | if (fail_nth) { |
114 | goto fail; | 114 | if (!WRITE_ONCE(current->fail_nth, fail_nth - 1)) |
115 | goto fail; | ||
115 | 116 | ||
116 | return false; | 117 | return false; |
118 | } | ||
117 | } | 119 | } |
118 | 120 | ||
119 | /* No need to check any other properties if the probability is 0 */ | 121 | /* No need to check any other properties if the probability is 0 */ |