From: Valerie Aurora <vaurora@xxxxxxxxxx> 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@xxxxxxx> Signed-off-by: Valerie Aurora <vaurora@xxxxxxxxxx> Signed-off-by: Valerie Aurora <valerie.aurora@xxxxxxxxx> --- fs/namei.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 9c6803a..47fe25a 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2323,8 +2323,17 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int 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; } -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html