提交 16dfd804 编写于 作者: A Adrian Hunter 提交者: Artem Bityutskiy

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: NAdrian Hunter <ext-adrian.hunter@nokia.com>
上级 1e0f358e
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册