[Ocfs2-tools-devel] [PATCH] fsck.ocfs2: Update xattr tree if there is a change.

Tao Ma tao.ma at oracle.com
Thu Nov 26 22:29:51 PST 2009


When we check the xattr tree, we check the ocfs2_extent_list first and
then every ocfs2_extent_rec one by one.
So we'd better write the tree if there is really a change so that
the later ocfs2_xattr_get_rec can get the update tree information.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
Cc: Tiger Yang <tiger.yang at oracle.com>
---
 fsck.ocfs2/xattr.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/fsck.ocfs2/xattr.c b/fsck.ocfs2/xattr.c
index 98d81f7..e1bad59 100644
--- a/fsck.ocfs2/xattr.c
+++ b/fsck.ocfs2/xattr.c
@@ -607,6 +607,21 @@ static errcode_t o2fsck_check_xattr_index_block(o2fsck_state *ost,
 	if (ret)
 		return ret;
 
+	/*
+	 * We need to write the changed xattr tree first so that the following
+	 * ocfs2_xattr_get_rec can get the updated information.
+	 */
+	if (*changed) {
+		ret = ocfs2_write_xattr_block(ost->ost_fs,
+					      di->i_xattr_loc, (char *)xb);
+		if (ret) {
+			com_err(whoami, ret, "while writing root block of"
+				" extended attributes ");
+			return ret;
+		}
+	}
+
+
 	while (name_hash > 0) {
 		ret = ocfs2_xattr_get_rec(ost->ost_fs, xb, name_hash, &p_blkno,
 					  &e_cpos, &num_clusters);
-- 
1.6.2.rc2.16.gf474c




More information about the Ocfs2-tools-devel mailing list