Skip to content
/ linux Public

Commit 3bdc376

Browse files
zhaohemSasha Levin
authored andcommitted
ocfs2: fix reflink preserve cleanup issue
[ Upstream commit 5138c93 ] commit c06c303 ("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 c06c303 is also a bug fix for 0fe9b66. Link: https://lkml.kernel.org/r/20251210015725.8409-2-heming.zhao@suse.com Fixes: 0fe9b66 ("ocfs2: Add preserve to reflink.") Signed-off-by: Heming Zhao <heming.zhao@suse.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Joseph Qi <jiangqi903@gmail.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Jun Piao <piaojun@huawei.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e5a732b commit 3bdc376

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/ocfs2/xattr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6364,6 +6364,10 @@ static int ocfs2_reflink_xattr_header(handle_t *handle,
63646364
(void *)last - (void *)xe);
63656365
memset(last, 0,
63666366
sizeof(struct ocfs2_xattr_entry));
6367+
last = &new_xh->xh_entries[le16_to_cpu(new_xh->xh_count)] - 1;
6368+
} else {
6369+
memset(xe, 0, sizeof(struct ocfs2_xattr_entry));
6370+
last = NULL;
63676371
}
63686372

63696373
/*

0 commit comments

Comments
 (0)