lkml.org 
[lkml]   [2012]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 52/73] union-mount: Set opaque flag on new directories in unioned file systems [ver #2]
Date
From: Valerie Aurora <vaurora@redhat.com>

If we mkdir() a directory on the top layer of a union, we don't want
entries from a matching directory on the lower layer to "show through"
suddenly. To prevent this, we set the opaque flag on a directory in a
union mount if there is no matching directory on the lower layers.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Valerie Aurora <vaurora@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

fs/namei.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index f9e0d68..d52377d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2946,8 +2946,17 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
return error;

error = dir->i_op->mkdir(dir, dentry, mode);
- if (!error)
- fsnotify_mkdir(dir, dentry);
+ if (error)
+ return error;
+
+ /* XXX racy - crash now and dir isn't opaque */
+ if (IS_DIR_UNIONED(dentry->d_parent)) {
+ dentry->d_inode->i_flags |= S_OPAQUE;
+ mark_inode_dirty(dentry->d_inode);
+ }
+
+ fsnotify_mkdir(dir, dentry);
+
return error;
}



\
 
 \ /
  Last update: 2012-02-21 19:21    [W:0.277 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site