1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00

fs: push list presence check into inode_io_list_del()

For consistency with sb routines.

ext4 is the only consumer outside of evict(). Damage-controlling it is
outside of the scope of this cleanup.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20251103230911.516866-1-mjguzik@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Mateusz Guzik 2025-11-04 00:09:11 +01:00 committed by Christian Brauner
parent 4c6b40877b
commit 003a660730
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
3 changed files with 9 additions and 5 deletions

View File

@ -202,8 +202,7 @@ void ext4_evict_inode(struct inode *inode)
* the inode. Flush worker is ignoring it because of I_FREEING flag but
* we still need to remove the inode from the writeback lists.
*/
if (!list_empty_careful(&inode->i_io_list))
inode_io_list_del(inode);
inode_io_list_del(inode);
/*
* Protect us against freezing - iput() caller didn't have to have any

View File

@ -1349,6 +1349,13 @@ void inode_io_list_del(struct inode *inode)
{
struct bdi_writeback *wb;
/*
* FIXME: ext4 can call here from ext4_evict_inode() after evict() already
* unlinked the inode.
*/
if (list_empty_careful(&inode->i_io_list))
return;
wb = inode_to_wb_and_lock_list(inode);
spin_lock(&inode->i_lock);

View File

@ -818,9 +818,7 @@ static void evict(struct inode *inode)
BUG_ON(!(inode_state_read_once(inode) & I_FREEING));
BUG_ON(!list_empty(&inode->i_lru));
if (!list_empty(&inode->i_io_list))
inode_io_list_del(inode);
inode_io_list_del(inode);
inode_sb_list_del(inode);
spin_lock(&inode->i_lock);