X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=fs%2Fubifs%2Ffind.c;h=2dcf3d473fec1d406bf0fc2d14d73828ff81f662;hb=a28ad42a4a0c6f302f488f26488b8b37c9b30024;hp=28ec13af28d91c360c89c68f7af0f1957e79477a;hpb=c062c4d1de57789bf15f7641a24c429eeb8a1c6a;p=linux-2.6-microblaze.git diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c index 28ec13af28d9..2dcf3d473fec 100644 --- a/fs/ubifs/find.c +++ b/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);