]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
UBIFS: fix error return in failure mode
authorAdrian Hunter <ext-adrian.hunter@nokia.com>
Fri, 18 Jul 2008 13:47:41 +0000 (16:47 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 13 Aug 2008 08:22:41 +0000 (11:22 +0300)
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>
fs/ubifs/debug.c

index 4e3aaeba4eca835c0afaac2cfc384edf1428d53f..0adfb29b8503efdd5df637e7c637200eb55163d9 100644 (file)
@@ -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;
 }