UBIFS: fix debugging FS checking failure
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 2 May 2011 19:34:39 +0000 (22:34 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 13 May 2011 16:23:57 +0000 (19:23 +0300)
commit45cd5cddbfbdf0993dbc76d06ed77d0bf547b421
tree90fb0e0924d94de9b6a5d2dc3b27841fd882c5d5
parent69f8a75a7d9db05a7ee708514d605ab74956c73e
UBIFS: fix debugging FS checking failure

When the debugging self-checks are enabled, we go trough whole file-system
after mount and check/validate every single node referred to by the index.
This is implemented by the 'dbg_check_filesystem()' function. However, this
function fails if we mount "unclean" file-system, i.e., if we mount the
file-system after a power cut. It fails with the following symptoms:

UBIFS DBG (pid 8171): ubifs_recover_size: ino 937 size 3309925 -> 3317760
UBIFS: recovery deferred
UBIFS error (pid 8171): check_leaf: data node at LEB 1000:0 is not within inode size 3309925

The reason of failure is that recovery fixed up the inode size in memory, but
not on the flash so far. So the value on the flash is incorrect so far,
and would be corrected when we re-mount R/W. But 'check_leaf()' ignores
this fact and tries to validate the size of the on-flash inode, which is
incorrect, so it fails.

This patch teaches the checking code to look at the VFS inode cache first,
and if there is the inode in question, use that inode instead of the inode
on the flash media. This fixes the issue.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
fs/ubifs/debug.c