aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-20 11:02:45 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-20 11:16:37 -0400
commit8c230d9a5b5ec7970139acb7e2d165d7a3fe9f9e (patch)
tree734751f33b8a49894df52a5c23bcb39217ba6766 /fs/ubifs/super.c
parentf0e615c3cb72b42191b558c130409335812621d8 (diff)
UBIFS: fix false space checking failure
This patch fixes UBIFS mount failure when the debugging support is enabled, we are recovering from a power cut, we were first mounter R/O and we are re-mounting R/W. In this case we should not assume that the amount of free space before we have re-mounted R/W and after are equivalent, because when we have mounted R/O the file-system is in a non-committed state so the amount of free space is slightly smaller, due to the fact that we cannot predict the amount of free space precisely before we commit. This patch fixes the issue by skipping the debugging check in case of recovery. This issue was reported by Caizhiyong <caizhiyong@huawei.com> here: http://thread.gmane.org/gmane.linux.drivers.mtd/34350/focus=34387 Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Reported-by: Caizhiyong <caizhiyong@huawei.com> Cc: stable@kernel.org [2.6.30+]
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index c75f6133206c..ec33b0670d02 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1671,14 +1671,25 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1671 if (err) 1671 if (err)
1672 goto out; 1672 goto out;
1673 1673
1674 dbg_gen("re-mounted read-write");
1675 c->remounting_rw = 0;
1676
1674 if (c->need_recovery) { 1677 if (c->need_recovery) {
1675 c->need_recovery = 0; 1678 c->need_recovery = 0;
1676 ubifs_msg("deferred recovery completed"); 1679 ubifs_msg("deferred recovery completed");
1680 } else {
1681 /*
1682 * Do not run the debugging space check if the were doing
1683 * recovery, because when we saved the information we had the
1684 * file-system in a state where the TNC and lprops has been
1685 * modified in memory, but all the I/O operations (including a
1686 * commit) were deferred. So the file-system was in
1687 * "non-committed" state. Now the file-system is in committed
1688 * state, and of course the amount of free space will change
1689 * because, for example, the old index size was imprecise.
1690 */
1691 err = dbg_check_space_info(c);
1677 } 1692 }
1678
1679 dbg_gen("re-mounted read-write");
1680 c->remounting_rw = 0;
1681 err = dbg_check_space_info(c);
1682 mutex_unlock(&c->umount_mutex); 1693 mutex_unlock(&c->umount_mutex);
1683 return err; 1694 return err;
1684 1695