Now drop overlayfs' inode will sync dirty data, so we change to only drop clean inode. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxxx> --- fs/overlayfs/super.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 960e79e7a8b5..1d04117fb6ad 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -421,11 +421,21 @@ static int ovl_write_inode(struct inode *inode, return ret; } +int ovl_drop_inode(struct inode *inode) +{ + struct inode *upper = ovl_inode_upper(inode); + + if (!upper || !(inode->i_state & I_DIRTY_ALL)) + return 1; + + return generic_drop_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, + .drop_inode = ovl_drop_inode, .write_inode = ovl_write_inode, .evict_inode = ovl_evict_inode, .put_super = ovl_put_super, -- 2.26.2