commit 7011bb86a40e297211c4b8562c8df1e3077fbcdf
Author: Erez Zadok <[EMAIL PROTECTED]>
Date:   Thu Jan 10 07:12:09 2008 -0500

    Unionfs: cleanup lower inodes after successful unlink

diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index f16d32c..ce7891e 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);
        }
 
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to