提交 b91671bb 编写于 作者: R Richard Weinberger 提交者: Artem Bityutskiy

UBI: Fix livelock in produce_free_peb()

The while loop in produce_free_peb() assumes that each work will produce a
free PEB. This is not true.
If ubi->works_count is 1 and the only scheduled work is the
wear_leveling_worker() produce_free_peb() can loop forever in case
nobody schedules an erase work.
Fix this issue by checking in the while loop whether work is scheduled.
Signed-off-by: NRichard Weinberger <richard@nod.at>
Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
上级 7fbbd057
...@@ -272,7 +272,7 @@ static int produce_free_peb(struct ubi_device *ubi) ...@@ -272,7 +272,7 @@ static int produce_free_peb(struct ubi_device *ubi)
{ {
int err; int err;
while (!ubi->free.rb_node) { while (!ubi->free.rb_node && ubi->works_count) {
spin_unlock(&ubi->wl_lock); spin_unlock(&ubi->wl_lock);
dbg_wl("do one work synchronously"); dbg_wl("do one work synchronously");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册