From: Al Viro <viro@zeniv.linux.org.uk>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>, Jan Kara <jack@suse.cz>
Subject: Re: fs/dcache.c:2788:24-43: WARNING: atomic_dec_and_test variation before object free at line 2789.
Date: Wed, 28 Jan 2026 04:55:40 +0000 [thread overview]
Message-ID: <20260128045540.GR3183987@ZenIV> (raw)
In-Reply-To: <202601280811.uLPBZWvT-lkp@intel.com>
On Wed, Jan 28, 2026 at 08:19:52AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 1f97d9dcf53649c41c33227b345a36902cbb08ad
> commit: 95a4ccbbe596b45264af5e3a019cb920c05ccffd dissolve external_name.u into separate members
> date: 1 year ago
> config: m68k-randconfig-r064-20260128 (https://download.01.org/0day-ci/archive/20260128/202601280811.uLPBZWvT-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 8.5.0
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202601280811.uLPBZWvT-lkp@intel.com/
> > 2788 if (old_name && likely(atomic_dec_and_test(&old_name->count)))
> > 2789 kfree_rcu(old_name, head);
Warning (along with the identical warnings regarding other places where
we do the same thing to the same object) is a false positive.
Each live dentry with an external name is holding a reference to
that external name; that reference is stabilized by ->d_lock of
that dentry. All changes are surrounded by bumping ->d_seq of
the same dentry. Freeing is always RCU-delayed.
There are two places where increments can happen: copy_name() and
take_dentry_name_snapshot(). In both cases dentry in question
is live - the caller must hold a reference to it. Increment of
external name's refcount can't go from 0 to 1 in either case;
the former is is under target->d_lock, which stabilizes
target->d_name.name and guarantees that refcount is at least 1.
The latter is atomic_inc_not_zero(), within the same RCU read-side
critical area as sampling ->d_seq and fetching the external name;
since freeing is RCU-delayed, the external name in question can't
get freed until we leave that scope, so memory access by
atomic_inc_not_zero() is safe.
next prev parent reply other threads:[~2026-01-28 4:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 0:19 fs/dcache.c:2788:24-43: WARNING: atomic_dec_and_test variation before object free at line 2789 kernel test robot
2026-01-28 4:55 ` Al Viro [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-02-06 19:44 kernel test robot
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=20260128045540.GR3183987@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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