From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: [PATCH 53/74] union-mount: Create whiteout on unlink() Date: Tue, 22 Mar 2011 19:04:44 -0700 Message-ID: <1300845905-14433-10-git-send-email-valerie.aurora@gmail.com> References: <1300845905-14433-1-git-send-email-valerie.aurora@gmail.com> Cc: viro@zeniv.linux.org.uk, Valerie Aurora , Valerie Aurora To: linux-fsdevel@vger.kernel.org, linux@vger.kernel.org Return-path: Received: from mail-yx0-f174.google.com ([209.85.213.174]:48709 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751707Ab1CWCFo (ORCPT ); Tue, 22 Mar 2011 22:05:44 -0400 In-Reply-To: <1300845905-14433-1-git-send-email-valerie.aurora@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Valerie Aurora Whiteout an unlinked directory entry in a union mounted file system. Signed-off-by: Valerie Aurora --- fs/namei.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 531a0e0..83f9c62 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2698,11 +2698,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); @@ -2720,6 +2715,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); -- 1.7.0.4