diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-15 18:09:48 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-15 18:09:48 -0800 |
commit | 23dc9c755a19dea099df6ccb6dd129e24b4d5ad8 (patch) | |
tree | 1de0d12dcfd77f4146590fa9949749ff0e363119 /fs | |
parent | fe36bb8736ee9e38fa6173e1271ed8c5cf7bc907 (diff) | |
parent | 23e188a16423a6e65290abf39dd427ff047e6843 (diff) |
Merge tag 'for-6.2/writeback-2022-12-12' of git://git.kernel.dk/linux
Pull writeback updates from Jens Axboe:
- Sanity check adding freed inodes to lists (Jan)
- Removal of an old unused define (Miaohe)
* tag 'for-6.2/writeback-2022-12-12' of git://git.kernel.dk/linux:
writeback: remove obsolete macro EXPIRE_DIRTY_ATIME
writeback: Add asserts for adding freed inode to lists
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs-writeback.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 9958d4020771..6fba5a52127b 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -121,6 +121,7 @@ static bool inode_io_list_move_locked(struct inode *inode, { assert_spin_locked(&wb->list_lock); assert_spin_locked(&inode->i_lock); + WARN_ON_ONCE(inode->i_state & I_FREEING); list_move(&inode->i_io_list, head); @@ -280,6 +281,7 @@ static void inode_cgwb_move_to_attached(struct inode *inode, { assert_spin_locked(&wb->list_lock); assert_spin_locked(&inode->i_lock); + WARN_ON_ONCE(inode->i_state & I_FREEING); inode->i_state &= ~I_SYNC_QUEUED; if (wb != &wb->bdi->wb) @@ -1129,6 +1131,7 @@ static void inode_cgwb_move_to_attached(struct inode *inode, { assert_spin_locked(&wb->list_lock); assert_spin_locked(&inode->i_lock); + WARN_ON_ONCE(inode->i_state & I_FREEING); inode->i_state &= ~I_SYNC_QUEUED; list_del_init(&inode->i_io_list); @@ -1294,6 +1297,17 @@ static void redirty_tail_locked(struct inode *inode, struct bdi_writeback *wb) { assert_spin_locked(&inode->i_lock); + inode->i_state &= ~I_SYNC_QUEUED; + /* + * When the inode is being freed just don't bother with dirty list + * tracking. Flush worker will ignore this inode anyway and it will + * trigger assertions in inode_io_list_move_locked(). + */ + if (inode->i_state & I_FREEING) { + list_del_init(&inode->i_io_list); + wb_io_lists_depopulated(wb); + return; + } if (!list_empty(&wb->b_dirty)) { struct inode *tail; @@ -1302,7 +1316,6 @@ static void redirty_tail_locked(struct inode *inode, struct bdi_writeback *wb) inode->dirtied_when = jiffies; } inode_io_list_move_locked(inode, wb, &wb->b_dirty); - inode->i_state &= ~I_SYNC_QUEUED; } static void redirty_tail(struct inode *inode, struct bdi_writeback *wb) @@ -1345,8 +1358,6 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t) return ret; } -#define EXPIRE_DIRTY_ATIME 0x0001 - /* * Move expired (dirtied before dirtied_before) dirty inodes from * @delaying_queue to @dispatch_queue. |