aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r--fs/ext2/super.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 876e391f2871..dcfe331dc4c4 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -936,12 +936,23 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
936 struct ext2_sb_info * sbi = EXT2_SB(sb); 936 struct ext2_sb_info * sbi = EXT2_SB(sb);
937 struct ext2_super_block * es; 937 struct ext2_super_block * es;
938 unsigned long old_mount_opt = sbi->s_mount_opt; 938 unsigned long old_mount_opt = sbi->s_mount_opt;
939 struct ext2_mount_options old_opts;
940 unsigned long old_sb_flags;
941 int err;
942
943 /* Store the old options */
944 old_sb_flags = sb->s_flags;
945 old_opts.s_mount_opt = sbi->s_mount_opt;
946 old_opts.s_resuid = sbi->s_resuid;
947 old_opts.s_resgid = sbi->s_resgid;
939 948
940 /* 949 /*
941 * Allow the "check" option to be passed as a remount option. 950 * Allow the "check" option to be passed as a remount option.
942 */ 951 */
943 if (!parse_options (data, sbi)) 952 if (!parse_options (data, sbi)) {
944 return -EINVAL; 953 err = -EINVAL;
954 goto restore_opts;
955 }
945 956
946 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 957 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
947 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 958 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
@@ -971,7 +982,8 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
971 printk("EXT2-fs: %s: couldn't remount RDWR because of " 982 printk("EXT2-fs: %s: couldn't remount RDWR because of "
972 "unsupported optional features (%x).\n", 983 "unsupported optional features (%x).\n",
973 sb->s_id, le32_to_cpu(ret)); 984 sb->s_id, le32_to_cpu(ret));
974 return -EROFS; 985 err = -EROFS;
986 goto restore_opts;
975 } 987 }
976 /* 988 /*
977 * Mounting a RDONLY partition read-write, so reread and 989 * Mounting a RDONLY partition read-write, so reread and
@@ -984,6 +996,12 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
984 } 996 }
985 ext2_sync_super(sb, es); 997 ext2_sync_super(sb, es);
986 return 0; 998 return 0;
999restore_opts:
1000 sbi->s_mount_opt = old_opts.s_mount_opt;
1001 sbi->s_resuid = old_opts.s_resuid;
1002 sbi->s_resgid = old_opts.s_resgid;
1003 sb->s_flags = old_sb_flags;
1004 return err;
987} 1005}
988 1006
989static int ext2_statfs (struct super_block * sb, struct kstatfs * buf) 1007static int ext2_statfs (struct super_block * sb, struct kstatfs * buf)