[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251210015058.8327-2-heming.zhao@suse.com>
Date: Wed, 10 Dec 2025 09:50:48 +0800
From: Heming Zhao <heming.zhao@...e.com>
To: joseph.qi@...ux.alibaba.com,
mark@...heh.com,
jlbec@...lplan.org
Cc: Heming Zhao <heming.zhao@...e.com>,
ocfs2-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] ocfs2: fix reflink preserve cleanup issue
commit c06c303832ec ("ocfs2: fix xattr array entry __counted_by error")
doesn't handle all cases and the cleanup job for preserved xattr
entries still has bug:
- the 'last' pointer should be shifted by one unit after cleanup
an array entry.
- current code logic doesn't cleanup the first entry when xh_count is 1.
Note, commit c06c303832ec is also a bug fix for 0fe9b66c65f3.
Fixes: 0fe9b66c65f3 ("ocfs2: Add preserve to reflink.")
Signed-off-by: Heming Zhao <heming.zhao@...e.com>
---
fs/ocfs2/xattr.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index dc1761e84814..31d023f9e2ed 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -6364,6 +6364,10 @@ static int ocfs2_reflink_xattr_header(handle_t *handle,
(void *)last - (void *)xe);
memset(last, 0,
sizeof(struct ocfs2_xattr_entry));
+ last = &new_xh->xh_entries[le16_to_cpu(new_xh->xh_count)] - 1;
+ } else {
+ memset(xe, 0, sizeof(struct ocfs2_xattr_entry));
+ last = NULL;
}
/*
--
2.43.0
Powered by blists - more mailing lists