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>
This commit is contained in:
Adrian Hunter 2008-07-18 16:47:41 +03:00 коммит произвёл Artem Bityutskiy
Родитель 1e0f358e29
Коммит 16dfd804b4
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -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;
}