Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335905
| From | Andrew Vagin <avagin@virtuozzo.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [Devel] [PATCH] fs/pnode.c: treat zero mnt_group_id-s as unequal |
| Date | 2016-02-17 00:00 +0100 |
| Message-ID | <r2WL8-5PS-25@gated-at.bofh.it> (permalink) |
| References | <r2TNg-3Qf-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Feb 16, 2016 at 11:45:33AM -0800, Maxim Patlasov wrote:
> propagate_one(m) calculates "type" argument for copy_tree() like this:
>
> > if (m->mnt_group_id == last_dest->mnt_group_id) {
> > type = CL_MAKE_SHARED;
> > } else {
> > type = CL_SLAVE;
> > if (IS_MNT_SHARED(m))
> > type |= CL_MAKE_SHARED;
> > }
>
> The "type" argument then governs clone_mnt() behavior with respect to flags
> and mnt_master of new mount. When we iterate through a slave group, it is
> possible that both current "m" and "last_dest" are not shared (although,
> both are slaves, i.e. have non-NULL mnt_master-s). Then the comparison
> above erroneously makes new mount shared and sets its mnt_master to
> last_source->mnt_master. The patch fixes the problem by handling zero
> mnt_group_id-s as though they are unequal.
>
> The similar problem exists in the implementation of "else" clause above
> when we have to ascend upward in the master/slave tree by calling:
>
> > last_source = last_source->mnt_master;
> > last_dest = last_source->mnt_parent;
>
> proper number of times. The last step is governed by
> "n->mnt_group_id != last_dest->mnt_group_id" condition that may lie if
> both are zero. The patch fixes this case in the same way as the former one.
>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
> Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
> ---
> fs/pnode.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/pnode.c b/fs/pnode.c
> index 6367e1e..abf156a 100644
> --- a/fs/pnode.c
> +++ b/fs/pnode.c
> @@ -212,7 +212,7 @@ static int propagate_one(struct mount *m)
> /* skip if mountpoint isn't covered by it */
> if (!is_subdir(mp->m_dentry, m->mnt.mnt_root))
> return 0;
> - if (m->mnt_group_id == last_dest->mnt_group_id) {
> + if (m->mnt_group_id && m->mnt_group_id == last_dest->mnt_group_id) {
> type = CL_MAKE_SHARED;
> } else {
> struct mount *n, *p;
> @@ -223,7 +223,9 @@ static int propagate_one(struct mount *m)
> last_source = last_source->mnt_master;
> last_dest = last_source->mnt_parent;
> }
> - if (n->mnt_group_id != last_dest->mnt_group_id) {
> + if (n->mnt_group_id != last_dest->mnt_group_id ||
> + (!n->mnt_group_id &&
> + !last_dest->mnt_group_id)) {
> last_source = last_source->mnt_master;
> last_dest = last_source->mnt_parent;
> }
>
> _______________________________________________
> Devel mailing list
> Devel@openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] fs/pnode.c: treat zero mnt_group_id-s as unequal Maxim Patlasov <mpatlasov@virtuozzo.com> - 2016-02-16 20:50 +0100
Re: [PATCH] fs/pnode.c: treat zero mnt_group_id-s as unequal Al Viro <viro@ZenIV.linux.org.uk> - 2016-02-16 21:00 +0100
Re: [PATCH] fs/pnode.c: treat zero mnt_group_id-s as unequal Maxim Patlasov <mpatlasov@virtuozzo.com> - 2016-02-17 08:10 +0100
Re: [Devel] [PATCH] fs/pnode.c: treat zero mnt_group_id-s as unequal Andrew Vagin <avagin@virtuozzo.com> - 2016-02-17 00:00 +0100
csiph-web