From: Heming Zhao <heming.zhao@suse.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Linus Torvalds <torvalds@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Dmitry Antipov <dmantipov@yandex.ru>,
Mark Fasheh <mark@fasheh.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
mm-commits@vger.kernel.org,
Pasha Tatashin <pasha.tatashin@soleen.com>
Subject: Re: [GIT PULL] non-MM updates for 6.19-rc1
Date: Mon, 8 Dec 2025 15:58:44 +0800 [thread overview]
Message-ID: <nrgonfemkkz2bnwfkpzycfbz3luspjm65dakyjt4e4nuawklbw@cw3jqnedbyjf> (raw)
In-Reply-To: <f72b8316-ddae-466e-a72d-0df9960d6c82@linux.alibaba.com>
On Mon, Dec 08, 2025 at 12:01:09PM +0800, Joseph Qi wrote:
>
>
> On 2025/12/8 10:21, Linus Torvalds wrote:
> > On Mon, 8 Dec 2025 at 10:11, Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
> >>
> >> On 2025/12/7 07:40, Linus Torvalds wrote:
> >>>
> >>> See commit c06c303832ec ("ocfs2: fix xattr array entry __counted_by
> >>> error") which simply makes the 'last' pointer point to the actual last
> >>> entry, rather than point to one _past_ the last entry.
> >>
> >> It looks fine to me.
> >> Sorry for the noise and thank you for pointing out my mistake.
> >
> > Note that if my fix is correct, the mistake is most certainly not
> > yours and goes all the way back to 2009, and commit 0fe9b66c65f3
> > ("ocfs2: Add preserve to reflink").
> >
> > But I would really love to have somebody who knows that code go
> > through it, and see if my fix actually is the right thing to do.
> >
>
> Go through the code logic again, maybe I'm wrong before.
>
> Take the following flow for example:
>
> ocfs2_reflink_xattr_in_block
> ocfs2_create_empty_xattr_block
> ocfs2_create_xattr_block
> memset(xblk, 0, inode->i_sb->s_blocksize);
> ocfs2_reflink_xattr_block
> ocfs2_reflink_xattr_header
In ocfs2_reflink_xattr_block(), the call to memcpy(new_blk_bh->.., blk_bh->.., ...)
occurs before ocfs2_reflink_xattr_header(). Therefore, the new_xh->xh_count is
very likely not ZERO.
>
> It seems now new_xh->xh_count is 0. That's means, it is trying to add a
> new entry and here 'last' is pointing the next free entry.
> If so, the original code seems right.
>
> Heming, could you please verify this? I'm not familiar with this logic...
>
> Thanks,
> Joseph
In ocfs2_reflink_xattrs(), when preserve_security is false, the function sets
'args.xattr_reflinked'. IMUC, it means that if users want to preserve security
xattr items, the args.xattr_reflinked is NULL, this then results in
ocfs2_reflink_xattr_header() not executing the cleanup jobs, (in the code area
defined by "if (args->xattr_reflinked && !args->xattr_reflinked(xe))").
Regarding the clean jobs:
- by default, it only handles three types:
OCFS2_XATTR_INDEX_[SECURITY|POSIX_ACL_ACCESS|POSIX_ACL_DEFAULT]
- it cleans the first item and shifts forward the remaining items.
It seems Linus' patch does not handle all cases. If new_xh->xh_count is 1,
le16_add_cpu(&new_xh->xh_count, -1) makes it to 0, and it will miss the cleanup
job.
Thanks,
Heming
next prev parent reply other threads:[~2025-12-08 7:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 19:15 Andrew Morton
2025-12-06 23:33 ` pr-tracker-bot
2025-12-06 23:40 ` Linus Torvalds
2025-12-08 1:11 ` Joseph Qi
2025-12-08 2:21 ` Linus Torvalds
2025-12-08 4:01 ` Joseph Qi
2025-12-08 4:08 ` Linus Torvalds
2025-12-08 7:58 ` Heming Zhao [this message]
2025-12-08 19:07 ` Mark Fasheh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nrgonfemkkz2bnwfkpzycfbz3luspjm65dakyjt4e4nuawklbw@cw3jqnedbyjf \
--to=heming.zhao@suse.com \
--cc=akpm@linux-foundation.org \
--cc=dmantipov@yandex.ru \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark@fasheh.com \
--cc=mm-commits@vger.kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=torvalds@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox