summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/debug.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-20 17:06:17 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-13 19:23:54 +0300
commit1a29af8bd740b2720caeafbffece1c0be6a9d06d (patch)
treeab0e9e7c327b20afbcbbc3ccf4063e8cd54a41a2 /fs/ubifs/debug.c
parent14ffd5d0b051b0b937df0cf3580a92f428ff70b1 (diff)
downloadop-kernel-dev-1a29af8bd740b2720caeafbffece1c0be6a9d06d.zip
op-kernel-dev-1a29af8bd740b2720caeafbffece1c0be6a9d06d.tar.gz
UBIFS: use EROFS when emulating failures
When the debugging failure emulation is enabled and UBIFS decides to emulate an I/O error, it uses EIO error code. In which case UBIFS switches into R/O mode later on. The for the user-space is that when a failure is emulated, the file-system sometimes returns EIO and sometimes EROFS. This makes it more difficult to implement user-space tests for the failure mode. Let's be consistent and return EROFS in all the cases. This patch is an improvement for the debugging code and does not affect the functionality at all. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/debug.c')
-rw-r--r--fs/ubifs/debug.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 06d171c..ba4d795 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -2650,7 +2650,7 @@ int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
int len, int check)
{
if (in_failure_mode(desc))
- return -EIO;
+ return -EROFS;
return ubi_leb_read(desc, lnum, buf, offset, len, check);
}
@@ -2660,7 +2660,7 @@ int dbg_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
int err, failing;
if (in_failure_mode(desc))
- return -EIO;
+ return -EROFS;
failing = do_fail(desc, lnum, 1);
if (failing)
cut_data(buf, len);
@@ -2668,7 +2668,7 @@ int dbg_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
if (err)
return err;
if (failing)
- return -EIO;
+ return -EROFS;
return 0;
}
@@ -2678,12 +2678,12 @@ int dbg_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
int err;
if (do_fail(desc, lnum, 1))
- return -EIO;
+ return -EROFS;
err = ubi_leb_change(desc, lnum, buf, len, dtype);
if (err)
return err;
if (do_fail(desc, lnum, 1))
- return -EIO;
+ return -EROFS;
return 0;
}
@@ -2692,12 +2692,12 @@ int dbg_leb_erase(struct ubi_volume_desc *desc, int lnum)
int err;
if (do_fail(desc, lnum, 0))
- return -EIO;
+ return -EROFS;
err = ubi_leb_erase(desc, lnum);
if (err)
return err;
if (do_fail(desc, lnum, 0))
- return -EIO;
+ return -EROFS;
return 0;
}
@@ -2706,19 +2706,19 @@ int dbg_leb_unmap(struct ubi_volume_desc *desc, int lnum)
int err;
if (do_fail(desc, lnum, 0))
- return -EIO;
+ return -EROFS;
err = ubi_leb_unmap(desc, lnum);
if (err)
return err;
if (do_fail(desc, lnum, 0))
- return -EIO;
+ return -EROFS;
return 0;
}
int dbg_is_mapped(struct ubi_volume_desc *desc, int lnum)
{
if (in_failure_mode(desc))
- return -EIO;
+ return -EROFS;
return ubi_is_mapped(desc, lnum);
}
@@ -2727,12 +2727,12 @@ int dbg_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype)
int err;
if (do_fail(desc, lnum, 0))
- return -EIO;
+ return -EROFS;
err = ubi_leb_map(desc, lnum, dtype);
if (err)
return err;
if (do_fail(desc, lnum, 0))
- return -EIO;
+ return -EROFS;
return 0;
}
OpenPOWER on IntegriCloud