From: Erez Zadok Date: Tue, 6 Sep 2011 01:20:36 +0000 (-0400) Subject: Unionfs: remove whiteout of opened but unlinked file from readonly branch X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=765addd7f07ccbfa2b0ebe4d913a6b2492641b20;p=unionfs-2.6.35.y.git Unionfs: remove whiteout of opened but unlinked file from readonly branch If we unlink an opened file in a readonly branch, then we create a whiteout. But then if if ftruncate it, we copyup a zero-length file. So we have to delete the whiteout. Signed-off-by: Erez Zadok --- diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c index 449d9db3602..eb03b9b1c33 100644 --- a/fs/unionfs/inode.c +++ b/fs/unionfs/inode.c @@ -968,6 +968,16 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia) /* get updated lower_dentry/inode after copyup */ lower_dentry = unionfs_lower_dentry(dentry); lower_inode = unionfs_lower_inode(inode); + /* + * check for whiteouts in writeable branch, and remove them + * if necessary. + */ + if (lower_dentry) { + err = check_unlink_whiteout(dentry, lower_dentry, + bindex); + if (err > 0) /* ignore if whiteout found and removed */ + err = 0; + } } /*