ext3: correct mount option parsing to detect when quota options can be changed

Previous thread: ext3: fix typos in messages and comments (journalled -> journaled) by Linux Kernel Mailing List on Friday, July 25, 2008 - 12:02 pm. (1 message)

Next thread: ext3: fix synchronization of quota files in journal=data mode by Linux Kernel Mailing List on Friday, July 25, 2008 - 12:02 pm. (1 message)
From: Linux Kernel Mailing List
Date: Friday, July 25, 2008 - 12:02 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d06bf1...
Commit:     d06bf1d252fe16f5f0d13e04da7a9913420aa1cf
Parent:     99aeaf639f61ab6be1967e5f92e2e28dafad8383
Author:     Jan Kara <jack@suse.cz>
AuthorDate: Fri Jul 25 01:46:18 2008 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Fri Jul 25 10:53:32 2008 -0700

    ext3: correct mount option parsing to detect when quota options can be changed
    
    We should not allow user to change quota mount options when quota is just
    suspended.  I would make mount options and internal quota state inconsistent.
    Also we should not allow user to change quota format when quota is turned on.
    On the other hand we can just silently ignore when some option is set to the
    value it already has (mount does this on remount).
    
    Cc: <linux-ext4@vger.kernel.org>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 fs/ext3/super.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 0a1bf82..615788c 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -842,7 +842,7 @@ static int parse_options (char *options, struct super_block *sb,
 	int data_opt = 0;
 	int option;
 #ifdef CONFIG_QUOTA
-	int qtype;
+	int qtype, qfmt;
 	char *qname;
 #endif
 
@@ -1018,7 +1018,9 @@ static int parse_options (char *options, struct super_block *sb,
 		case Opt_grpjquota:
 			qtype = GRPQUOTA;
 set_qf_name:
-			if (sb_any_quota_enabled(sb)) {
+			if ((sb_any_quota_enabled(sb) ||
+			     sb_any_quota_suspended(sb)) &&
+			    !sbi->s_qf_names[qtype]) {
 				printk(KERN_ERR
 					"EXT3-fs: Cannot change journaled "
 					"quota options when quota turned on.\n");
@@ -1056,7 +1058,9 @@ set_qf_name:
 		case Opt_offgrpjquota:
 ...
Previous thread: ext3: fix typos in messages and comments (journalled -> journaled) by Linux Kernel Mailing List on Friday, July 25, 2008 - 12:02 pm. (1 message)

Next thread: ext3: fix synchronization of quota files in journal=data mode by Linux Kernel Mailing List on Friday, July 25, 2008 - 12:02 pm. (1 message)