From 2c61679ae0983766d54bf20e01dc69d82be0fdc3 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Sat, 30 Apr 2011 01:33:55 -0400 Subject: [PATCH] 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 --- fs/unionfs/inode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c index 0a27fab5e9f..24243adbe61 100644 --- a/fs/unionfs/inode.c +++ b/fs/unionfs/inode.c @@ -976,6 +976,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; + } } /* -- 2.34.1