The patch titled

     ext2: fix mount options parting

has been added to the -mm tree.  Its filename is

     fix-ext2-mount-options-parting.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

fix-ext3-options-parsing.patch
fix-ext2-mount-options-parting.patch
jbd-split-checkpoint-lists.patch
jbd-split-checkpoint-lists-tweaks.patch



From: Jan Kara <[EMAIL PROTECTED]>

Restore old set of ext2 mount options when remounting of a filesystem
fails.

Signed-off-by: Jan Kara <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 fs/ext2/ext2.h  |    9 +++++++++
 fs/ext2/super.c |   24 +++++++++++++++++++++---
 2 files changed, 30 insertions(+), 3 deletions(-)

diff -puN fs/ext2/ext2.h~fix-ext2-mount-options-parting fs/ext2/ext2.h
--- 25/fs/ext2/ext2.h~fix-ext2-mount-options-parting    Fri Jul  8 15:56:23 2005
+++ 25-akpm/fs/ext2/ext2.h      Fri Jul  8 15:56:24 2005
@@ -2,6 +2,15 @@
 #include <linux/ext2_fs.h>
 
 /*
+ * ext2 mount options
+ */
+struct ext2_mount_options {
+       unsigned long s_mount_opt;
+       uid_t s_resuid;
+       gid_t s_resgid;
+};
+
+/*
  * second extended file system inode data in memory
  */
 struct ext2_inode_info {
diff -puN fs/ext2/super.c~fix-ext2-mount-options-parting fs/ext2/super.c
--- 25/fs/ext2/super.c~fix-ext2-mount-options-parting   Fri Jul  8 15:56:23 2005
+++ 25-akpm/fs/ext2/super.c     Fri Jul  8 15:56:24 2005
@@ -936,12 +936,23 @@ static int ext2_remount (struct super_bl
        struct ext2_sb_info * sbi = EXT2_SB(sb);
        struct ext2_super_block * es;
        unsigned long old_mount_opt = sbi->s_mount_opt;
+       struct ext2_mount_options old_opts;
+       unsigned long old_sb_flags;
+       int err;
+
+       /* Store the old options */
+       old_sb_flags = sb->s_flags;
+       old_opts.s_mount_opt = sbi->s_mount_opt;
+       old_opts.s_resuid = sbi->s_resuid;
+       old_opts.s_resgid = sbi->s_resgid;
 
        /*
         * Allow the "check" option to be passed as a remount option.
         */
-       if (!parse_options (data, sbi))
-               return -EINVAL;
+       if (!parse_options (data, sbi)) {
+               err = -EINVAL;
+               goto restore_opts;
+       }
 
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
                ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
@@ -971,7 +982,8 @@ static int ext2_remount (struct super_bl
                        printk("EXT2-fs: %s: couldn't remount RDWR because of "
                               "unsupported optional features (%x).\n",
                               sb->s_id, le32_to_cpu(ret));
-                       return -EROFS;
+                       err = -EROFS;
+                       goto restore_opts;
                }
                /*
                 * Mounting a RDONLY partition read-write, so reread and
@@ -984,6 +996,12 @@ static int ext2_remount (struct super_bl
        }
        ext2_sync_super(sb, es);
        return 0;
+restore_opts:
+       sbi->s_mount_opt = old_opts.s_mount_opt;
+       sbi->s_resuid = old_opts.s_resuid;
+       sbi->s_resgid = old_opts.s_resgid;
+       sb->s_flags = old_sb_flags;
+       return err;
 }
 
 static int ext2_statfs (struct super_block * sb, struct kstatfs * buf)
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to