diff options
| author | Christoph Hellwig <hch@lst.de> | 2026-03-17 14:44:04 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-03-17 15:12:15 +0100 |
| commit | f8b8820a4a16c4ef673e90ded41e8348514e53f0 (patch) | |
| tree | 066b31f0453ff306fbbe6a383d5c0576509feadf | |
| parent | e9075e420a1eb3b52c60f3b95893a55e77419ce8 (diff) | |
| download | linux-next-f8b8820a4a16c4ef673e90ded41e8348514e53f0.tar.gz linux-next-f8b8820a4a16c4ef673e90ded41e8348514e53f0.zip | |
fs: clear I_DIRTY_TIME in sync_lazytime
For file systems implementing ->sync_lazytime, I_DIRTY_TIME fails to get
cleared in sync_lazytime, and might cause additional calls to
sync_lazytime during inode deactivation. Use the same pattern as in
__mark_inode_dirty to clear the flag under the inode lock.
Fixes: 5cf06ea56ee6 ("fs: add a ->sync_lazytime method")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260317134409.1691317-1-hch@lst.de
Signed-off-by: Christian Brauner <brauner@kernel.org>
| -rw-r--r-- | fs/fs-writeback.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 7c75ed7e8979..d8dac1931595 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1711,6 +1711,19 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb, } } +static bool __sync_lazytime(struct inode *inode) +{ + spin_lock(&inode->i_lock); + if (!(inode_state_read(inode) & I_DIRTY_TIME)) { + spin_unlock(&inode->i_lock); + return false; + } + inode_state_clear(inode, I_DIRTY_TIME); + spin_unlock(&inode->i_lock); + inode->i_op->sync_lazytime(inode); + return true; +} + bool sync_lazytime(struct inode *inode) { if (!(inode_state_read_once(inode) & I_DIRTY_TIME)) @@ -1718,9 +1731,8 @@ bool sync_lazytime(struct inode *inode) trace_writeback_lazytime(inode); if (inode->i_op->sync_lazytime) - inode->i_op->sync_lazytime(inode); - else - mark_inode_dirty_sync(inode); + return __sync_lazytime(inode); + mark_inode_dirty_sync(inode); return true; } |
