You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2019/01/11 23:31:19 UTC
[mesos] branch master updated: Compared the device number of
namespace handle instead of /proc.
This is an automated email from the ASF dual-hosted git repository.
jieyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new dfa8576 Compared the device number of namespace handle instead of /proc.
dfa8576 is described below
commit dfa85761802fee30b90ee2ed1a8885645a8c01fd
Author: Jie Yu <yu...@gmail.com>
AuthorDate: Fri Jan 11 15:07:55 2019 -0800
Compared the device number of namespace handle instead of /proc.
In recent versions of kernels, the device number of '/proc/<pid>/ns/net'
is different than that of '/proc'. It shows up as "nsfs" instead of
"proc" like the old kernels. For instance:
Newer kernel:
```
$ uname -nr
ubuntu-xenial 4.4.0-83-generic
$ stat -L -c %d /proc/self/ns/net
3
$ stat -L -c %d /proc
4
```
Older kernel:
```
$ uname -nr
core-dev 3.10.0-693.5.2.el7.x86_64
$ stat -L -c %d /proc/self/ns/net
3
$ stat -L -c %d /proc
3
```
As a result, we should compare the device number directly against the
namespace handle, instead of `/proc`.
Review: https://reviews.apache.org/r/69727
---
src/slave/containerizer/mesos/isolators/network/cni/cni.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index a1130a5..d941ee7 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -1606,10 +1606,10 @@ static Try<bool> isNetworkNamespaceHandle(const string& netNsHandle)
"': " + netNsHandleDev.error());
}
- Try<dev_t> procDev = os::stat::dev("/proc");
+ Try<dev_t> procDev = os::stat::dev("/proc/self/ns/net");
if (procDev.isError()) {
return Error(
- "Failed to get the device number of '/proc'"
+ "Failed to get the device number of '/proc/self/ns/net'"
": " + procDev.error());
}