From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: [PATCH 50/73] union-mount: Create whiteout on unlink() [ver #2] Date: Tue, 21 Feb 2012 18:03:44 +0000 Message-ID: <20120221180344.25235.79487.stgit@warthog.procyon.org.uk> References: <20120221175721.25235.8901.stgit@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, David Howells To: linux-fsdevel@vger.kernel.org, viro@ZenIV.linux.org.uk, valerie.aurora@gmail.com Return-path: In-Reply-To: <20120221175721.25235.8901.stgit@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org From: Valerie Aurora Whiteout an unlinked directory entry in a union mounted file system. Original-author: Valerie Aurora Signed-off-by: David Howells --- fs/namei.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 586913f..ce941ac 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3333,11 +3333,6 @@ static long do_unlinkat(int dfd, const char __user *pathname) if (nd.last_type != LAST_NORM) goto exit1; - /* unlink() on union mounts not implemented yet */ - error = -EINVAL; - if (IS_DIR_UNIONED(nd.path.dentry)) - goto exit1; - nd.flags &= ~LOOKUP_PARENT; mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); @@ -3356,6 +3351,10 @@ static long do_unlinkat(int dfd, const char __user *pathname) error = security_path_unlink(&nd.path, path.dentry); if (error) goto exit3; + if (IS_DIR_UNIONED(nd.path.dentry)) { + error = do_whiteout(&nd, &path, 0); + goto exit3; + } error = vfs_unlink(nd.path.dentry->d_inode, path.dentry); exit3: mnt_drop_write(nd.path.mnt);