hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/fs/mount.h
....@@ -9,7 +9,13 @@
99 atomic_t count;
1010 struct ns_common ns;
1111 struct mount * root;
12
+ /*
13
+ * Traversal and modification of .list is protected by either
14
+ * - taking namespace_sem for write, OR
15
+ * - taking namespace_sem for read AND taking .ns_lock.
16
+ */
1217 struct list_head list;
18
+ spinlock_t ns_lock;
1319 struct user_namespace *user_ns;
1420 struct ucounts *ucounts;
1521 u64 seq; /* Sequence number to prevent loops */
....@@ -58,7 +64,10 @@
5864 struct mount *mnt_master; /* slave is on master->mnt_slave_list */
5965 struct mnt_namespace *mnt_ns; /* containing namespace */
6066 struct mountpoint *mnt_mp; /* where is it mounted */
61
- struct hlist_node mnt_mp_list; /* list mounts with the same mountpoint */
67
+ union {
68
+ struct hlist_node mnt_mp_list; /* list mounts with the same mountpoint */
69
+ struct hlist_node mnt_umount;
70
+ };
6271 struct list_head mnt_umounting; /* list entry for umount propagation */
6372 #ifdef CONFIG_FSNOTIFY
6473 struct fsnotify_mark_connector __rcu *mnt_fsnotify_marks;
....@@ -68,8 +77,7 @@
6877 int mnt_group_id; /* peer group identifier */
6978 int mnt_expiry_mark; /* true if marked for expiry */
7079 struct hlist_head mnt_pins;
71
- struct fs_pin mnt_umount;
72
- struct dentry *mnt_ex_mountpoint;
80
+ struct hlist_head mnt_stuck_children;
7381 } __randomize_layout;
7482
7583 #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */
....@@ -131,9 +139,7 @@
131139 struct mnt_namespace *ns;
132140 struct path root;
133141 int (*show)(struct seq_file *, struct vfsmount *);
134
- void *cached_mount;
135
- u64 cached_event;
136
- loff_t cached_index;
142
+ struct mount cursor;
137143 };
138144
139145 extern const struct seq_operations mounts_op;
....@@ -146,3 +152,10 @@
146152
147153 return __is_local_mountpoint(dentry);
148154 }
155
+
156
+static inline bool is_anon_ns(struct mnt_namespace *ns)
157
+{
158
+ return ns->seq == 0;
159
+}
160
+
161
+extern void mnt_cursor_del(struct mnt_namespace *ns, struct mount *cursor);