From 89fc0afd9ec302438860532108d83181fe17f8e0 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 9 Oct 2012 16:20:15 +0300 Subject: [PATCH] --- yaml --- r: 335658 b: refs/heads/master c: a28ad42a4a0c6f302f488f26488b8b37c9b30024 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ubifs/find.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 00f2a46e9e26..050ce7fba334 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 98a1eebda3cb2a84ecf1f219bb3a95769033d1bf +refs/heads/master: a28ad42a4a0c6f302f488f26488b8b37c9b30024 diff --git a/trunk/fs/ubifs/find.c b/trunk/fs/ubifs/find.c index 28ec13af28d9..2dcf3d473fec 100644 --- a/trunk/fs/ubifs/find.c +++ b/trunk/fs/ubifs/find.c @@ -681,8 +681,16 @@ int ubifs_find_free_leb_for_idx(struct ubifs_info *c) if (!lprops) { lprops = ubifs_fast_find_freeable(c); if (!lprops) { - ubifs_assert(c->freeable_cnt == 0); - if (c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) { + /* + * The first condition means the following: go scan the + * LPT if there are uncategorized lprops, which means + * there may be freeable LEBs there (UBIFS does not + * store the information about freeable LEBs in the + * master node). + */ + if (c->in_a_category_cnt != c->main_lebs || + c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) { + ubifs_assert(c->freeable_cnt == 0); lprops = scan_for_leb_for_idx(c); if (IS_ERR(lprops)) { err = PTR_ERR(lprops);