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.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index e9f7a754c4f7..3589eab02a2f 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -36,6 +36,7 @@
36#include <linux/mount.h> 36#include <linux/mount.h>
37#include <linux/math64.h> 37#include <linux/math64.h>
38#include <linux/writeback.h> 38#include <linux/writeback.h>
39#include <linux/smp_lock.h>
39#include "ubifs.h" 40#include "ubifs.h"
40 41
41/* 42/*
@@ -447,9 +448,6 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
447 if (!wait) 448 if (!wait)
448 return 0; 449 return 0;
449 450
450 if (sb->s_flags & MS_RDONLY)
451 return 0;
452
453 /* 451 /*
454 * VFS calls '->sync_fs()' before synchronizing all dirty inodes and 452 * VFS calls '->sync_fs()' before synchronizing all dirty inodes and
455 * pages, so synchronize them first, then commit the journal. Strictly 453 * pages, so synchronize them first, then commit the journal. Strictly
@@ -1687,6 +1685,9 @@ static void ubifs_put_super(struct super_block *sb)
1687 1685
1688 ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num, 1686 ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num,
1689 c->vi.vol_id); 1687 c->vi.vol_id);
1688
1689 lock_kernel();
1690
1690 /* 1691 /*
1691 * The following asserts are only valid if there has not been a failure 1692 * The following asserts are only valid if there has not been a failure
1692 * of the media. For example, there will be dirty inodes if we failed 1693 * of the media. For example, there will be dirty inodes if we failed
@@ -1753,6 +1754,8 @@ static void ubifs_put_super(struct super_block *sb)
1753 ubi_close_volume(c->ubi); 1754 ubi_close_volume(c->ubi);
1754 mutex_unlock(&c->umount_mutex); 1755 mutex_unlock(&c->umount_mutex);
1755 kfree(c); 1756 kfree(c);
1757
1758 unlock_kernel();
1756} 1759}
1757 1760
1758static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) 1761static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
@@ -1768,17 +1771,22 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
1768 return err; 1771 return err;
1769 } 1772 }
1770 1773
1774 lock_kernel();
1771 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { 1775 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
1772 if (c->ro_media) { 1776 if (c->ro_media) {
1773 ubifs_msg("cannot re-mount due to prior errors"); 1777 ubifs_msg("cannot re-mount due to prior errors");
1778 unlock_kernel();
1774 return -EROFS; 1779 return -EROFS;
1775 } 1780 }
1776 err = ubifs_remount_rw(c); 1781 err = ubifs_remount_rw(c);
1777 if (err) 1782 if (err) {
1783 unlock_kernel();
1778 return err; 1784 return err;
1785 }
1779 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { 1786 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
1780 if (c->ro_media) { 1787 if (c->ro_media) {
1781 ubifs_msg("cannot re-mount due to prior errors"); 1788 ubifs_msg("cannot re-mount due to prior errors");
1789 unlock_kernel();
1782 return -EROFS; 1790 return -EROFS;
1783 } 1791 }
1784 ubifs_remount_ro(c); 1792 ubifs_remount_ro(c);
@@ -1793,6 +1801,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
1793 } 1801 }
1794 1802
1795 ubifs_assert(c->lst.taken_empty_lebs > 0); 1803 ubifs_assert(c->lst.taken_empty_lebs > 0);
1804 unlock_kernel();
1796 return 0; 1805 return 0;
1797} 1806}
1798 1807