mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sangeetha Busangari <sangeetha.785@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: d_path() and overlay fs
Date: Tue, 5 Jan 2016 22:26:02 -0700 (MST)	[thread overview]
Message-ID: <1452057962347-1273362.post@n7.nabble.com> (raw)
In-Reply-To: <20150320132914.GA1749@ws.net.home>

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.

      parent reply	other threads:[~2016-01-06  6:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 13:29 Karel Zak
2015-03-20 13:31 ` Al Viro
2015-03-20 13:41 ` Josh Boyer
2015-03-20 16:01   ` Miklos Szeredi
2015-03-20 16:25     ` Al Viro
2015-03-20 16:53       ` Miklos Szeredi
2015-03-20 18:16         ` Miklos Szeredi
2016-01-06  5:26 ` sangeetha Busangari [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452057962347-1273362.post@n7.nabble.com \
    --to=sangeetha.785@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome