Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

UBI: remove PEB from free tree in get_peb_for_wl()

If UBI is built without fastmap, get_peb_for_wl() has to
remove the PEB manially from the free tree.
Otherwise the requested PEB lives in two trees.

Reported-by: Zach Sadecki <zsadecki@itwatchdogs.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

authored by

Richard Weinberger and committed by
Artem Bityutskiy
ed4b7021 9489e9dc

+7 -1
+7 -1
drivers/mtd/ubi/wl.c
··· 679 679 #else 680 680 static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi) 681 681 { 682 - return find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF); 682 + struct ubi_wl_entry *e; 683 + 684 + e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF); 685 + self_check_in_wl_tree(ubi, e, &ubi->free); 686 + rb_erase(&e->u.rb, &ubi->free); 687 + 688 + return e; 683 689 } 684 690 685 691 int ubi_wl_get_peb(struct ubi_device *ubi)