Skip to contentSkip to conversation

ocfs2: fix BUG_ON issue in ocfs2_set_new_buffer_uptodate

PATCH New Tiger Yang 2 participants 2 messages Nov 9, 2012 OCFS2

lore
Share & tools
lore

Tiger Yang

author
#0 lore raw

PATCH 1/1 ocfs2: fix BUG_ON issue in ocfs2_set_new_buffer_uptodate

If buffer already in cache, call ocfs2_init_xattr_bucket will cause BUG_ON in ocfs2_set_new_buffer_uptodate. The check of ocfs2_buffer_uptodate in ocfs2_init_xattr_bucket wouldn't help this. So replace it with ocfs2_read_xattr_bucket to initialize the bucket to avoid this issue.

---
 fs/ocfs2/xattr.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
fs/ocfs2/xattr.c +2 -10
index dce35dd..0085261 100644
@@ -4640,11 +4640,7 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
 		goto out;
 	}
 
-	/*
-	 * Even if !new_bucket_head, we're overwriting t_bucket.  Thus,
-	 * there's no need to read it.
-	 */
-	ret = ocfs2_init_xattr_bucket(t_bucket, new_blk);
+	ret = ocfs2_read_xattr_bucket(t_bucket, new_blk);
 	if (ret) {
 		mlog_errno(ret);
 		goto out;
@@ -4806,11 +4802,7 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode,
 	if (ret)
 		goto out;
 
-	/*
-	 * Even if !t_is_new, we're overwriting t_bucket.  Thus,
-	 * there's no need to read it.
-	 */
-	ret = ocfs2_init_xattr_bucket(t_bucket, t_blkno);
+	ret = ocfs2_read_xattr_bucket(t_bucket, t_blkno);
 	if (ret)
 		goto out;
 
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 1/1 ocfs2: fix BUG_ON issue in ocfs2_set_new_buffer_uptodate

Quoted 30 lines · Tiger Yang

If buffer already in cache, call ocfs2_init_xattr_bucket will cause BUG_ON in ocfs2_set_new_buffer_uptodate. The check of ocfs2_buffer_uptodate in ocfs2_init_xattr_bucket wouldn't help this. So replace it with ocfs2_read_xattr_bucket to initialize the bucket to avoid this issue.

---
 fs/ocfs2/xattr.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
fs/ocfs2/xattr.c +1 -5
index dce35dd..0085261 100644
@@ -4640,11 +4640,7 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
 		goto out;
 	}
 
-	/*
-	 * Even if !new_bucket_head, we're overwriting t_bucket.  Thus,
-	 * there's no need to read it.
-	 */
-	ret = ocfs2_init_xattr_bucket(t_bucket, new_blk);
+	ret = ocfs2_read_xattr_bucket(t_bucket, new_blk);
 	if (ret) {
 		mlog_errno(ret);
 		goto out;
@@ -4806,11 +4802,7 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode,
 	if (ret)
 		goto out;

fs/ocfs2/xattr.c static int ocfs2_cp_xattr_bucket(struct inode *inode, · line 4808

Quoted 10 lines
fs/ocfs2/xattr.c +1 -5
 
-	/*
-	 * Even if !t_is_new, we're overwriting t_bucket.  Thus,
-	 * there's no need to read it.
-	 */
-	ret = ocfs2_init_xattr_bucket(t_bucket, t_blkno);
+	ret = ocfs2_read_xattr_bucket(t_bucket, t_blkno);
 	if (ret)
 		goto out;
 

Looks good to me.
You can add a Reviewed-by: Jie Liu <[email protected]>

Thanks,
-Jeff