Messages in this thread Patch in this message | | | Subject | [RFC PATCH 8/8] nfs - objlayout use namespace if not executing in init namespace | From | Ian Kent <> | Date | Thu, 05 Feb 2015 10:34:44 +0800 |
| |
If the caller is running within a container then execute the usermode helper callback within the init namespace of the container.
Signed-off-by: Ian Kent <ikent@redhat.com> Cc: Benjamin Coddington <bcodding@redhat.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: J. Bruce Fields <bfields@fieldses.org> Cc: David Howells <dhowells@redhat.com> Cc: Trond Myklebust <trond.myklebust@primarydata.com> Cc: Oleg Nesterov <onestero@redhat.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Jeff Layton <jeff.layton@primarydata.com> --- fs/nfs/objlayout/objlayout.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c index 919efd4..dd5b9e8 100644 --- a/fs/nfs/objlayout/objlayout.c +++ b/fs/nfs/objlayout/objlayout.c @@ -600,8 +600,13 @@ static int __objlayout_upcall(struct __auto_login *login) NULL }; char *argv[8]; + int umh_flags = UMH_WAIT_PROC; int ret; + /* If running within a container use the container namespace */ + if (current->nsproxy->net_ns != &init_net) + umh_flags |= UMH_USE_NS; + if (unlikely(!osd_login_prog[0])) { dprintk("%s: osd_login_prog is disabled\n", __func__); return -EACCES; @@ -620,7 +625,7 @@ static int __objlayout_upcall(struct __auto_login *login) argv[6] = login->systemid_hex; argv[7] = NULL; - ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); + ret = call_usermodehelper(argv[0], argv, envp, umh_flags); /* * Disable the upcall mechanism if we're getting an ENOENT or * EACCES error. The admin can re-enable it on the fly by using
| |