OSDN Git Service

UBI: Fix livelock in produce_free_peb()
authorRichard Weinberger <richard@nod.at>
Fri, 19 Sep 2014 15:37:56 +0000 (17:37 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 24 Sep 2014 12:36:16 +0000 (15:36 +0300)
commitb91671bb23a79c32a23b0ad5d6e6ad292bb21bdf
treebb544e7b059228789411b4a601ad6e2157a38e08
parent7fbbd05799976c0611dcb229649260504b2bdef5
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: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/ubi/wl.c