unionfs_unlink_whiteout() has a bug around i_nlink.
It affects mv(1)'s behaviour, too.

Junjiro Okajima


--- unionfs-20060221-0341/unlink.c      23 Feb 2006 00:47:37 -0000      1.1
+++ unionfs-20060221-0341/unlink.c      23 Feb 2006 17:15:56 -0000      1.2
@@ -121,6 +121,9 @@ static int unionfs_unlink_whiteout(struc
        DPUT(hidden_dentry);
        fist_copy_attr_times(dir, hidden_dir_dentry->d_inode);
        unlock_dir(hidden_dir_dentry);
+       /* propagate number of hard-links */
+       if (!err)
+               dentry->d_inode->i_nlink--;
 
        if (err) {
                if (!IS_COPYUP_ERR(err))
@@ -139,12 +142,6 @@ static int unionfs_unlink_whiteout(struc
                err = create_whiteout(dentry, dbstart(dentry));
        }
       out:
-       /* propagate number of hard-links */
-       if (dentry->d_inode->i_nlink != 0) {
-               dentry->d_inode->i_nlink = get_nlinks(dentry->d_inode);
-               if (!err)
-                       dentry->d_inode->i_nlink--;
-       }
        /* We don't want to leave negative leftover dentries for revalidate. */
        if (!err && (dbopaque(dentry) != -1))
                update_bstart(dentry);
_______________________________________________
unionfs mailing list
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs

Reply via email to