提交 50cb4373 编写于 作者: B Baokun Li 提交者: Richard Weinberger

ubifs: read-only if LEB may always be taken in ubifs_garbage_collect

If ubifs_garbage_collect_leb() returns -EAGAIN and ubifs_return_leb
returns error, a LEB will always has a "taken" flag. In this case,
set the ubifs to read-only to prevent a worse situation.
Signed-off-by: NBaokun Li <libaokun1@huawei.com>
Signed-off-by: NRichard Weinberger <richard@nod.at>
上级 0d765021
......@@ -756,8 +756,17 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway)
* caller instead of the original '-EAGAIN'.
*/
err = ubifs_return_leb(c, lp.lnum);
if (err)
if (err) {
ret = err;
/*
* An LEB may always be "taken",
* so setting ubifs to read-only,
* and then executing sync wbuf will
* return -EROFS and enter the "out"
* error branch.
*/
ubifs_ro_mode(c, ret);
}
/* Maybe double return LEB if goto out */
lp.lnum = -1;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册