UBIFS: fix error return in failure mode

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, August 15, 2008 - 11:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=16dfd8...
Commit:     16dfd804b44ef7156d1c201f100bd0d9dc6b7c4b
Parent:     1e0f358e29cc91c8eb09e10cbf1f6bb58a62c795
Author:     Adrian Hunter <ext-adrian.hunter@nokia.com>
AuthorDate: Fri Jul 18 16:47:41 2008 +0300
Committer:  Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
CommitDate: Wed Aug 13 11:22:41 2008 +0300

    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>
---
 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 4e3aaeb..0adfb29 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;
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
UBIFS: fix error return in failure mode, Linux Kernel Mailing ..., (Fri Aug 15, 11:59 am)