.. | .. |
---|
102 | 102 | |
---|
103 | 103 | if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { |
---|
104 | 104 | struct mount *parent = READ_ONCE(mnt->mnt_parent); |
---|
| 105 | + struct mnt_namespace *mnt_ns; |
---|
| 106 | + |
---|
105 | 107 | /* Escaped? */ |
---|
106 | 108 | if (dentry != vfsmnt->mnt_root) { |
---|
107 | 109 | bptr = *buffer; |
---|
.. | .. |
---|
116 | 118 | vfsmnt = &mnt->mnt; |
---|
117 | 119 | continue; |
---|
118 | 120 | } |
---|
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 |
---|
121 | 127 | break; |
---|
122 | 128 | } |
---|
123 | 129 | parent = dentry->d_parent; |
---|
.. | .. |
---|
316 | 322 | end = ERR_PTR(-ENAMETOOLONG); |
---|
317 | 323 | return end; |
---|
318 | 324 | } |
---|
319 | | -EXPORT_SYMBOL(simple_dname); |
---|
320 | 325 | |
---|
321 | 326 | /* |
---|
322 | 327 | * Write full pathname from the root of the filesystem into the buffer. |
---|