diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-23 07:54:59 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-26 05:54:11 -0500 |
commit | 84abf972ccff5c13d10b672972949eba431a6e0e (patch) | |
tree | 378ebf8a77fbc1f906fa8eee2472f8bd6d935772 /fs/ubifs/super.c | |
parent | e4d9b6cbfc98d696a28d2c24a3d49768695811ee (diff) |
UBIFS: add re-mount debugging checks
We observe space corrupted accounting when re-mounting. So add some
debbugging checks to catch problems like this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r-- | fs/ubifs/super.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 807bbd3c8b4b..5c814a71f33a 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1470,6 +1470,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1470 | int err, lnum; | 1470 | int err, lnum; |
1471 | 1471 | ||
1472 | mutex_lock(&c->umount_mutex); | 1472 | mutex_lock(&c->umount_mutex); |
1473 | dbg_save_space_info(c); | ||
1473 | c->remounting_rw = 1; | 1474 | c->remounting_rw = 1; |
1474 | c->always_chk_crc = 1; | 1475 | c->always_chk_crc = 1; |
1475 | 1476 | ||
@@ -1573,8 +1574,9 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1573 | c->vfs_sb->s_flags &= ~MS_RDONLY; | 1574 | c->vfs_sb->s_flags &= ~MS_RDONLY; |
1574 | c->remounting_rw = 0; | 1575 | c->remounting_rw = 0; |
1575 | c->always_chk_crc = 0; | 1576 | c->always_chk_crc = 0; |
1577 | err = dbg_check_space_info(c); | ||
1576 | mutex_unlock(&c->umount_mutex); | 1578 | mutex_unlock(&c->umount_mutex); |
1577 | return 0; | 1579 | return err; |
1578 | 1580 | ||
1579 | out: | 1581 | out: |
1580 | vfree(c->orph_buf); | 1582 | vfree(c->orph_buf); |
@@ -1629,8 +1631,8 @@ static void commit_on_unmount(struct ubifs_info *c) | |||
1629 | * ubifs_remount_ro - re-mount in read-only mode. | 1631 | * ubifs_remount_ro - re-mount in read-only mode. |
1630 | * @c: UBIFS file-system description object | 1632 | * @c: UBIFS file-system description object |
1631 | * | 1633 | * |
1632 | * We rely on VFS to have stopped writing. Possibly the background thread could | 1634 | * We assume VFS has stopped writing. Possibly the background thread could be |
1633 | * be running a commit, however kthread_stop will wait in that case. | 1635 | * running a commit, however kthread_stop will wait in that case. |
1634 | */ | 1636 | */ |
1635 | static void ubifs_remount_ro(struct ubifs_info *c) | 1637 | static void ubifs_remount_ro(struct ubifs_info *c) |
1636 | { | 1638 | { |
@@ -1640,13 +1642,14 @@ static void ubifs_remount_ro(struct ubifs_info *c) | |||
1640 | ubifs_assert(!c->ro_media); | 1642 | ubifs_assert(!c->ro_media); |
1641 | 1643 | ||
1642 | commit_on_unmount(c); | 1644 | commit_on_unmount(c); |
1643 | |||
1644 | mutex_lock(&c->umount_mutex); | 1645 | mutex_lock(&c->umount_mutex); |
1645 | if (c->bgt) { | 1646 | if (c->bgt) { |
1646 | kthread_stop(c->bgt); | 1647 | kthread_stop(c->bgt); |
1647 | c->bgt = NULL; | 1648 | c->bgt = NULL; |
1648 | } | 1649 | } |
1649 | 1650 | ||
1651 | dbg_save_space_info(c); | ||
1652 | |||
1650 | for (i = 0; i < c->jhead_cnt; i++) { | 1653 | for (i = 0; i < c->jhead_cnt; i++) { |
1651 | ubifs_wbuf_sync(&c->jheads[i].wbuf); | 1654 | ubifs_wbuf_sync(&c->jheads[i].wbuf); |
1652 | del_timer_sync(&c->jheads[i].wbuf.timer); | 1655 | del_timer_sync(&c->jheads[i].wbuf.timer); |
@@ -1669,6 +1672,9 @@ static void ubifs_remount_ro(struct ubifs_info *c) | |||
1669 | vfree(c->ileb_buf); | 1672 | vfree(c->ileb_buf); |
1670 | c->ileb_buf = NULL; | 1673 | c->ileb_buf = NULL; |
1671 | ubifs_lpt_free(c, 1); | 1674 | ubifs_lpt_free(c, 1); |
1675 | err = dbg_check_space_info(c); | ||
1676 | if (err) | ||
1677 | ubifs_ro_mode(c, err); | ||
1672 | mutex_unlock(&c->umount_mutex); | 1678 | mutex_unlock(&c->umount_mutex); |
1673 | } | 1679 | } |
1674 | 1680 | ||