Skip to contentSkip to conversation

ext3: Fix synchronization of quota files in journal=data mode

PATCH New Jan Kara 6 participants 21 messages Apr 30, 2008 – May 5, 2008

Subsystems (2)
lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 ext3: Fix synchronization of quota files in journal=data mode

In journal=data mode, it is not enough to do write_inode_now as done in vfs_quota_on() to write all data to their final location (which is needed for quota_read to work correctly). Calling journal_flush() does its job.

---
 fs/ext3/super.c |   35 +++++++++++++++++++++++++++--------
 1 files changed, 27 insertions(+), 8 deletions(-)
fs/ext3/super.c +27 -8
index fe3119a..1c7b0fc 100644
@@ -2759,23 +2759,42 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
 
 	if (!test_opt(sb, QUOTA))
 		return -EINVAL;
-	/* Not journalling quota or remount? */
-	if ((!EXT3_SB(sb)->s_qf_names[USRQUOTA] &&
-	    !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) || remount)
+	/* When remounting, no checks are needed and in fact, path is NULL */
+	if (remount)
 		return vfs_quota_on(sb, type, format_id, path, remount);
+
 	err = path_lookup(path, LOOKUP_FOLLOW, &nd);
 	if (err)
 		return err;
+
 	/* Quotafile not on the same filesystem? */
 	if (nd.path.mnt->mnt_sb != sb) {
 		path_put(&nd.path);
 		return -EXDEV;
 	}
-	/* Quotafile not in fs root? */
-	if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
-		printk(KERN_WARNING
-			"EXT3-fs: Quota file not on filesystem root. "
-			"Journalled quota will not work.\n");
+	/* Journaling quota? */
+	if (EXT3_SB(sb)->s_qf_names[type]) {
+		/* Quotafile not of fs root? */
+		if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
+			printk(KERN_WARNING
+				"EXT3-fs: Quota file not on filesystem root. "
+				"Journaled quota will not work.\n");
+	}
+
+	/*
+	 * When we journal data on quota file, we have to flush journal to see
+	 * all updates to the file when we bypass pagecache...
+	 */
+	if (ext3_should_journal_data(nd.path.dentry->d_inode)) {
+		/*
+		 * We don't need to lock updates but journal_flush() could
+		 * otherwise be livelocked...
+		 */
+		journal_lock_updates(EXT3_SB(sb)->s_journal);
+		journal_flush(EXT3_SB(sb)->s_journal);
+		journal_unlock_updates(EXT3_SB(sb)->s_journal);
+	}
+
 	path_put(&nd.path);
 	return vfs_quota_on(sb, type, format_id, path, remount);
 }
Signature · 1 line
1.5.2.4
author reviewer
#1 lore raw

PATCH 1/1 ext4: Fix synchronization of quota files in journal=data mode

In journal=data mode, it is not enough to do write_inode_now as done in vfs_quota_on() to write all data to their final location (which is needed for quota_read to work correctly). Calling journal_flush() does its job.

---
 fs/ext4/super.c |   35 +++++++++++++++++++++++++++--------
 1 files changed, 27 insertions(+), 8 deletions(-)
fs/ext4/super.c +27 -8
index 52dd067..f6ab164 100644
@@ -3153,23 +3153,42 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
 
 	if (!test_opt(sb, QUOTA))
 		return -EINVAL;
-	/* Not journalling quota? */
-	if ((!EXT4_SB(sb)->s_qf_names[USRQUOTA] &&
-	    !EXT4_SB(sb)->s_qf_names[GRPQUOTA]) || remount)
+	/* When remounting, no checks are needed and in fact, path is NULL */
+	if (remount)
 		return vfs_quota_on(sb, type, format_id, path, remount);
+
 	err = path_lookup(path, LOOKUP_FOLLOW, &nd);
 	if (err)
 		return err;
+
 	/* Quotafile not on the same filesystem? */
 	if (nd.path.mnt->mnt_sb != sb) {
 		path_put(&nd.path);
 		return -EXDEV;
 	}
-	/* Quotafile not of fs root? */
-	if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
-		printk(KERN_WARNING
-			"EXT4-fs: Quota file not on filesystem root. "
-			"Journalled quota will not work.\n");
+	/* Journaling quota? */
+	if (EXT4_SB(sb)->s_qf_names[type]) {
+		/* Quotafile not of fs root? */
+		if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
+			printk(KERN_WARNING
+				"EXT4-fs: Quota file not on filesystem root. "
+				"Journaled quota will not work.\n");
+ 	}
+
+	/*
+	 * When we journal data on quota file, we have to flush journal to see
+	 * all updates to the file when we bypass pagecache...
+	 */
+	if (ext4_should_journal_data(nd.path.dentry->d_inode)) {
+		/*
+		 * We don't need to lock updates but journal_flush() could
+		 * otherwise be livelocked...
+		 */
+		jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
+		jbd2_journal_flush(EXT4_SB(sb)->s_journal);
+		jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
+	}
+
 	path_put(&nd.path);
 	return vfs_quota_on(sb, type, format_id, path, remount);
 }
Signature · 1 line
1.5.2.4
author reviewer
#2 lore raw

PATCH 1/1 reiserfs: Fix synchronization of quota files in journal=data mode

In journal=data mode, it is not enough to do write_inode_now() as done in vfs_quota_on() to write all data to their final location (which is needed for quota_read to work correctly). Calling journal_end_sync() before calling vfs_quota_on() does it's job because transactions are committed to the journal and data marked as dirty in memory so write_inode_now() writes them to their final locations.

---
 fs/reiserfs/super.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)
fs/reiserfs/super.c +21 -9
index ed424d7..072116a 100644
@@ -2026,6 +2026,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
 	int err;
 	struct nameidata nd;
 	struct inode *inode;
+	struct reiserfs_transaction_handle th;
 
 	if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA)))
 		return -EINVAL;
@@ -2053,17 +2054,28 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
 		}
 		mark_inode_dirty(inode);
 	}
-	/* Not journalling quota? No more tests needed... */
-	if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] &&
-	    !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) {
-		path_put(&nd.path);
-		return vfs_quota_on(sb, type, format_id, path, 0);
-	}
-	/* Quotafile not of fs root? */
-	if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
-		reiserfs_warning(sb,
+	/* Journaling quota? */
+	if (REISERFS_SB(sb)->s_qf_names[type]) {
+		/* Quotafile not of fs root? */
+		if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
+			reiserfs_warning(sb,
 				 "reiserfs: Quota file not on filesystem root. "
 				 "Journalled quota will not work.");
+	}
+
+	/*
+	 * When we journal data on quota file, we have to flush journal to see
+	 * all updates to the file when we bypass pagecache...
+	 */
+	if (reiserfs_file_data_log(inode)) {
+		/* Just start temporary transaction and finish it */
+		err = journal_begin(&th, sb, 1);
+		if (err)
+			return err;
+		err = journal_end_sync(&th, sb, 1);
+		if (err)
+			return err;
+	}
 	path_put(&nd.path);
 	return vfs_quota_on(sb, type, format_id, path, 0);
 }
Signature · 1 line
1.5.2.4
author reviewer
#3 lore raw

PATCH 1/1 ext3: Fix typos in messages and comments (journalled -> journaled)

---
 fs/ext3/super.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
fs/ext3/super.c +7 -7
index 1c7b0fc..890e72f 100644
@@ -1020,7 +1020,7 @@ static int parse_options (char *options, struct super_block *sb,
 set_qf_name:
 			if (sb_any_quota_enabled(sb)) {
 				printk(KERN_ERR
-					"EXT3-fs: Cannot change journalled "
+					"EXT3-fs: Cannot change journaled "
 					"quota options when quota turned on.\n");
 				return 0;
 			}
@@ -1058,7 +1058,7 @@ set_qf_name:
 clear_qf_name:
 			if (sb_any_quota_enabled(sb)) {
 				printk(KERN_ERR "EXT3-fs: Cannot change "
-					"journalled quota options when "
+					"journaled quota options when "
 					"quota turned on.\n");
 				return 0;
 			}
@@ -1169,14 +1169,14 @@ clear_qf_name:
 		}
 
 		if (!sbi->s_jquota_fmt) {
-			printk(KERN_ERR "EXT3-fs: journalled quota format "
+			printk(KERN_ERR "EXT3-fs: journaled quota format "
 					"not specified.\n");
 			return 0;
 		}
 	} else {
 		if (sbi->s_jquota_fmt) {
-			printk(KERN_ERR "EXT3-fs: journalled quota format "
-					"specified with no journalling "
+			printk(KERN_ERR "EXT3-fs: journaled quota format "
+					"specified with no journaling "
 					"enabled.\n");
 			return 0;
 		}
@@ -1370,7 +1370,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
 			int ret = ext3_quota_on_mount(sb, i);
 			if (ret < 0)
 				printk(KERN_ERR
-					"EXT3-fs: Cannot turn on journalled "
+					"EXT3-fs: Cannot turn on journaled "
 					"quota: error %d\n", ret);
 		}
 	}
@@ -2712,7 +2712,7 @@ static int ext3_release_dquot(struct dquot *dquot)
 
 static int ext3_mark_dquot_dirty(struct dquot *dquot)
 {
-	/* Are we journalling quotas? */
+	/* Are we journaling quotas? */
 	if (EXT3_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
 	    EXT3_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) {
 		dquot_mark_dquot_dirty(dquot);
Signature · 1 line
1.5.2.4
author reviewer
#4 lore raw

PATCH 1/1 ext4: Fix typos in messages and comments (journalled -> journaled)

---
 fs/ext4/super.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
fs/ext4/super.c +8 -8
index f6ab164..49099e4 100644
@@ -1164,7 +1164,7 @@ static int parse_options (char *options, struct super_block *sb,
 set_qf_name:
 			if (sb_any_quota_enabled(sb)) {
 				printk(KERN_ERR
-					"EXT4-fs: Cannot change journalled "
+					"EXT4-fs: Cannot change journaled "
 					"quota options when quota turned on.\n");
 				return 0;
 			}
@@ -1202,7 +1202,7 @@ set_qf_name:
 clear_qf_name:
 			if (sb_any_quota_enabled(sb)) {
 				printk(KERN_ERR "EXT4-fs: Cannot change "
-					"journalled quota options when "
+					"journaled quota options when "
 					"quota turned on.\n");
 				return 0;
 			}
@@ -1248,7 +1248,7 @@ clear_qf_name:
 		case Opt_jqfmt_vfsold:
 		case Opt_jqfmt_vfsv0:
 			printk(KERN_ERR
-				"EXT4-fs: journalled quota options not "
+				"EXT4-fs: journaled quota options not "
 				"supported.\n");
 			break;
 		case Opt_noquota:
@@ -1333,14 +1333,14 @@ clear_qf_name:
 		}
 
 		if (!sbi->s_jquota_fmt) {
-			printk(KERN_ERR "EXT4-fs: journalled quota format "
+			printk(KERN_ERR "EXT4-fs: journaled quota format "
 					"not specified.\n");
 			return 0;
 		}
 	} else {
 		if (sbi->s_jquota_fmt) {
-			printk(KERN_ERR "EXT4-fs: journalled quota format "
-					"specified with no journalling "
+			printk(KERN_ERR "EXT4-fs: journaled quota format "
+					"specified with no journaling "
 					"enabled.\n");
 			return 0;
 		}
@@ -1581,7 +1581,7 @@ static void ext4_orphan_cleanup (struct super_block * sb,
 			int ret = ext4_quota_on_mount(sb, i);
 			if (ret < 0)
 				printk(KERN_ERR
-					"EXT4-fs: Cannot turn on journalled "
+					"EXT4-fs: Cannot turn on journaled "
 					"quota: error %d\n", ret);
 		}
 	}
@@ -3106,7 +3106,7 @@ static int ext4_release_dquot(struct dquot *dquot)
 
 static int ext4_mark_dquot_dirty(struct dquot *dquot)
 {
-	/* Are we journalling quotas? */
+	/* Are we journaling quotas? */
 	if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
 	    EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) {
 		dquot_mark_dquot_dirty(dquot);
Signature · 1 line
1.5.2.4
author reviewer
#5 lore raw

PATCH 1/1 reiserfs: Fix typos in messages and comments (journalled -> journaled)

---
 fs/reiserfs/super.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
fs/reiserfs/super.c +5 -5
index 072116a..118b059 100644
@@ -182,7 +182,7 @@ static int finish_unfinished(struct super_block *s)
 			int ret = reiserfs_quota_on_mount(s, i);
 			if (ret < 0)
 				reiserfs_warning(s,
-						 "reiserfs: cannot turn on journalled quota: error %d",
+						 "reiserfs: cannot turn on journaled quota: error %d",
 						 ret);
 		}
 	}
@@ -994,7 +994,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options,	/* strin
 
 			if (sb_any_quota_enabled(s)) {
 				reiserfs_warning(s,
-						 "reiserfs_parse_options: cannot change journalled quota options when quota turned on.");
+						 "reiserfs_parse_options: cannot change journaled quota options when quota turned on.");
 				return 0;
 			}
 			if (*arg) {	/* Some filename specified? */
@@ -1039,7 +1039,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options,	/* strin
 #else
 		if (c == 'u' || c == 'g' || c == 'f') {
 			reiserfs_warning(s,
-					 "reiserfs_parse_options: journalled quota options not supported.");
+					 "reiserfs_parse_options: journaled quota options not supported.");
 			return 0;
 		}
 #endif
@@ -1050,7 +1050,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options,	/* strin
 	    && (REISERFS_SB(s)->s_qf_names[USRQUOTA]
 		|| REISERFS_SB(s)->s_qf_names[GRPQUOTA])) {
 		reiserfs_warning(s,
-				 "reiserfs_parse_options: journalled quota format not specified.");
+				 "reiserfs_parse_options: journaled quota format not specified.");
 		return 0;
 	}
 	/* This checking is not precise wrt the quota type but for our purposes it is sufficient */
@@ -1980,7 +1980,7 @@ static int reiserfs_release_dquot(struct dquot *dquot)
 
 static int reiserfs_mark_dquot_dirty(struct dquot *dquot)
 {
-	/* Are we journalling quotas? */
+	/* Are we journaling quotas? */
 	if (REISERFS_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
 	    REISERFS_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) {
 		dquot_mark_dquot_dirty(dquot);
Signature · 1 line
1.5.2.4
author reviewer
#6 lore raw

PATCH 1/1 quota: Add a convenience macro for filesystems

Note that it cannot be an inline function because we don't have struct super_block prototype...

---
 include/linux/quota.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/quota.h +3 -0
index 52e49dc..dcddfb2 100644
@@ -347,6 +347,9 @@ struct quota_info {
 	((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
 			      (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
 
+#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
+				  sb_has_quota_suspended(sb, GRPQUOTA))
+
 int register_quota_format(struct quota_format_type *fmt);
 void unregister_quota_format(struct quota_format_type *fmt);
 
Signature · 1 line
1.5.2.4
author reviewer
#7 lore raw

PATCH 1/1 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).

---
 fs/ext3/super.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)
fs/ext3/super.c +22 -7
index 890e72f..0b6f924 100644
@@ -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:
 			qtype = GRPQUOTA;
 clear_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");
@@ -1069,10 +1073,20 @@ clear_qf_name:
 			sbi->s_qf_names[qtype] = NULL;
 			break;
 		case Opt_jqfmt_vfsold:
-			sbi->s_jquota_fmt = QFMT_VFS_OLD;
-			break;
+			qfmt = QFMT_VFS_OLD;
+			goto set_qf_format;
 		case Opt_jqfmt_vfsv0:
-			sbi->s_jquota_fmt = QFMT_VFS_V0;
+			qfmt = QFMT_VFS_V0;
+set_qf_format:
+			if ((sb_any_quota_enabled(sb) ||
+			     sb_any_quota_suspended(sb)) &&
+			    sbi->s_jquota_fmt != qfmt) {
+				printk(KERN_ERR "EXT3-fs: Cannot change "
+					"journaled quota options when "
+					"quota turned on.\n");
+				return 0;
+			}
+			sbi->s_jquota_fmt = qfmt;
 			break;
 		case Opt_quota:
 		case Opt_usrquota:
@@ -1084,7 +1098,8 @@ clear_qf_name:
 			set_opt(sbi->s_mount_opt, GRPQUOTA);
 			break;
 		case Opt_noquota:
-			if (sb_any_quota_enabled(sb)) {
+			if (sb_any_quota_enabled(sb) ||
+			    sb_any_quota_suspended(sb)) {
 				printk(KERN_ERR "EXT3-fs: Cannot change quota "
 					"options when quota turned on.\n");
 				return 0;
Signature · 1 line
1.5.2.4
author reviewer
#8 lore raw

PATCH 1/1 ext4: 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).

---
 fs/ext4/super.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
fs/ext4/super.c +20 -6
index 49099e4..4f0588a 100644
@@ -979,7 +979,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
 
@@ -1162,7 +1162,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
 					"EXT4-fs: Cannot change journaled "
 					"quota options when quota turned on.\n");
@@ -1200,7 +1202,9 @@ set_qf_name:
 		case Opt_offgrpjquota:
 			qtype = GRPQUOTA;
 clear_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 "EXT4-fs: Cannot change "
 					"journaled quota options when "
 					"quota turned on.\n");
@@ -1213,10 +1217,20 @@ clear_qf_name:
 			sbi->s_qf_names[qtype] = NULL;
 			break;
 		case Opt_jqfmt_vfsold:
-			sbi->s_jquota_fmt = QFMT_VFS_OLD;
-			break;
+			qfmt = QFMT_VFS_OLD;
+			goto set_qf_format;
 		case Opt_jqfmt_vfsv0:
-			sbi->s_jquota_fmt = QFMT_VFS_V0;
+			qfmt = QFMT_VFS_V0;
+set_qf_format:
+			if ((sb_any_quota_enabled(sb) ||
+			     sb_any_quota_suspended(sb)) &&
+			    sbi->s_jquota_fmt != qfmt) {
+				printk(KERN_ERR "EXT4-fs: Cannot change "
+					"journaled quota options when "
+					"quota turned on.\n");
+				return 0;
+			}
+			sbi->s_jquota_fmt = qfmt;
 			break;
 		case Opt_quota:
 		case Opt_usrquota:
Signature · 1 line
1.5.2.4
author reviewer
#9 lore raw

PATCH 1/1 reiserfs: 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. It 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 (some mount versions do this on remount). Finally, we should not discard current quota options if parsing of mount options fails.

---
 fs/reiserfs/super.c |   83 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 60 insertions(+), 23 deletions(-)
fs/reiserfs/super.c +60 -23
index 118b059..2c3aa5f 100644
@@ -876,7 +876,9 @@ static int reiserfs_parse_options(struct super_block *s, char *options,	/* strin
 				     mount options were selected. */
 				  unsigned long *blocks,	/* strtol-ed from NNN of resize=NNN */
 				  char **jdev_name,
-				  unsigned int *commit_max_age)
+				  unsigned int *commit_max_age,
+				  char **qf_names,
+				  unsigned int *qfmt)
 {
 	int c;
 	char *arg = NULL;
@@ -992,7 +994,9 @@ static int reiserfs_parse_options(struct super_block *s, char *options,	/* strin
 		if (c == 'u' || c == 'g') {
 			int qtype = c == 'u' ? USRQUOTA : GRPQUOTA;
 
-			if (sb_any_quota_enabled(s)) {
+			if ((sb_any_quota_enabled(s) ||
+			     sb_any_quota_suspended(s)) &&
+			    (!*arg != !REISERFS_SB(s)->s_qf_names[qtype])) {
 				reiserfs_warning(s,
 						 "reiserfs_parse_options: cannot change journaled quota options when quota turned on.");
 				return 0;
@@ -1011,30 +1015,39 @@ static int reiserfs_parse_options(struct super_block *s, char *options,	/* strin
 							 "reiserfs_parse_options: quotafile must be on filesystem root.");
 					return 0;
 				}
-				REISERFS_SB(s)->s_qf_names[qtype] =
+				qf_names[qtype] =
 				    kmalloc(strlen(arg) + 1, GFP_KERNEL);
-				if (!REISERFS_SB(s)->s_qf_names[qtype]) {
+				if (!qf_names[qtype]) {
 					reiserfs_warning(s,
 							 "reiserfs_parse_options: not enough memory for storing quotafile name.");
 					return 0;
 				}
-				strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg);
+				strcpy(qf_names[qtype], arg);
 				*mount_options |= 1 << REISERFS_QUOTA;
 			} else {
-				kfree(REISERFS_SB(s)->s_qf_names[qtype]);
-				REISERFS_SB(s)->s_qf_names[qtype] = NULL;
+				if (qf_names[qtype] !=
+				    REISERFS_SB(s)->s_qf_names[qtype])
+					kfree(qf_names[qtype]);
+				qf_names[qtype] = NULL;
 			}
 		}
 		if (c == 'f') {
 			if (!strcmp(arg, "vfsold"))
-				REISERFS_SB(s)->s_jquota_fmt = QFMT_VFS_OLD;
+				*qfmt = QFMT_VFS_OLD;
 			else if (!strcmp(arg, "vfsv0"))
-				REISERFS_SB(s)->s_jquota_fmt = QFMT_VFS_V0;
+				*qfmt = QFMT_VFS_V0;
 			else {
 				reiserfs_warning(s,
 						 "reiserfs_parse_options: unknown quota format specified.");
 				return 0;
 			}
+			if ((sb_any_quota_enabled(s) ||
+			     sb_any_quota_suspended(s)) &&
+			    *qfmt != REISERFS_SB(s)->s_jquota_fmt) {
+				reiserfs_warning(s,
+						 "reiserfs_parse_options: cannot change journaled quota options when quota turned on.");
+				return 0;
+			}
 		}
 #else
 		if (c == 'u' || c == 'g' || c == 'f') {
@@ -1046,9 +1059,8 @@ static int reiserfs_parse_options(struct super_block *s, char *options,	/* strin
 	}
 
 #ifdef CONFIG_QUOTA
-	if (!REISERFS_SB(s)->s_jquota_fmt
-	    && (REISERFS_SB(s)->s_qf_names[USRQUOTA]
-		|| REISERFS_SB(s)->s_qf_names[GRPQUOTA])) {
+	if (!REISERFS_SB(s)->s_jquota_fmt && !*qfmt
+	    && (qf_names[USRQUOTA] || qf_names[GRPQUOTA])) {
 		reiserfs_warning(s,
 				 "reiserfs_parse_options: journaled quota format not specified.");
 		return 0;
@@ -1130,6 +1142,21 @@ static void handle_attrs(struct super_block *s)
 	}
 }
 
+#ifdef CONFIG_QUOTA
+static void handle_quota_files(struct super_block *s, char **qf_names,
+			       unsigned int *qfmt)
+{
+	int i;
+
+	for (i = 0; i < MAXQUOTAS; i++) {
+		if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i])
+			kfree(REISERFS_SB(s)->s_qf_names[i]);
+		REISERFS_SB(s)->s_qf_names[i] = qf_names[i];
+	}
+	REISERFS_SB(s)->s_jquota_fmt = *qfmt;
+}
+#endif
+
 static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
 {
 	struct reiserfs_super_block *rs;
@@ -1141,23 +1168,30 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
 	struct reiserfs_journal *journal = SB_JOURNAL(s);
 	char *new_opts = kstrdup(arg, GFP_KERNEL);
 	int err;
+	char *qf_names[MAXQUOTAS];
+	unsigned int qfmt = 0;
 #ifdef CONFIG_QUOTA
 	int i;
+
+	memcpy(qf_names, REISERFS_SB(s)->s_qf_names, sizeof(qf_names));
 #endif
 
 	rs = SB_DISK_SUPER_BLOCK(s);
 
 	if (!reiserfs_parse_options
-	    (s, arg, &mount_options, &blocks, NULL, &commit_max_age)) {
+	    (s, arg, &mount_options, &blocks, NULL, &commit_max_age,
+	    qf_names, &qfmt)) {
 #ifdef CONFIG_QUOTA
-		for (i = 0; i < MAXQUOTAS; i++) {
-			kfree(REISERFS_SB(s)->s_qf_names[i]);
-			REISERFS_SB(s)->s_qf_names[i] = NULL;
-		}
+		for (i = 0; i < MAXQUOTAS; i++)
+			if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i])
+				kfree(qf_names[i]);
 #endif
 		err = -EINVAL;
 		goto out_err;
 	}
+#ifdef CONFIG_QUOTA
+	handle_quota_files(s, qf_names, &qfmt);
+#endif
 
 	handle_attrs(s);
 
@@ -1570,6 +1604,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 	char *jdev_name;
 	struct reiserfs_sb_info *sbi;
 	int errval = -EINVAL;
+	char *qf_names[MAXQUOTAS] = {};
+	unsigned int qfmt = 0;
 
 	save_mount_options(s, data);
 
@@ -1597,9 +1633,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 	jdev_name = NULL;
 	if (reiserfs_parse_options
 	    (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
-	     &commit_max_age) == 0) {
+	     &commit_max_age, qf_names, &qfmt) == 0) {
 		goto error;
 	}
+#ifdef CONFIG_QUOTA
+	handle_quota_files(s, qf_names, &qfmt);
+#endif
 
 	if (blocks) {
 		SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option "
@@ -1819,7 +1858,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 
 	return (0);
 
-      error:
+error:
 	if (jinit_done) {	/* kill the commit thread, free journal ram */
 		journal_release_error(NULL, s);
 	}
@@ -1830,10 +1869,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 #ifdef CONFIG_QUOTA
 	{
 		int j;
-		for (j = 0; j < MAXQUOTAS; j++) {
-			kfree(sbi->s_qf_names[j]);
-			sbi->s_qf_names[j] = NULL;
-		}
+		for (j = 0; j < MAXQUOTAS; j++)
+			kfree(qf_names[j]);
 	}
 #endif
 	kfree(sbi);
Signature · 1 line
1.5.2.4
#10 lore raw

Re: [PATCH] quota: Add a convenience macro for filesystems

In reply to Jan Kara
Quoted 3 lines · On Wed, 30 Apr 2008 17:06:18 +0200 Jan Kara <[email protected]> wrote:

Note that it cannot be an inline function because we don't have struct super_block prototype...

lame excuse ;)

Quoted 9 lines
---
 include/linux/quota.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/quota.h +0 -0
index 52e49dc..dcddfb2 100644

include/linux/quota.h struct quota_info { · line 354

Quoted 8 lines
include/linux/quota.h +3 -0
@@ -347,6 +347,9 @@ struct quota_info {
 	((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
 			      (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
 
+#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
+				  sb_has_quota_suspended(sb, GRPQUOTA))
+
 int register_quota_format(struct quota_format_type *fmt);
 void unregister_quota_format(struct quota_format_type *fmt);

Here's a fun exercise:

	sb = sb_orig;
	sb_any_quota_suspended(sb++);
	printk("%d\n", sb - sb_orig);

afaict this will print 44 or thereabouts.

ho hum.

author reviewer
#11 lore raw

Re: [PATCH] quota: Add a convenience macro for filesystems

Quoted 8 lines · Andrew Morton
Quoted 3 lines · On Wed, 30 Apr 2008 17:06:18 +0200 Jan Kara <[email protected]> wrote:

Note that it cannot be an inline function because we don't have struct super_block prototype...

lame excuse ;)

Well, yes but since fs.h includes quota.h to be able to define struct
super_block (needs at least MAXQUOTAS constant) this is kind of chicken and egg problem. Splitting quota.h into two files is probably the way to go... I'll include it to my quotaops.h and quota.h cleanups I'm slowly working on.

Quoted 21 lines
Quoted 9 lines
---
 include/linux/quota.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/quota.h +0 -0
index 52e49dc..dcddfb2 100644

include/linux/quota.h struct quota_info { · line 354

Quoted 8 lines
include/linux/quota.h +3 -0
@@ -347,6 +347,9 @@ struct quota_info {
 	((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
 			      (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
 
+#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
+				  sb_has_quota_suspended(sb, GRPQUOTA))
+
 int register_quota_format(struct quota_format_type *fmt);
 void unregister_quota_format(struct quota_format_type *fmt);

Here's a fun exercise:

Quoted 7 lines
	sb = sb_orig;
	sb_any_quota_suspended(sb++);
	printk("%d\n", sb - sb_orig);

afaict this will print 44 or thereabouts.

ho hum.

;)

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#12 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

In reply to Jan Kara

fs/ext3/super.c static int parse_options (char *options, struct super_block *sb, · line 1023

Quoted 2 lines · On Wed, 30 Apr 2008 17:06:15 +0200 Jan Kara <[email protected]> wrote:
fs/ext3/super.c +1 -1
-					"EXT3-fs: Cannot change journalled "
+					"EXT3-fs: Cannot change journaled "

hrm, who said?

Dictionary.com recognises neither.

google(journalled) = 520,000
google(journaled) = 652,000

akpm:/usr/src/25> grep journalled fs/ext3/*.c|wc -l 17
akpm:/usr/src/25> grep journaled fs/ext3/*.c|wc -l 6

#13 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

Quoted 7 lines · On Wed, 30 Apr 2008 10:43:30 -0700 Andrew Morton <[email protected]>…

fs/ext3/super.c static int parse_options (char *options, struct super_block *sb, · line 1023

Quoted 2 lines · On Wed, 30 Apr 2008 17:06:15 +0200 Jan Kara <[email protected]> wrote:
fs/ext3/super.c +1 -1
-					"EXT3-fs: Cannot change journalled "
+					"EXT3-fs: Cannot change journaled "

hrm, who said?

This has come up several times before so I thought it might be time to finally dig to the bottom of the pile and end it forever.

I put on my library hat and went for a dig: the verb is in fact "to journalize", which according to the OED means

"enter (notes or information) in a journal"

Journal itself is strictly a noun. Thus in English it would be correct for a file system to have a journal (from the latin diurnalis if anyone cares) but it would appear that it is a journalizing file system.

The American dictionaries appear to agree with this viewpoint.

If we regard "journalizing" as incorrect then the natural way to end the word would be -lled for British English and -led would certainly sound and feel wrong. Indeed the search for the OED turns journalled into journal when guessing near words but refuses to consider journaled. Our existing policy is not to mess with US v UK v AU v CA v .. spelling and that is probably wise.

A search of the ACM literature finds "journalized", "journalled" and "journaled" are all in use for this operation.

I would submit the correct patch is to change the words to journalizing and journalized. That would put Linux in agreement with the dictionary, avoid US v UK meaning differences and not pose a problem linguistically as all forms are currently in use.

Alan

#14 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

Quoted 32 lines · Alan Cox
Quoted 7 lines · On Wed, 30 Apr 2008 10:43:30 -0700 Andrew Morton <[email protected]>…

fs/ext3/super.c static int parse_options (char *options, struct super_block *sb, · line 1023

Quoted 2 lines · On Wed, 30 Apr 2008 17:06:15 +0200 Jan Kara <[email protected]> wrote:
fs/ext3/super.c +1 -1
-					"EXT3-fs: Cannot change journalled "
+					"EXT3-fs: Cannot change journaled "

hrm, who said?

This has come up several times before so I thought it might be time to finally dig to the bottom of the pile and end it forever.

I put on my library hat and went for a dig: the verb is in fact "to journalize", which according to the OED means

"enter (notes or information) in a journal"

Journal itself is strictly a noun. Thus in English it would be correct for a file system to have a journal (from the latin diurnalis if anyone cares) but it would appear that it is a journalizing file system.

The American dictionaries appear to agree with this viewpoint.

If we regard "journalizing" as incorrect then the natural way to end the word would be -lled for British English and -led would certainly sound and feel wrong. Indeed the search for the OED turns journalled into journal when guessing near words but refuses to consider journaled. Our existing policy is not to mess with US v UK v AU v CA v .. spelling and that is probably wise.

Quoted 2 lines

A search of the ACM literature finds "journalized", "journalled" and "journaled" are all in use for this operation.

I hate to get into these discussions, but I've used "journaled" a lot, so I feel I should chime in.

Maybe it's different in the UK, but I've always understood that if the accent is not on the last syllable, then you do not double the final
vowel: offer, offered. So if we accept the use of "journal" as a verb, "journaled" would be correct.

Since it's not a real word, I'd be happy not to make a big deal out of it and accept either, so I think we're in agreement.

Quoted 4 lines

I would submit the correct patch is to change the words to journalizing and journalized. That would put Linux in agreement with the dictionary, avoid US v UK meaning differences and not pose a problem linguistically as all forms are currently in use.

That would probably be more correct, but the use of "journal" as a verb has really gotten ingrained in file system developers brains. I personally haven't heard or used "journalized" and it would take some getting used to.

Shaggy

P.S. Evolution's spell-checker doesn't like "journalize" either, but I trust that it's correct.

Signature · 2 lines
David Kleikamp
IBM Linux Technology Center
#15 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

Quoted 5 lines
Quoted 2 lines

A search of the ACM literature finds "journalized", "journalled" and "journaled" are all in use for this operation.

I hate to get into these discussions, but I've used "journaled" a lot, so I feel I should chime in.

I noticed and IBM cannot even agree internally 8)

"Tivoli Storage Manager Journal Based Backup troubleshooting techniques
and solutions to common problems seen with journalized backups and the journal database. This is from a 2005_November_07 Support Technical Exchange Web seminar presented by TSM Support staff"

"IBM Journaled File System (JFS)"

Quoted 4 lines

That would probably be more correct, but the use of "journal" as a verb has really gotten ingrained in file system developers brains. I personally haven't heard or used "journalized" and it would take some getting used to.

Mandrake use Journalized File System in various press articles. Mac people seem to like journalized too and google shows it used in various reviews and articles.

I think I'm going to follow this up with the professional bodies and see if there is an opinion because either the computing world needs to agree on a proper English name, or they need to agree on a new one and talk to the dictionary people about it.

Alan

#16 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

Quoted 6 lines · Alan Cox
Quoted 5 lines
Quoted 2 lines

A search of the ACM literature finds "journalized", "journalled" and "journaled" are all in use for this operation.

I hate to get into these discussions, but I've used "journaled" a lot, so I feel I should chime in.

Quoted 8 lines

I noticed and IBM cannot even agree internally 8)

"Tivoli Storage Manager Journal Based Backup troubleshooting techniques
and solutions to common problems seen with journalized backups and the journal database. This is from a 2005_November_07 Support Technical Exchange Web seminar presented by TSM Support staff"

"IBM Journaled File System (JFS)"

IBM's big. What can I say? :-)

Quoted 8 lines
Quoted 4 lines

That would probably be more correct, but the use of "journal" as a verb has really gotten ingrained in file system developers brains. I personally haven't heard or used "journalized" and it would take some getting used to.

Mandrake use Journalized File System in various press articles. Mac people seem to like journalized too and google shows it used in various reviews and articles.

I guess it's more common that I thought.

Quoted 4 lines

I think I'm going to follow this up with the professional bodies and see if there is an opinion because either the computing world needs to agree on a proper English name, or they need to agree on a new one and talk to the dictionary people about it.

If there's some kind of consensus, I don't have strong feelings either way.

Signature · 2 lines
David Kleikamp
IBM Linux Technology Center
#17 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

Quoted 7 lines
Quoted 4 lines

I think I'm going to follow this up with the professional bodies and see if there is an opinion because either the computing world needs to agree on a proper English name, or they need to agree on a new one and talk to the dictionary people about it.

If there's some kind of consensus, I don't have strong feelings either way.

BCS: "BCS use the OED as the final arbiter, without the zeds though...so journalise is what we'd use if we absolutely had to."

I don't know if anyone has the right ACM contacts to find out what the other big professional body thinks ?

Alan

#18 lore raw

RE: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

In reply to Alan Cox

Then again, I would consider journalize to be the US version of journalise

Quoted 37 lines

Date: Thu, 1 May 2008 00:20:18 +0100
From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

Quoted 5 lines
Quoted 2 lines

A search of the ACM literature finds "journalized", "journalled" and "journaled" are all in use for this operation.

I hate to get into these discussions, but I've used "journaled" a lot, so I feel I should chime in.

I noticed and IBM cannot even agree internally 8)

"Tivoli Storage Manager Journal Based Backup troubleshooting techniques and solutions to common problems seen with journalized backups and the journal database. This is from a 2005_November_07 Support Technical Exchange Web seminar presented by TSM Support staff"

"IBM Journaled File System (JFS)"

Quoted 4 lines

That would probably be more correct, but the use of "journal" as a verb has really gotten ingrained in file system developers brains. I personally haven't heard or used "journalized" and it would take some getting used to.

Mandrake use Journalized File System in various press articles. Mac people seem to like journalized too and google shows it used in various reviews and articles.

I think I'm going to follow this up with the professional bodies and see if there is an opinion because either the computing world needs to agree on a proper English name, or they need to agree on a new one and talk to the dictionary people about it.

Quoted 5 lines

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_________________________________________________________________
Windows Live Spaces – your life, your Space. Click here to find out more.
http://get.live.com/spaces/overview--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#19 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

In reply to Dave Kleikamp
Quoted 7 lines · Dave Kleikamp

I hate to get into these discussions, but I've used "journaled" a lot,
so I feel I should chime in.

Maybe it's different in the UK, but I've always understood that if the accent is not on the last syllable, then you do not double the final
vowel: offer, offered. So if we accept the use of "journal" as a verb, "journaled" would be correct.

So I have been taught as well. Merriam-Webster says:

The word you've entered isn't in the dictionary. Click on a spelling suggestion below or try again using the search bar above. Suggestions for journalled:

     1. journalese             2. journalized
     3. journalize             4. journals
     5. journalizer            6. journeyed
     7. journal                8. journal box
     9. Journalist            10. julienned
    11. junketed              12. generally
    13. generals              14. journaleses
    15. Journalism            16. General
    17. gillnetted            18. gingered
    19. journalizes           20. gendered

I'd suggest using neither M-W or OED as sole references and accept spellings from both. Past experience has shown me that this is one area where there will *never* be consensus.

-sb

author reviewer
#20 lore raw

Re: [PATCH] ext3: Fix typos in messages and comments (journalled -> journaled)

In reply to Andrew Morton
Quoted 8 lines · Andrew Morton

fs/ext3/super.c static int parse_options (char *options, struct super_block *sb, · line 1023

Quoted 2 lines · On Wed, 30 Apr 2008 17:06:15 +0200 Jan Kara <[email protected]> wrote:
fs/ext3/super.c +1 -1
-					"EXT3-fs: Cannot change journalled "
+					"EXT3-fs: Cannot change journaled "

hrm, who said?

Quoted 4 lines

Dictionary.com recognises neither.

google(journalled) = 520,000
google(journaled) = 652,000

google.cz gives like 250k vs 519k, interesting. Anyway, I'm happy to
leave the decision on the proper spelling of the verb to people with better English skills ;).

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR