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.c14
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
1579out: 1581out:
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 */
1635static void ubifs_remount_ro(struct ubifs_info *c) 1637static 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