commit 91bd169734e476dbd2a717c43188e8d51878feee
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Sun May 20 14:44:45 2007 -0400

    rename invariant issues fix

diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index b5b0ccf..986ff11 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -61,6 +61,7 @@ int copyup_empty_dir(struct inode *parent, struct dentry 
*dentry, int mode)
                        unionfs_set_lower_dentry_idx(dentry, i, NULL);
                }
        }
+       set_dbstart(dentry, bindex);
        set_dbend(dentry, bindex);
 
 out:
@@ -221,6 +222,22 @@ static int do_unionfs_rename(struct inode *old_dir,
                /* else, a whiteout will take care of everything */
        }
 
+       /* if new dentry did not exist but was succesfully renamed at a branch 
+        * other than branch 0, we must clear any dentries/mntgets before bstart
+        */
+       for (bindex = 0; bindex < dbstart(new_dentry); bindex++) {
+               if (unionfs_lower_dentry_idx(new_dentry, bindex)) {
+                       /* all dentries must be negative */
+                       BUG_ON(unionfs_lower_dentry_idx(new_dentry, 
bindex)->d_inode);
+                       dput(unionfs_lower_dentry_idx(new_dentry, bindex));
+                       unionfs_set_lower_dentry_idx(new_dentry, bindex, NULL);
+               }
+               if (unionfs_lower_mnt_idx(new_dentry, bindex)) {
+                       unionfs_mntput(new_dentry, bindex);
+                       unionfs_set_lower_mnt_idx(new_dentry, bindex, NULL);
+               }
+       }
+
        /* if all ok, rename in odf */
        err = odf_rename(old_dentry, new_dentry);
        BUG_ON(err);    /* odf should not fail */
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to