From: Erez Zadok Date: Sat, 30 Apr 2011 05:33:56 +0000 (-0400) Subject: Unionfs: remove whiteout if regular file also exists X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=e8c93f7acb9cc515291d55a7f276b140d7c20f65;p=unionfs-2.6.39.y.git Unionfs: remove whiteout if regular file also exists 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 --- diff --git a/fs/unionfs/whiteout.c b/fs/unionfs/whiteout.c index 405073a4faa..9abe5667f17 100644 --- a/fs/unionfs/whiteout.c +++ b/fs/unionfs/whiteout.c @@ -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 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);