]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
UBIFS: fix mounting problems after power cuts
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 9 Oct 2012 13:20:15 +0000 (16:20 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 6 Dec 2012 11:20:01 +0000 (11:20 +0000)
commitc26a0f67479f10d0241a79c306eb1b9002e98d51
tree2e24a257296a54c9a93fc167f6e58c26759c7572
parentfd132e0440dfad94d4cda744377c81da474d53b9
UBIFS: fix mounting problems after power cuts

commit a28ad42a4a0c6f302f488f26488b8b37c9b30024 upstream.

This is a bugfix for a problem with the following symptoms:

1. A power cut happens
2. After reboot, we try to mount UBIFS
3. Mount fails with "No space left on device" error message

UBIFS complains like this:

UBIFS error (pid 28225): grab_empty_leb: could not find an empty LEB

The root cause of this problem is that when we mount, not all LEBs are
categorized. Only those which were read are. However, the
'ubifs_find_free_leb_for_idx()' function assumes that all LEBs were
categorized and 'c->freeable_cnt' is valid, which is a false assumption.

This patch fixes the problem by teaching 'ubifs_find_free_leb_for_idx()'
to always fall back to LPT scanning if no freeable LEBs were found.

This problem was reported by few people in the past, but Brent Taylor
was able to reproduce it and send me a flash image which cannot be mounted,
which made it easy to hunt the bug. Kudos to Brent.

Reported-by: Brent Taylor <motobud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ubifs/find.c