

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/ext2/super.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff -puN fs/ext2/super.c~fix-of-quota-deadlock-on-pagelock-ext2-tweaks fs/ext2/super.c
--- 25/fs/ext2/super.c~fix-of-quota-deadlock-on-pagelock-ext2-tweaks	2004-11-30 01:23:16.526254736 -0800
+++ 25-akpm/fs/ext2/super.c	2004-11-30 01:23:16.530254128 -0800
@@ -1019,10 +1019,13 @@ static ssize_t ext2_quota_read(struct su
 			       size_t len, loff_t off)
 {
 	struct inode *inode = sb_dqopt(sb)->files[type];
-	unsigned long blk = off >> EXT2_BLOCK_SIZE_BITS(sb);
-	int err = 0, offset = off & (sb->s_blocksize - 1), tocopy;
+	sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb);
+	int err = 0;
+	int offset = off & (sb->s_blocksize - 1);
+	int tocopy;
 	size_t toread;
-	struct buffer_head tmp_bh, *bh;
+	struct buffer_head tmp_bh;
+	struct buffer_head *bh;
 	loff_t i_size = i_size_read(inode);
 
 	if (off > i_size)
@@ -1060,10 +1063,13 @@ static ssize_t ext2_quota_write(struct s
 				const char *data, size_t len, loff_t off)
 {
 	struct inode *inode = sb_dqopt(sb)->files[type];
-	unsigned long blk = off >> EXT2_BLOCK_SIZE_BITS(sb);
-	int err = 0, offset = off & (sb->s_blocksize - 1), tocopy;
+	sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb);
+	int err = 0;
+	int offset = off & (sb->s_blocksize - 1);
+	int tocopy;
 	size_t towrite = len;
-	struct buffer_head tmp_bh, *bh;
+	struct buffer_head tmp_bh;
+	struct buffer_head *bh;
 
 	down(&inode->i_sem);
 	while (towrite > 0) {
@@ -1082,9 +1088,12 @@ static ssize_t ext2_quota_write(struct s
 			err = -EIO;
 			goto out;
 		}
+		lock_buffer(bh);
 		memcpy(bh->b_data+offset, data, tocopy);
+		flush_dcache_page(bh->b_page);
 		set_buffer_uptodate(bh);
 		mark_buffer_dirty(bh);
+		unlock_buffer(bh);
 		brelse(bh);
 		offset = 0;
 		towrite -= tocopy;
_
