Skip to contentSkip to conversation

ext4: fix __ext4_xattr_set_credits()

PATCH In review Tahsin Erdogan 3 participants 3 messages Jun 28, 2017 – Jul 4, 2017 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: fix __ext4_xattr_set_credits()

__ext4_xattr_set_credits() calculates journal credits needed for a set xattr operation. Currently, credits needed for quota updates are added only if ea_inode feature is enabled which is wrong. Fix this by moving quota related additions to above ea_inode feature check.

Fixes 74c5bfa651af ("ext4: xattr inode deduplication")
---
 fs/ext4/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext4/xattr.c +3 -2
index ce12c3fb7e59..062756b4e6d8 100644
@@ -845,6 +845,9 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
 	 */
 	credits = 5;
 
+	/* Quota updates. */
+	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
+
 	/* We are done if ea_inode feature is not enabled. */
 	if (!ext4_has_feature_ea_inode(sb))
 		return credits;
@@ -878,9 +881,6 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
 	/* Block bitmap and group descriptor updates for each block. */
 	credits += blocks * 2;
 
-	/* Quota updates. */
-	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tahsin Erdogan

__ext4_xattr_set_credits() calculates journal credits needed for a set xattr operation. Currently, credits needed for quota updates are added only if ea_inode feature is enabled which is wrong. Fix this by moving quota related additions to above ea_inode feature check.

Fixes 74c5bfa651af ("ext4: xattr inode deduplication")
Quoted 29 lines

---
fs/ext4/xattr.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext4/xattr.c +3 -4
index ce12c3fb7e59..062756b4e6d8 100644
@@ -845,6 +845,9 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
 	 */
 	credits = 5;
 
+	/* Quota updates. */
+	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
+
 	/* We are done if ea_inode feature is not enabled. */
 	if (!ext4_has_feature_ea_inode(sb))
 		return credits;
@@ -878,9 +881,6 @@ static int __ext4_xattr_set_credits(struct super_block *sb,
 	/* Block bitmap and group descriptor updates for each block. */
 	credits += blocks * 2;
 
-	/* Quota updates. */
-	credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(sb);
-
 	/* We may need to clone the existing xattr block in which case we need
 	 * to increment ref counts for existing ea_inodes referenced by it.
 	 */
--
Quoted 2 lines

2.13.2.725.g09c95d1e9-goog

Cheers, Andreas

maintainer
#2 lore raw
In reply to Tahsin Erdogan
Quoted 8 lines · Tahsin Erdogan

__ext4_xattr_set_credits() calculates journal credits needed for a set xattr operation. Currently, credits needed for quota updates are added only if ea_inode feature is enabled which is wrong. Fix this by moving quota related additions to above ea_inode feature check.

Fixes 74c5bfa651af ("ext4: xattr inode deduplication")

Thanks, I've folded this into the xattr_inode_deduplication patch.

- Ted