From 7c93b4834f2e52e62cf22f64a74af59a252afcdd Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Mon, 5 Sep 2011 21:20:35 -0400 Subject: [PATCH] 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 --- fs/unionfs/whiteout.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/fs/unionfs/whiteout.c b/fs/unionfs/whiteout.c index 966a7ab111e..7b142ac5367 100644 --- a/fs/unionfs/whiteout.c +++ b/fs/unionfs/whiteout.c @@ -204,8 +204,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 @@ -236,13 +236,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); -- 2.34.1