Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christoph Hellwig and committed by
Christian Brauner
f8b8820a e9075e42

+15 -3
+15 -3
fs/fs-writeback.c
··· 1711 1711 } 1712 1712 } 1713 1713 1714 + static bool __sync_lazytime(struct inode *inode) 1715 + { 1716 + spin_lock(&inode->i_lock); 1717 + if (!(inode_state_read(inode) & I_DIRTY_TIME)) { 1718 + spin_unlock(&inode->i_lock); 1719 + return false; 1720 + } 1721 + inode_state_clear(inode, I_DIRTY_TIME); 1722 + spin_unlock(&inode->i_lock); 1723 + inode->i_op->sync_lazytime(inode); 1724 + return true; 1725 + } 1726 + 1714 1727 bool sync_lazytime(struct inode *inode) 1715 1728 { 1716 1729 if (!(inode_state_read_once(inode) & I_DIRTY_TIME)) ··· 1731 1718 1732 1719 trace_writeback_lazytime(inode); 1733 1720 if (inode->i_op->sync_lazytime) 1734 - inode->i_op->sync_lazytime(inode); 1735 - else 1736 - mark_inode_dirty_sync(inode); 1721 + return __sync_lazytime(inode); 1722 + mark_inode_dirty_sync(inode); 1737 1723 return true; 1738 1724 } 1739 1725