diff options
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r-- | fs/ext2/super.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index a44963d8edbd..f8cbdf569190 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -1162,6 +1162,8 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1162 | unsigned long old_sb_flags; | 1162 | unsigned long old_sb_flags; |
1163 | int err; | 1163 | int err; |
1164 | 1164 | ||
1165 | lock_kernel(); | ||
1166 | |||
1165 | /* Store the old options */ | 1167 | /* Store the old options */ |
1166 | old_sb_flags = sb->s_flags; | 1168 | old_sb_flags = sb->s_flags; |
1167 | old_opts.s_mount_opt = sbi->s_mount_opt; | 1169 | old_opts.s_mount_opt = sbi->s_mount_opt; |
@@ -1197,12 +1199,16 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1197 | sbi->s_mount_opt &= ~EXT2_MOUNT_XIP; | 1199 | sbi->s_mount_opt &= ~EXT2_MOUNT_XIP; |
1198 | sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP; | 1200 | sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP; |
1199 | } | 1201 | } |
1200 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 1202 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
1203 | unlock_kernel(); | ||
1201 | return 0; | 1204 | return 0; |
1205 | } | ||
1202 | if (*flags & MS_RDONLY) { | 1206 | if (*flags & MS_RDONLY) { |
1203 | if (le16_to_cpu(es->s_state) & EXT2_VALID_FS || | 1207 | if (le16_to_cpu(es->s_state) & EXT2_VALID_FS || |
1204 | !(sbi->s_mount_state & EXT2_VALID_FS)) | 1208 | !(sbi->s_mount_state & EXT2_VALID_FS)) { |
1209 | unlock_kernel(); | ||
1205 | return 0; | 1210 | return 0; |
1211 | } | ||
1206 | /* | 1212 | /* |
1207 | * OK, we are remounting a valid rw partition rdonly, so set | 1213 | * OK, we are remounting a valid rw partition rdonly, so set |
1208 | * the rdonly flag and then mark the partition as valid again. | 1214 | * the rdonly flag and then mark the partition as valid again. |
@@ -1229,12 +1235,14 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1229 | sb->s_flags &= ~MS_RDONLY; | 1235 | sb->s_flags &= ~MS_RDONLY; |
1230 | } | 1236 | } |
1231 | ext2_sync_super(sb, es); | 1237 | ext2_sync_super(sb, es); |
1238 | unlock_kernel(); | ||
1232 | return 0; | 1239 | return 0; |
1233 | restore_opts: | 1240 | restore_opts: |
1234 | sbi->s_mount_opt = old_opts.s_mount_opt; | 1241 | sbi->s_mount_opt = old_opts.s_mount_opt; |
1235 | sbi->s_resuid = old_opts.s_resuid; | 1242 | sbi->s_resuid = old_opts.s_resuid; |
1236 | sbi->s_resgid = old_opts.s_resgid; | 1243 | sbi->s_resgid = old_opts.s_resgid; |
1237 | sb->s_flags = old_sb_flags; | 1244 | sb->s_flags = old_sb_flags; |
1245 | unlock_kernel(); | ||
1238 | return err; | 1246 | return err; |
1239 | } | 1247 | } |
1240 | 1248 | ||