Unionfs: remove whiteout if regular file also exists
authorErez Zadok <ezk@cs.sunysb.edu>
Sat, 30 Apr 2011 05:33:56 +0000 (01:33 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sat, 30 Apr 2011 05:33:56 +0000 (01:33 -0400)
We used to return EIO then, but it's safer to cleanup such a situation, if
it occurs, in check_unlink_whiteout, because we know for a fact that we want
to delete a whiteout if one exists.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/whiteout.c

index 405073a4faa1727e87a3c63d9651a33c25e4388e..9abe5667f1747e913c0383e6fcb5f24e965a9792 100644 (file)
@@ -203,8 +203,8 @@ int unlink_whiteout(struct dentry *wh_dentry)
  * Checks to see if there's a whiteout in @lower_dentry's parent directory,
  * whose name is taken from @dentry.  Then tries to remove that whiteout, if
  * found.  If <dentry,bindex> is a branch marked readonly, return -EROFS.
- * If it finds both a regular file and a whiteout, return -EIO (this should
- * never happen).
+ * If it finds both a regular file and a whiteout, delete whiteout (this
+ * should never happen).
  *
  * Return 0 if no whiteout was found.  Return 1 if one was found and
  * successfully removed.  Therefore a value >= 0 tells the caller that
@@ -234,13 +234,10 @@ int check_unlink_whiteout(struct dentry *dentry, struct dentry *lower_dentry,
        }
 
        /* check if regular file and whiteout were both found */
-       if (unlikely(lower_dentry->d_inode)) {
-               err = -EIO;
-               printk(KERN_ERR "unionfs: found both whiteout and regular "
-                      "file in directory %s (branch %d)\n",
+       if (unlikely(lower_dentry->d_inode))
+               printk(KERN_WARNING "unionfs: removing whiteout; regular "
+                      "file exists in directory %s (branch %d)\n",
                       lower_dir_dentry->d_name.name, bindex);
-               goto out_dput;
-       }
 
        /* check if branch is writeable */
        err = is_robranch_super(dentry->d_sb, bindex);