ubifs: Do not update inode size in-place in authenticated mode
authorSascha Hauer <s.hauer@pengutronix.de>
Fri, 7 Sep 2018 12:36:44 +0000 (14:36 +0200)
committerRichard Weinberger <richard@nod.at>
Tue, 23 Oct 2018 11:48:57 +0000 (13:48 +0200)
commit1e76592f2c3208ac635c2758aa8326d82fa64a72
tree7f9deb06a69fc5878c1d352473842c0f4d513915
parent104115a3eb54e7e804cd4ef1d6426c0b8aaaeb60
ubifs: Do not update inode size in-place in authenticated mode

In authenticated mode we cannot fixup the inode sizes in-place
during recovery as this would invalidate the hashes and HMACs
we stored for this inode.

Instead, we just write the updated inodes to the journal. We can
only do this after ubifs_rcvry_gc_commit() is done though, so for
authenticated mode call ubifs_recover_size() after
ubifs_rcvry_gc_commit() and not vice versa as normally done.

Calling ubifs_recover_size() after ubifs_rcvry_gc_commit() has the
drawback that after a commit the size fixup information is gone, so
when a powercut happens while recovering from another powercut
we may lose some data written right before the first powercut.
This is why we only do this in authenticated mode and leave the
behaviour for unauthenticated mode untouched.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/recovery.c
fs/ubifs/super.c
fs/ubifs/ubifs.h