diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-21 10:14:08 -0400 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 10:59:10 +0200 |
| commit | 118c7fe9e0245d2075c0b5a64a172f3feaed5b5b (patch) | |
| tree | c3b96824d03b70a69534b6ee9396be7901e0763e | |
| parent | 4a6abf6d616af50e713a4765c14c0341c2ad9a5a (diff) | |
| download | android_kernel_m2note-118c7fe9e0245d2075c0b5a64a172f3feaed5b5b.tar.gz | |
BACKPORT: don't bother with propagate_mnt() unless the target is shared
If the dest_mnt is not shared, propagate_mnt() does nothing -
there's no mounts to propagate to and thus no copies to create.
Might as well don't bother calling it in that case.
Change-Id: Id94af8ad288bf9bfc6ffb5570562bbc2dc2e0d87
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | fs/namespace.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index f4b869074..a96f6aac7 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1739,16 +1739,14 @@ static int attach_recursive_mnt(struct mount *source_mnt, err = invent_group_ids(source_mnt, true); if (err) goto out; - } - err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); - if (err) - goto out_cleanup_ids; - - br_write_lock(&vfsmount_lock); - - if (IS_MNT_SHARED(dest_mnt)) { + err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); + if (err) + goto out_cleanup_ids; + br_write_lock(&vfsmount_lock); for (p = source_mnt; p; p = next_mnt(p, source_mnt)) set_mnt_shared(p); + } else { + br_write_lock(&vfsmount_lock); } if (parent_path) { detach_mnt(source_mnt, parent_path); @@ -1768,8 +1766,7 @@ static int attach_recursive_mnt(struct mount *source_mnt, return 0; out_cleanup_ids: - if (IS_MNT_SHARED(dest_mnt)) - cleanup_group_ids(source_mnt, NULL); + cleanup_group_ids(source_mnt, NULL); out: return err; } |
