Implement overlayfs' ->evict_inode operation, so that we can clear all inode dirty flags. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxxx> --- fs/overlayfs/super.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 1e21feb87297..694eff76eb09 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -391,11 +391,26 @@ static int ovl_remount(struct super_block *sb, int *flags, char *data) return ret; } +static void ovl_evict_inode(struct inode *inode) +{ + struct ovl_fs *ofs = inode->i_sb->s_fs_info; + + if (!list_empty(&OVL_I(inode)->wait_list)) { + spin_lock(&ofs->syncfs_wait_list_lock); + if (!list_empty(&OVL_I(inode)->wait_list)) + list_del(&OVL_I(inode)->wait_list); + spin_unlock(&ofs->syncfs_wait_list_lock); + } + inode->i_state &= ~I_DIRTY_ALL; + clear_inode(inode); +} + static const struct super_operations ovl_super_operations = { .alloc_inode = ovl_alloc_inode, .free_inode = ovl_free_inode, .destroy_inode = ovl_destroy_inode, .drop_inode = generic_delete_inode, + .evict_inode = ovl_evict_inode, .put_super = ovl_put_super, .sync_fs = ovl_sync_fs, .statfs = ovl_statfs, -- 2.26.2