Skip to content

Commit 003a660

Browse files
mjguzikbrauner
authored andcommitted
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>
1 parent 4c6b408 commit 003a660

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

fs/ext4/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ void ext4_evict_inode(struct inode *inode)
202202
* the inode. Flush worker is ignoring it because of I_FREEING flag but
203203
* we still need to remove the inode from the writeback lists.
204204
*/
205-
if (!list_empty_careful(&inode->i_io_list))
206-
inode_io_list_del(inode);
205+
inode_io_list_del(inode);
207206

208207
/*
209208
* Protect us against freezing - iput() caller didn't have to have any

fs/fs-writeback.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,13 @@ void inode_io_list_del(struct inode *inode)
13491349
{
13501350
struct bdi_writeback *wb;
13511351

1352+
/*
1353+
* FIXME: ext4 can call here from ext4_evict_inode() after evict() already
1354+
* unlinked the inode.
1355+
*/
1356+
if (list_empty_careful(&inode->i_io_list))
1357+
return;
1358+
13521359
wb = inode_to_wb_and_lock_list(inode);
13531360
spin_lock(&inode->i_lock);
13541361

fs/inode.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,7 @@ static void evict(struct inode *inode)
818818
BUG_ON(!(inode_state_read_once(inode) & I_FREEING));
819819
BUG_ON(!list_empty(&inode->i_lru));
820820

821-
if (!list_empty(&inode->i_io_list))
822-
inode_io_list_del(inode);
823-
821+
inode_io_list_del(inode);
824822
inode_sb_list_del(inode);
825823

826824
spin_lock(&inode->i_lock);

0 commit comments

Comments
 (0)