git://git.onelab.eu
/
lxc-userspace.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e618652
)
lxcsu proc bug fix
author
Sapan Bhatia
<gwsapan@gmail.com>
Fri, 28 Jun 2013 16:53:27 +0000
(12:53 -0400)
committer
Sapan Bhatia
<gwsapan@gmail.com>
Fri, 28 Jun 2013 16:53:27 +0000
(12:53 -0400)
lxcsu-internal
patch
|
blob
|
history
setns.c
patch
|
blob
|
history
diff --git
a/lxcsu-internal
b/lxcsu-internal
index
894b08e
..
a670d62
100755
(executable)
--- a/
lxcsu-internal
+++ b/
lxcsu-internal
@@
-152,9
+152,13
@@
def main ():
if (not args.pidns):
setns.chcontext('/proc/%s/ns/pid'%pid)
if (not args.pidns):
setns.chcontext('/proc/%s/ns/pid'%pid)
+ proc_mounted = False
if (not os.access('/proc/self',0)):
if (not os.access('/proc/self',0)):
+ proc_mounted = True
setns.proc_mount()
setns.proc_mount()
+
+
# cgroups is not yet LXC-safe, so we need to use the course grained access control
# strategy of unmounting the filesystem
# cgroups is not yet LXC-safe, so we need to use the course grained access control
# strategy of unmounting the filesystem
@@
-185,6
+189,7
@@
def main ():
if debug: print 'lxcsu-internal:execv:','/usr/bin/setarch',exec_args
os.execv('/usr/bin/setarch',exec_args)
else:
if debug: print 'lxcsu-internal:execv:','/usr/bin/setarch',exec_args
os.execv('/usr/bin/setarch',exec_args)
else:
+ setns.proc_umount()
_,status = os.waitpid(pid,0)
exit(os.WEXITSTATUS(status))
_,status = os.waitpid(pid,0)
exit(os.WEXITSTATUS(status))
diff --git
a/setns.c
b/setns.c
index
c40d52b
..
7d82d53
100644
(file)
--- a/
setns.c
+++ b/
setns.c
@@
-38,6
+38,16
@@
proc_mount(PyObject *self, PyObject *args)
return Py_BuildValue("i", sts);
}
return Py_BuildValue("i", sts);
}
+static PyObject *
+proc_umount(PyObject *self, PyObject *args)
+{
+ int sts;
+ sts = umount("/proc");
+
+ return Py_BuildValue("i", sts);
+
+}
+
static PyObject *
chcontext(PyObject *self, PyObject *args)
{
static PyObject *
chcontext(PyObject *self, PyObject *args)
{
@@
-66,6
+76,7
@@
out:
static PyMethodDef SetnsMethods[] =
{
{"proc_mount", proc_mount, METH_VARARGS, "Mount a volume via the mount system call."},
static PyMethodDef SetnsMethods[] =
{
{"proc_mount", proc_mount, METH_VARARGS, "Mount a volume via the mount system call."},
+ {"proc_umount", proc_umount, METH_VARARGS, "Umount a volume via the umount system call."},
{"chcontext", chcontext, METH_VARARGS, "Switch into an lxc container."},
{"chfscontext", chfscontext, METH_VARARGS, "Switch into an lxc container."},
{NULL, NULL, 0, NULL}
{"chcontext", chcontext, METH_VARARGS, "Switch into an lxc container."},
{"chfscontext", chfscontext, METH_VARARGS, "Switch into an lxc container."},
{NULL, NULL, 0, NULL}