diff options
author | Adrian Hunter <ext-adrian.hunter@nokia.com> | 2008-07-18 16:47:41 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-08-13 11:22:41 +0300 |
commit | 16dfd804b44ef7156d1c201f100bd0d9dc6b7c4b (patch) | |
tree | 8286d4c108b93037f0775ca5fbaf09985b5f658b /fs/ubifs/debug.c | |
parent | 1e0f358e29cc91c8eb09e10cbf1f6bb58a62c795 (diff) | |
download | linux-16dfd804b44ef7156d1c201f100bd0d9dc6b7c4b.tar.gz linux-16dfd804b44ef7156d1c201f100bd0d9dc6b7c4b.tar.bz2 linux-16dfd804b44ef7156d1c201f100bd0d9dc6b7c4b.zip |
UBIFS: fix error return in failure mode
UBIFS recovery testing debug facility simulates media failures.
When simulating an IO error, the error code returned must be
-EIO but it was not always if the user switched off the
debug recovery testing option at the same time.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'fs/ubifs/debug.c')
-rw-r--r-- | fs/ubifs/debug.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 4e3aaeba4eca..0adfb29b8503 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -2208,16 +2208,17 @@ int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, int dbg_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, int offset, int len, int dtype) { - int err; + int err, failing; if (in_failure_mode(desc)) return -EIO; - if (do_fail(desc, lnum, 1)) + failing = do_fail(desc, lnum, 1); + if (failing) cut_data(buf, len); err = ubi_leb_write(desc, lnum, buf, offset, len, dtype); if (err) return err; - if (in_failure_mode(desc)) + if (failing) return -EIO; return 0; } |