hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/d_path.c
....@@ -102,6 +102,8 @@
102102
103103 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
104104 struct mount *parent = READ_ONCE(mnt->mnt_parent);
105
+ struct mnt_namespace *mnt_ns;
106
+
105107 /* Escaped? */
106108 if (dentry != vfsmnt->mnt_root) {
107109 bptr = *buffer;
....@@ -116,8 +118,12 @@
116118 vfsmnt = &mnt->mnt;
117119 continue;
118120 }
119
- if (!error)
120
- error = is_mounted(vfsmnt) ? 1 : 2;
121
+ mnt_ns = READ_ONCE(mnt->mnt_ns);
122
+ /* open-coded is_mounted() to use local mnt_ns */
123
+ if (!IS_ERR_OR_NULL(mnt_ns) && !is_anon_ns(mnt_ns))
124
+ error = 1; // absolute root
125
+ else
126
+ error = 2; // detached or not attached yet
121127 break;
122128 }
123129 parent = dentry->d_parent;
....@@ -316,7 +322,6 @@
316322 end = ERR_PTR(-ENAMETOOLONG);
317323 return end;
318324 }
319
-EXPORT_SYMBOL(simple_dname);
320325
321326 /*
322327 * Write full pathname from the root of the filesystem into the buffer.