.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/fs/pnode.c |
---|
3 | 4 | * |
---|
4 | 5 | * (C) Copyright IBM Corporation 2005. |
---|
5 | | - * Released under GPL v2. |
---|
6 | 6 | * Author : Ram Pai (linuxram@us.ibm.com) |
---|
7 | | - * |
---|
8 | 7 | */ |
---|
9 | 8 | #include <linux/mnt_namespace.h> |
---|
10 | 9 | #include <linux/mount.h> |
---|
11 | 10 | #include <linux/fs.h> |
---|
12 | 11 | #include <linux/nsproxy.h> |
---|
| 12 | +#include <uapi/linux/mount.h> |
---|
13 | 13 | #include "internal.h" |
---|
14 | 14 | #include "pnode.h" |
---|
15 | 15 | |
---|
.. | .. |
---|
213 | 213 | } |
---|
214 | 214 | |
---|
215 | 215 | /* all accesses are serialized by namespace_sem */ |
---|
216 | | -static struct user_namespace *user_ns; |
---|
217 | 216 | static struct mount *last_dest, *first_source, *last_source, *dest_master; |
---|
218 | 217 | static struct mountpoint *mp; |
---|
219 | 218 | static struct hlist_head *list; |
---|
.. | .. |
---|
245 | 244 | } |
---|
246 | 245 | do { |
---|
247 | 246 | struct mount *parent = last_source->mnt_parent; |
---|
248 | | - if (last_source == first_source) |
---|
| 247 | + if (peers(last_source, first_source)) |
---|
249 | 248 | break; |
---|
250 | 249 | done = parent->mnt_master == p; |
---|
251 | 250 | if (done && peers(n, parent)) |
---|
.. | .. |
---|
259 | 258 | type |= CL_MAKE_SHARED; |
---|
260 | 259 | } |
---|
261 | 260 | |
---|
262 | | - /* Notice when we are propagating across user namespaces */ |
---|
263 | | - if (m->mnt_ns->user_ns != user_ns) |
---|
264 | | - type |= CL_UNPRIVILEGED; |
---|
265 | 261 | child = copy_tree(last_source, last_source->mnt.mnt_root, type); |
---|
266 | 262 | if (IS_ERR(child)) |
---|
267 | 263 | return PTR_ERR(child); |
---|
268 | | - child->mnt.mnt_flags &= ~MNT_LOCKED; |
---|
269 | 264 | read_seqlock_excl(&mount_lock); |
---|
270 | 265 | mnt_set_mountpoint(m, mp, child); |
---|
271 | 266 | if (m->mnt_master != dest_master) |
---|
.. | .. |
---|
301 | 296 | * propagate_one(); everything is serialized by namespace_sem, |
---|
302 | 297 | * so globals will do just fine. |
---|
303 | 298 | */ |
---|
304 | | - user_ns = current->nsproxy->mnt_ns->user_ns; |
---|
305 | 299 | last_dest = dest_mnt; |
---|
306 | 300 | first_source = source_mnt; |
---|
307 | 301 | last_source = source_mnt; |
---|
.. | .. |
---|
605 | 599 | list_splice_tail(&to_umount, list); |
---|
606 | 600 | |
---|
607 | 601 | return 0; |
---|
608 | | -} |
---|
609 | | - |
---|
610 | | -void propagate_remount(struct mount *mnt) |
---|
611 | | -{ |
---|
612 | | - struct mount *parent = mnt->mnt_parent; |
---|
613 | | - struct mount *p = mnt, *m; |
---|
614 | | - struct super_block *sb = mnt->mnt.mnt_sb; |
---|
615 | | - |
---|
616 | | - if (!sb->s_op->copy_mnt_data) |
---|
617 | | - return; |
---|
618 | | - for (p = propagation_next(parent, parent); p; |
---|
619 | | - p = propagation_next(p, parent)) { |
---|
620 | | - m = __lookup_mnt(&p->mnt, mnt->mnt_mountpoint); |
---|
621 | | - if (m) |
---|
622 | | - sb->s_op->copy_mnt_data(m->mnt.data, mnt->mnt.data); |
---|
623 | | - } |
---|
624 | 602 | } |
---|