
From: Andreas Gruenbacher <agruen@suse.de>

The xattr and acl code are not properly reserving credits for quotas. 
EXT3_DATA_TRANS_BLOCKS is an overestimate of the credits required including
quotas.  Make it a little more tight, and use it in the xattr and acl code
to be quota safe.



 fs/ext3/acl.c            |    4 ++--
 fs/ext3/xattr.c          |    2 +-
 include/linux/ext3_jbd.h |    7 ++++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff -puN fs/ext3/acl.c~ext3-xattr-credits-fixes fs/ext3/acl.c
--- 25/fs/ext3/acl.c~ext3-xattr-credits-fixes	2003-07-12 15:05:55.000000000 -0700
+++ 25-akpm/fs/ext3/acl.c	2003-07-12 15:05:55.000000000 -0700
@@ -425,7 +425,7 @@ ext3_acl_chmod(struct inode *inode)
 	if (!error) {
 		handle_t *handle;
 
-		handle = ext3_journal_start(inode, EXT3_XATTR_TRANS_BLOCKS);
+		handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS);
 		if (IS_ERR(handle)) {
 			error = PTR_ERR(handle);
 			ext3_std_error(inode->i_sb, error);
@@ -531,7 +531,7 @@ ext3_xattr_set_acl(struct inode *inode, 
 	} else
 		acl = NULL;
 
-	handle = ext3_journal_start(inode, EXT3_XATTR_TRANS_BLOCKS);
+	handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS);
 	if (IS_ERR(handle))
 		return PTR_ERR(handle);
 	error = ext3_set_acl(handle, inode, type, acl);
diff -puN fs/ext3/xattr.c~ext3-xattr-credits-fixes fs/ext3/xattr.c
--- 25/fs/ext3/xattr.c~ext3-xattr-credits-fixes	2003-07-12 15:05:55.000000000 -0700
+++ 25-akpm/fs/ext3/xattr.c	2003-07-12 15:05:55.000000000 -0700
@@ -875,7 +875,7 @@ ext3_xattr_set(struct inode *inode, int 
 	handle_t *handle;
 	int error, error2;
 
-	handle = ext3_journal_start(inode, EXT3_XATTR_TRANS_BLOCKS);
+	handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS);
 	if (IS_ERR(handle))
 		error = PTR_ERR(handle);
 	else
diff -puN include/linux/ext3_jbd.h~ext3-xattr-credits-fixes include/linux/ext3_jbd.h
--- 25/include/linux/ext3_jbd.h~ext3-xattr-credits-fixes	2003-07-12 15:05:55.000000000 -0700
+++ 25-akpm/include/linux/ext3_jbd.h	2003-07-12 15:05:55.000000000 -0700
@@ -30,10 +30,11 @@
 
 #define EXT3_SINGLEDATA_TRANS_BLOCKS	8U
 
-/* Extended attributes may touch two data buffers, two bitmap buffers,
- * and two group and summaries. */
+/* Extended attribute operations touch at most two data buffers,
+ * two bitmap buffers, and two group summaries, in addition to the inode
+ * and the superblock, which are already accounted for. */
 
-#define EXT3_XATTR_TRANS_BLOCKS		8
+#define EXT3_XATTR_TRANS_BLOCKS		6U
 
 /* Define the minimum size for a transaction which modifies data.  This
  * needs to take into account the fact that we may end up modifying two

_
