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.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index c75f6133206c..04ad07f4fcc3 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1257,12 +1257,12 @@ static int mount_ubifs(struct ubifs_info *c)
1257 goto out_free; 1257 goto out_free;
1258 } 1258 }
1259 1259
1260 err = alloc_wbufs(c);
1261 if (err)
1262 goto out_cbuf;
1263
1260 sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id); 1264 sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
1261 if (!c->ro_mount) { 1265 if (!c->ro_mount) {
1262 err = alloc_wbufs(c);
1263 if (err)
1264 goto out_cbuf;
1265
1266 /* Create background thread */ 1266 /* Create background thread */
1267 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); 1267 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);
1268 if (IS_ERR(c->bgt)) { 1268 if (IS_ERR(c->bgt)) {
@@ -1631,12 +1631,6 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1631 if (err) 1631 if (err)
1632 goto out; 1632 goto out;
1633 1633
1634 err = alloc_wbufs(c);
1635 if (err)
1636 goto out;
1637
1638 ubifs_create_buds_lists(c);
1639
1640 /* Create background thread */ 1634 /* Create background thread */
1641 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); 1635 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);
1642 if (IS_ERR(c->bgt)) { 1636 if (IS_ERR(c->bgt)) {
@@ -1671,14 +1665,25 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1671 if (err) 1665 if (err)
1672 goto out; 1666 goto out;
1673 1667
1668 dbg_gen("re-mounted read-write");
1669 c->remounting_rw = 0;
1670
1674 if (c->need_recovery) { 1671 if (c->need_recovery) {
1675 c->need_recovery = 0; 1672 c->need_recovery = 0;
1676 ubifs_msg("deferred recovery completed"); 1673 ubifs_msg("deferred recovery completed");
1674 } else {
1675 /*
1676 * Do not run the debugging space check if the were doing
1677 * recovery, because when we saved the information we had the
1678 * file-system in a state where the TNC and lprops has been
1679 * modified in memory, but all the I/O operations (including a
1680 * commit) were deferred. So the file-system was in
1681 * "non-committed" state. Now the file-system is in committed
1682 * state, and of course the amount of free space will change
1683 * because, for example, the old index size was imprecise.
1684 */
1685 err = dbg_check_space_info(c);
1677 } 1686 }
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); 1687 mutex_unlock(&c->umount_mutex);
1683 return err; 1688 return err;
1684 1689
@@ -1733,7 +1738,6 @@ static void ubifs_remount_ro(struct ubifs_info *c)
1733 if (err) 1738 if (err)
1734 ubifs_ro_mode(c, err); 1739 ubifs_ro_mode(c, err);
1735 1740
1736 free_wbufs(c);
1737 vfree(c->orph_buf); 1741 vfree(c->orph_buf);
1738 c->orph_buf = NULL; 1742 c->orph_buf = NULL;
1739 kfree(c->write_reserve_buf); 1743 kfree(c->write_reserve_buf);
@@ -1761,10 +1765,12 @@ static void ubifs_put_super(struct super_block *sb)
1761 * of the media. For example, there will be dirty inodes if we failed 1765 * of the media. For example, there will be dirty inodes if we failed
1762 * to write them back because of I/O errors. 1766 * to write them back because of I/O errors.
1763 */ 1767 */
1764 ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0); 1768 if (!c->ro_error) {
1765 ubifs_assert(c->budg_idx_growth == 0); 1769 ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0);
1766 ubifs_assert(c->budg_dd_growth == 0); 1770 ubifs_assert(c->budg_idx_growth == 0);
1767 ubifs_assert(c->budg_data_growth == 0); 1771 ubifs_assert(c->budg_dd_growth == 0);
1772 ubifs_assert(c->budg_data_growth == 0);
1773 }
1768 1774
1769 /* 1775 /*
1770 * The 'c->umount_lock' prevents races between UBIFS memory shrinker 1776 * The 'c->umount_lock' prevents races between UBIFS memory shrinker