hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/pnode.c
....@@ -1,15 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/fs/pnode.c
34 *
45 * (C) Copyright IBM Corporation 2005.
5
- * Released under GPL v2.
66 * Author : Ram Pai (linuxram@us.ibm.com)
7
- *
87 */
98 #include <linux/mnt_namespace.h>
109 #include <linux/mount.h>
1110 #include <linux/fs.h>
1211 #include <linux/nsproxy.h>
12
+#include <uapi/linux/mount.h>
1313 #include "internal.h"
1414 #include "pnode.h"
1515
....@@ -213,7 +213,6 @@
213213 }
214214
215215 /* all accesses are serialized by namespace_sem */
216
-static struct user_namespace *user_ns;
217216 static struct mount *last_dest, *first_source, *last_source, *dest_master;
218217 static struct mountpoint *mp;
219218 static struct hlist_head *list;
....@@ -245,7 +244,7 @@
245244 }
246245 do {
247246 struct mount *parent = last_source->mnt_parent;
248
- if (last_source == first_source)
247
+ if (peers(last_source, first_source))
249248 break;
250249 done = parent->mnt_master == p;
251250 if (done && peers(n, parent))
....@@ -259,13 +258,9 @@
259258 type |= CL_MAKE_SHARED;
260259 }
261260
262
- /* Notice when we are propagating across user namespaces */
263
- if (m->mnt_ns->user_ns != user_ns)
264
- type |= CL_UNPRIVILEGED;
265261 child = copy_tree(last_source, last_source->mnt.mnt_root, type);
266262 if (IS_ERR(child))
267263 return PTR_ERR(child);
268
- child->mnt.mnt_flags &= ~MNT_LOCKED;
269264 read_seqlock_excl(&mount_lock);
270265 mnt_set_mountpoint(m, mp, child);
271266 if (m->mnt_master != dest_master)
....@@ -301,7 +296,6 @@
301296 * propagate_one(); everything is serialized by namespace_sem,
302297 * so globals will do just fine.
303298 */
304
- user_ns = current->nsproxy->mnt_ns->user_ns;
305299 last_dest = dest_mnt;
306300 first_source = source_mnt;
307301 last_source = source_mnt;
....@@ -605,20 +599,4 @@
605599 list_splice_tail(&to_umount, list);
606600
607601 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
- }
624602 }