From: Erez Zadok <ezk@cs.sunysb.edu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
viro@ftp.linux.org.uk, hch@infradead.org,
Erez Zadok <ezk@cs.sunysb.edu>
Subject: [PATCH 1/8] Unionfs: delete whiteouts in sticky directories
Date: Fri, 2 Nov 2007 21:22:42 -0400 [thread overview]
Message-ID: <11940529693030-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <11940529692937-git-send-email-ezk@cs.sunysb.edu>
This is needed to maintain Unix semantics.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
fs/unionfs/inode.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 6ca52f4..f4facf4 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -90,6 +90,23 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
err = vfs_unlink(lower_dir_dentry->d_inode, wh_dentry);
unlock_dir(lower_dir_dentry);
+ /*
+ * Whiteouts are special files and should be deleted
+ * no matter what (as if they never existed), in
+ * order to allow this create operation to succeed.
+ * This is especially important in sticky
+ * directories: a whiteout may have been created by
+ * one user, but the newly created file may be
+ * created by another user. Therefore, in order to
+ * maintain Unix semantics, if the vfs_unlink above
+ * ailed, then we have to try to directly unlink the
+ * whiteout. Note: in the ODF version of unionfs,
+ * whiteout are handled much more cleanly.
+ */
+ if (err == -EPERM) {
+ struct inode *inode = lower_dir_dentry->d_inode;
+ err = inode->i_op->unlink(inode, wh_dentry);
+ }
if (err) {
printk(KERN_ERR "unionfs: create: could not "
"unlink whiteout, err = %d\n", err);
--
1.5.2.2
next prev parent reply other threads:[~2007-11-03 1:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-03 1:22 [GIT PULL -mm] 0/8 Unionfs updates/cleanups/fixes Erez Zadok
2007-11-03 1:22 ` Erez Zadok [this message]
2007-11-03 1:22 ` [PATCH 2/8] Unionfs: cleanup permission checking code Erez Zadok
2007-11-03 1:22 ` [PATCH 3/8] Unionfs: update usage.txt documentation Erez Zadok
2007-11-03 1:22 ` [PATCH 4/8] Unionfs: mmap updates Erez Zadok
2007-11-03 1:22 ` [PATCH 5/8] Unionfs: avoid a deadlock during branch-management on a pivot_root'ed union Erez Zadok
2007-11-03 1:22 ` [PATCH 6/8] Unionfs: don't bother validating inode if it has no lower branches Erez Zadok
2007-11-03 1:22 ` [PATCH 7/8] Unionfs: don't printk an error if it's due to common copyup Erez Zadok
2007-11-03 1:22 ` [PATCH 8/8] Unionfs/VFS: no need to export 2 symbols in security/security.c Erez Zadok
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11940529693030-git-send-email-ezk@cs.sunysb.edu \
--to=ezk@cs.sunysb.edu \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).