aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index e5dc1e120e8d..be6c7b008f38 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1568,6 +1568,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1568 mutex_lock(&c->umount_mutex); 1568 mutex_lock(&c->umount_mutex);
1569 dbg_save_space_info(c); 1569 dbg_save_space_info(c);
1570 c->remounting_rw = 1; 1570 c->remounting_rw = 1;
1571 c->ro_mount = 0;
1571 1572
1572 err = check_free_space(c); 1573 err = check_free_space(c);
1573 if (err) 1574 if (err)
@@ -1670,19 +1671,30 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1670 if (err) 1671 if (err)
1671 goto out; 1672 goto out;
1672 1673
1674 dbg_gen("re-mounted read-write");
1675 c->remounting_rw = 0;
1676
1673 if (c->need_recovery) { 1677 if (c->need_recovery) {
1674 c->need_recovery = 0; 1678 c->need_recovery = 0;
1675 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);
1676 } 1692 }
1677
1678 dbg_gen("re-mounted read-write");
1679 c->ro_mount = 0;
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
1685out: 1696out:
1697 c->ro_mount = 1;
1686 vfree(c->orph_buf); 1698 vfree(c->orph_buf);
1687 c->orph_buf = NULL; 1699 c->orph_buf = NULL;
1688 if (c->bgt) { 1700 if (c->bgt) {
@@ -1760,10 +1772,12 @@ static void ubifs_put_super(struct super_block *sb)
1760 * of the media. For example, there will be dirty inodes if we failed 1772 * of the media. For example, there will be dirty inodes if we failed
1761 * to write them back because of I/O errors. 1773 * to write them back because of I/O errors.
1762 */ 1774 */
1763 ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0); 1775 if (!c->ro_error) {
1764 ubifs_assert(c->budg_idx_growth == 0); 1776 ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0);
1765 ubifs_assert(c->budg_dd_growth == 0); 1777 ubifs_assert(c->budg_idx_growth == 0);
1766 ubifs_assert(c->budg_data_growth == 0); 1778 ubifs_assert(c->budg_dd_growth == 0);
1779 ubifs_assert(c->budg_data_growth == 0);
1780 }
1767 1781
1768 /* 1782 /*
1769 * The 'c->umount_lock' prevents races between UBIFS memory shrinker 1783 * The 'c->umount_lock' prevents races between UBIFS memory shrinker
@@ -2011,7 +2025,6 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
2011 */ 2025 */
2012 c->bdi.name = "ubifs", 2026 c->bdi.name = "ubifs",
2013 c->bdi.capabilities = BDI_CAP_MAP_COPY; 2027 c->bdi.capabilities = BDI_CAP_MAP_COPY;
2014 c->bdi.unplug_io_fn = default_unplug_io_fn;
2015 err = bdi_init(&c->bdi); 2028 err = bdi_init(&c->bdi);
2016 if (err) 2029 if (err)
2017 goto out_close; 2030 goto out_close;