From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: [PATCH 43/74] union-mount: Implement union mount Date: Tue, 22 Mar 2011 18:59:19 -0700 Message-ID: <1300845590-14184-44-git-send-email-valerie.aurora@gmail.com> References: <1300845590-14184-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-iw0-f174.google.com ([209.85.214.174]:36854 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756285Ab1CWCCJ (ORCPT ); Tue, 22 Mar 2011 22:02:09 -0400 In-Reply-To: <1300845590-14184-1-git-send-email-valerie.aurora@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Valerie Aurora Up till this commit, mount with MS_UNION flag succeeded but didn't actually union the file systems. Now call the functions to check the source mounts and create/destroy the per-vfsmount union structures. Signed-off-by: Valerie Aurora --- fs/namespace.c | 13 ++++++++++++- fs/super.c | 1 + 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 1581411..11677d4 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1675,9 +1675,17 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt, if (err) goto out; } + + /* parent_path means we are moving an existing unioned mount */ + if (!parent_path && IS_MNT_UNION(source_mnt)) { + err = prepare_mnt_union(source_mnt, path); + if (err) + goto out_cleanup_ids; + } + err = propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list); if (err) - goto out_cleanup_ids; + goto out_cleanup_union; br_write_lock(vfsmount_lock); @@ -1702,6 +1710,9 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt, return 0; + out_cleanup_union: + if (!parent_path && IS_MNT_UNION(source_mnt)) + cleanup_mnt_union(source_mnt); out_cleanup_ids: if (IS_MNT_SHARED(dest_mnt)) cleanup_group_ids(source_mnt, NULL); diff --git a/fs/super.c b/fs/super.c index d02a4d6..78232d2 100644 --- a/fs/super.c +++ b/fs/super.c @@ -178,6 +178,7 @@ void deactivate_locked_super(struct super_block *s) if (atomic_dec_and_test(&s->s_active)) { fs->kill_sb(s); put_filesystem(fs); + put_union_sb(s); put_super(s); } else { up_write(&s->s_umount); -- 1.7.0.4