Skip to content

Commit 70dcc53

Browse files
committed
Merge tag 'upstream-3.7-rc9' of git://git.infradead.org/linux-ubi
Pull UBI changes from Artem Bityutskiy: "Fixes for 2 brown-paperbag bugs introduced this merge window by the fastmap code: 1. The UBI background thread got stuck when a bit-flip happened because free LEBs was not removed from the "free" tree when we started using it. 2. I/O debugging checks did not work because we called a sleeping function in atomic context." * tag 'upstream-3.7-rc9' of git://git.infradead.org/linux-ubi: UBI: dont call ubi_self_check_all_ff() in __wl_get_peb() UBI: remove PEB from free tree in get_peb_for_wl()
2 parents ca50496 + 894aef2 commit 70dcc53

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

drivers/mtd/ubi/wl.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ struct ubi_wl_entry *ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor)
498498
* @ubi: UBI device description object
499499
*
500500
* This function returns a physical eraseblock in case of success and a
501-
* negative error code in case of failure. Might sleep.
501+
* negative error code in case of failure.
502502
*/
503503
static int __wl_get_peb(struct ubi_device *ubi)
504504
{
@@ -540,13 +540,6 @@ static int __wl_get_peb(struct ubi_device *ubi)
540540
* ubi_wl_get_peb() after removing e from the pool. */
541541
prot_queue_add(ubi, e);
542542
#endif
543-
err = ubi_self_check_all_ff(ubi, e->pnum, ubi->vid_hdr_aloffset,
544-
ubi->peb_size - ubi->vid_hdr_aloffset);
545-
if (err) {
546-
ubi_err("new PEB %d does not contain all 0xFF bytes", e->pnum);
547-
return err;
548-
}
549-
550543
return e->pnum;
551544
}
552545

@@ -679,17 +672,30 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi)
679672
#else
680673
static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi)
681674
{
682-
return find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF);
675+
struct ubi_wl_entry *e;
676+
677+
e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF);
678+
self_check_in_wl_tree(ubi, e, &ubi->free);
679+
rb_erase(&e->u.rb, &ubi->free);
680+
681+
return e;
683682
}
684683

685684
int ubi_wl_get_peb(struct ubi_device *ubi)
686685
{
687-
int peb;
686+
int peb, err;
688687

689688
spin_lock(&ubi->wl_lock);
690689
peb = __wl_get_peb(ubi);
691690
spin_unlock(&ubi->wl_lock);
692691

692+
err = ubi_self_check_all_ff(ubi, peb, ubi->vid_hdr_aloffset,
693+
ubi->peb_size - ubi->vid_hdr_aloffset);
694+
if (err) {
695+
ubi_err("new PEB %d does not contain all 0xFF bytes", peb);
696+
return err;
697+
}
698+
693699
return peb;
694700
}
695701
#endif

0 commit comments

Comments
 (0)