From: "Zhou, Yun" <yun.zhou@windriver.com>
To: Jan Kara <jack@suse.cz>
Cc: Mateusz Guzik <mjguzik@gmail.com>,
tytso@mit.edu, adilger.kernel@dilger.ca,
libaokun@linux.alibaba.com, ojaswin@linux.ibm.com,
ritesh.list@gmail.com, yi.zhang@huawei.com,
viro@zeniv.linux.org.uk, brauner@kernel.org,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, xiaowu.417@qq.com
Subject: Re: [PATCH v11 1/5] fs: add iput_if_not_last() helper
Date: Thu, 2 Jul 2026 22:55:31 +0800 [thread overview]
Message-ID: <12a0d660-2794-4dc0-910a-3c63155624ba@windriver.com> (raw)
In-Reply-To: <mqchxi74vrsmsitr46gtnw5w7tooj7go2tm2jadg4mktppjafc@5uplsind6ooq>
Hi Honza,
On 7/2/2026 10:29 PM, Jan Kara wrote:
>
> Hi!
>
> On Thu 02-07-26 21:35:47, Zhou, Yun wrote:
>> On 6/30/2026 7:34 PM, Jan Kara wrote:
>>> On Tue 30-06-26 11:05:50, Mateusz Guzik wrote:
>>>> On Mon, Jun 29, 2026 at 07:08:44PM +0800, Yun Zhou wrote:
>>>>> Unlike iput_not_last() which BUG_ON's if called with the last ref,
>>>>> this variant is designed to be called speculatively.
>>>>>
>>>>> Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
>>>>> Suggested-by: Jan Kara <jack@suse.cz>
>>>>> Reviewed-by: Jan Kara <jack@suse.cz>
>>>>> ---
>>>>> include/linux/fs.h | 13 +++++++++++++
>>>>> 1 file changed, 13 insertions(+)
>>>>>
>>>>> diff --git a/include/linux/fs.h b/include/linux/fs.h
>>>>> index d10897b3a1e3..04f0de78fa7a 100644
>>>>> --- a/include/linux/fs.h
>>>>> +++ b/include/linux/fs.h
>>>>> @@ -2413,6 +2413,19 @@ static inline void super_set_sysfs_name_generic(struct super_block *sb, const ch
>>>>> extern void ihold(struct inode * inode);
>>>>> extern void iput(struct inode *);
>>>>> void iput_not_last(struct inode *);
>>>>> +
>>>>> +/**
>>>>> + * iput_if_not_last - drop an inode reference only if it is not the last one
>>>>> + * @inode: inode to put
>>>>> + *
>>>>> + * Returns true if the reference was dropped, false if this was the last
>>>>> + * reference and the caller must arrange for final iput() in a safe context.
>>>>> + */
>>>>> +static inline bool __must_check iput_if_not_last(struct inode *inode)
>>>>> +{
>>>>> + return atomic_add_unless(&inode->i_count, -1, 1);
>>>>> +}
>>>>> +
>>>>
>>>> This still could assert on the count, for example:
>>>> VFS_BUG_ON_INODE(inode_state_read_once(inode) & (I_FREEING | I_CLEAR), inode);
>>>> VFS_BUG_ON_INODE(atomic_read(&inode->i_count) < 1, inode);
>>>
>>> Yes, it makes sense to be consistent with other helpers. Thanks for the
>>> idea.
>>
>> Should I wait for now, or go ahead and include the two macros mentioned
>> above in v13 as Mateusz suggested? As you know, the v12 series has been
>> fully reviewed [1] , and I'm wondering if making this change now might cause
>> any inconvenience to everyone.
>>
>> [1] https://lore.kernel.org/linux-ext4/20260630100829.1257618-1-yun.zhou@windriver.com/T/#t
>
> I think there will be no more feedback to this series. So just include this
> suggested change (keeping current Reviewed-by tags - the change is minimal)
> and submit one more version. Mention in the cover letter that there's only
> minor adjustment to this one patch, everything is reviewed and ready to be
> merged so that Ted knows.
>
> Honza
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
Okay, I'll get right on it. Thank you very much for your reply and your
strong support on this patch series.
BR,
Yun
next prev parent reply other threads:[~2026-07-02 14:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 11:08 [PATCH v11 0/5] ext4: deferred iput framework for EA inodes Yun Zhou
2026-06-29 11:08 ` [PATCH v11 1/5] fs: add iput_if_not_last() helper Yun Zhou
2026-06-30 8:53 ` Christian Brauner
2026-06-30 9:05 ` Mateusz Guzik
2026-06-30 11:34 ` Jan Kara
2026-07-02 13:35 ` Zhou, Yun
2026-07-02 14:29 ` Jan Kara
2026-07-02 14:55 ` Zhou, Yun [this message]
2026-07-02 22:41 ` Theodore Tso
2026-06-29 11:08 ` [PATCH v11 2/5] ext4: introduce ext4_put_ea_inode() for safe deferred iput Yun Zhou
2026-06-29 11:34 ` Jan Kara
2026-06-29 11:37 ` Jan Kara
2026-06-29 11:08 ` [PATCH v11 3/5] ext4: convert all EA inode iput() calls to ext4_put_ea_inode() Yun Zhou
2026-06-29 11:38 ` Jan Kara
2026-06-29 11:08 ` [PATCH v11 4/5] ext4: remove ea_inode_array mechanism in favor of ext4_put_ea_inode() Yun Zhou
2026-06-29 11:42 ` Jan Kara
2026-06-29 11:08 ` [PATCH v11 5/5] ext4: prevent deadlock from duplicate EA inode references on corrupted fs Yun Zhou
2026-06-29 11:48 ` Jan Kara
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=12a0d660-2794-4dc0-910a-3c63155624ba@windriver.com \
--to=yun.zhou@windriver.com \
--cc=adilger.kernel@dilger.ca \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=xiaowu.417@qq.com \
--cc=yi.zhang@huawei.com \
/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