From 7011bb86a40e297211c4b8562c8df1e3077fbcdf Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Thu, 10 Jan 2008 07:12:09 -0500 Subject: [PATCH] Unionfs: cleanup lower inodes after successful unlink --- fs/unionfs/unlink.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c index f16d32cf55..ce7891e530 100644 --- a/fs/unionfs/unlink.c +++ b/fs/unionfs/unlink.c @@ -101,7 +101,9 @@ out: int unionfs_unlink(struct inode *dir, struct dentry *dentry) { int err = 0; + struct inode *inode = dentry->d_inode; + BUG_ON(S_ISDIR(inode->i_mode)); unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD); unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD); @@ -125,8 +127,13 @@ int unionfs_unlink(struct inode *dir, struct dentry *dentry) err = odf_remove(dentry, ODF_RMV_NOTWH); } if (!err) { - if (!S_ISDIR(dentry->d_inode->i_mode)) - unionfs_postcopyup_release(dentry); + unionfs_postcopyup_release(dentry); + if (inode->i_nlink == 0) { + /* drop lower inodes */ + iput(unionfs_lower_inode(inode)); + unionfs_set_lower_inode(inode, NULL); + ibstart(inode) = ibend(inode) = -1; + } d_drop(dentry); } -- 2.43.0