Hi,
I am new to Linux kernel programming. i am trying to print current working
directory of process which are running under containers.
i have written code in kernel as below to get pwd
*********************************************************************
struct path pwd;
        char *buf,*cwd;
        uid_t process_uid = (current->cred)->uid.val;
        pwd = current->fs->pwd;
        path_get(&pwd);//it gets the reference to path. which is argument to
d_path
        if((buf = (char *)kmalloc(100*sizeof(char),GFP_KERNEL))!=NULL) 
        {       //GFP_KERNEL is a flag specifies the behavior of the memory
allocator
                cwd = d_path(&pwd,buf,100*sizeof(char)); // returns pointer to 
buffer
printk("process name %s (pid = %d)pwd= %s and (uid=%u)\n",current->comm,
current->pid,cwd,process_uid);
        }
        //printk("check pwd\n");
        kfree(buf); 
**************************************************************************
it is printing pwd correctly in host machine. but unable to start docker
containers

root@sangeetha:/var/lib/docker# docker start 58e9277a7e8c
Error response from daemon: Cannot start container 58e9277a7e8c: [8] System
error: failed to add interface vethebc8876 to sandbox: failed in prefunc:
failed to set namespace on link "vethebc8876": invalid argument
Error: failed to start containers: [58e9277a7e8c]

if i comment d_path line, then i am able to start containers.can you please
help to understand the problem and how to resolve it?

docker version:
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:12:04 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:12:04 UTC 2015
 OS/Arch:      linux/amd64
*******************************************
uname -a
Linux sangeetha 3.14.57 #56 SMP Wed Jan 6 09:37:22 IST 2016 x86_64 x86_64
x86_64 GNU/Linux
**************************************************8
in logs

 process name docker (pid = 3754)pwd= /var/lib/docker and (uid=0)
[ 1743.097731] docker0: port 1(vethcf36114) entered forwarding state
[ 1743.097744] docker0: port 1(vethcf36114) entered forwarding state
[ 1743.100084] docker0: port 1(vethcf36114) entered disabled state
[ 1743.271360] process name docker (pid = 1667)pwd= / and (uid=0)
[ 1743.276427] process name docker (pid = 1507)pwd= / and (uid=0)
[ 1743.496652] docker0: port 1(vethcf36114) entered disabled state
[ 1743.497330] docker0: port 1(vethcf36114) entered disabled state
[ 1799.635904] process name bash (pid = 2894)pwd= /var/lib/docker and
(uid=0)
[ 2543.229052] process name bash (pid = 2894)pwd= /var/lib/docker and
(uid=0)
**************************************************************************
devicemapper fs is used for containers. ubuntu 14.04 os

Thanks in advance.





--
View this message in context: 
http://linux-kernel.2935.n7.nabble.com/d-path-and-overlay-fs-tp1068779p1273362.html
Sent from the Linux Kernel mailing list archive at Nabble.com.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to