commit b8b7915e2c8566773c66a7a338bf744ddc8995e4
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Tue May 22 12:33:10 2007 -0400
link and rename invariants when new_dentry is negative and link/rename
happens on
a branch other than leftmost
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index
b5d4a2e02a1f4fcb7dc10410131414a9427c2f24..4f4650e880060626ba10f1b74f7ceb01ff510b4d
100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -177,9 +177,16 @@ static int unionfs_link(struct dentry *o
dbstart(new_dentry) == dbend(new_dentry) &&
(!unionfs_lower_dentry_idx(new_dentry, 0) ||
!unionfs_lower_dentry_idx(new_dentry, 0)->d_inode)) {
+
set_dbstart(new_dentry, dbstart(old_dentry));
set_dbend(new_dentry, dbstart(old_dentry));
create_p = 1;
+ dput(unionfs_lower_dentry_idx(new_dentry, 0));
+ unionfs_set_lower_dentry_idx(new_dentry, 0, NULL);
+ if (unionfs_lower_mnt_idx(new_dentry, 0)) {
+ unionfs_mntput(new_dentry, 0);
+ unionfs_set_lower_mnt_idx(new_dentry, 0, NULL);
+ }
}
else {
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index
986ff113289f9f0b4b523aca041caa351586989b..9f0214e1af00db4ac5be286e70be5a1725066d19
100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -30,7 +30,7 @@ int copyup_empty_dir(struct inode *paren
hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (!hidden_dentry) {
- hidden_dentry = create_parents(parent, dentry,
+ hidden_dentry = create_parents(parent, dentry,
dentry->d_name.name, bindex);
if (!hidden_dentry || IS_ERR(hidden_dentry)) {
printk(KERN_DEBUG "hidden dentry NULL for "
@@ -167,6 +167,12 @@ static int do_unionfs_rename(struct inod
set_dbend(new_dentry, old_bend);
new_bstart = old_bstart;
new_bend = old_bend;
+ dput(unionfs_lower_dentry_idx(new_dentry, 0));
+ unionfs_set_lower_dentry_idx(new_dentry, 0, NULL);
+ if (unionfs_lower_mnt_idx(new_dentry, 0)) {
+ unionfs_mntput(new_dentry, 0);
+ unionfs_set_lower_mnt_idx(new_dentry, 0, NULL);
+ }
}
}
@@ -222,22 +228,6 @@ static int do_unionfs_rename(struct inod
/* 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