From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Nick Karaolidis <nick@karaolidis.com>
Cc: Christian Brauner <brauner@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Mateusz Guzik <mjguzik@gmail.com>,
<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] fs: rotate inodes whose page cache could not be dropped
Date: Mon, 19 Oct 2026 20:48:24 +0800 [thread overview]
Message-ID: <db764681-95cd-7c15-4b04-1372018fc93e@huawei.com> (raw)
In-Reply-To: <qNyuimLVAkP0k7luIlbuqeg7Co3gXnyrzZ2fIuFjRZiKon2IaylrG1-_tkSRE_cWyOuq6eIzU6O12OvRg8J-ZszqHBaxE0XL2uYVhQ08MS8=@karaolidis.com>
在 2026/10/19 16:50, Nick Karaolidis 写道:
> On Saturday, October 17th, 2026 at 8:43 AM, Zhihao Cheng <chengzhihao1@huawei.com> wrote:
>
>> Hi Nikolaos,
>> I find a possible BUG_ON if this patch applied, details shown as:
>> P1 P2
>> prune_icache_sb
>> lock(lru->lock)
>> inode_lru_isolate
>> if (!mapping_empty(&inode->i_data))
>> unlock(lru->lock)
>> spin_lock(&inode->i_lock)
>> inode_state_set(inode, I_REFERENCED)
>> inode_unpin_lru_isolating
>> spin_unlock(&inode->i_lock)
>> unlink
>> iget_locked // find_inode_fast gets the inode
>> iput
>> iput_final
>> drop = 1
>> evict
>> BUG_ON(inode_state_read_once(inode) !=
>> (I_FREEING | I_CLEAR)) // inode state with I_REFERENCED
>>
>> Could that be possible?
>
> Hi Zhihao,
>
> Thanks for looking at this. I don't think that BUG_ON can trigger.
>
> - The patch sets I_REFERENCED in the same i_lock section that clears
> I_LRU_ISOLATING, and evict() waits in inode_wait_for_lru_isolating()
> before calling ->evict_inode(), so the walker can only set the flag
> before the filesystem's eviction runs.
>
> - clear_inode(), which every ->evict_inode() calls, sets i_state to
> I_FREEING | I_CLEAR.
OK, I missunderstand the realization of 'inode_state_assign_raw(inode,
I_FREEING | I_CLEAR)' in the clear_inode().
>
> - Evicting an inode that has I_REFERENCED set already happens.
> iput_final() sets it through __inode_lru_list_add(inode, true) when
> the inode is already on the LRU.
>
> Did I miss a path that checks i_state before clear_inode()?
>
> Thanks,
> Nikolaos
>
> .
>
next prev parent reply other threads:[~2026-10-19 12:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 10:25 Nikolaos Karaolidis
2026-10-17 7:43 ` Zhihao Cheng
2026-10-19 8:50 ` Nick Karaolidis
2026-10-19 12:48 ` Zhihao Cheng [this message]
2026-10-19 11:09 ` Jan Kara
2026-10-19 12:48 ` Zhihao Cheng
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=db764681-95cd-7c15-4b04-1372018fc93e@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mjguzik@gmail.com \
--cc=nick@karaolidis.com \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®