public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Waychison <mikew@google.com>
To: cspalletta@adelphia.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: namespace question
Date: Thu, 23 Jun 2005 09:25:36 -0700	[thread overview]
Message-ID: <42BAE280.1000801@google.com> (raw)
In-Reply-To: <12745583.1119539003004.JavaMail.root@web10.mail.adelphia.net>

cspalletta@adelphia.net wrote:
> I don't believe the following to be an error, but I am curious how it occurs:
> 
> Running a kernel module which uses d_path iteratively over the mnt_mountpoint members of the vfsmount structures which hang off of current->namespace->list, I get a curious doubling of the mount point names:
> 
> rootfs / rootfs
> /dev2/root2 / ext3
> proc /proc/proc proc
> sysfs /sys/sys sysfs
> devpts /dev/pts/dev/pts devpts
> tmpfs /dev/shm/dev/shm tmpfs
> /dev/hda1 /boot/boot ext2
> usbfs /proc/bus/usb/bus/usb usbfs
> 
> Is there any simple explanation? I have cross-checked and it appears _not_ be be an artifact of my programming, and I have no CLONE_NEWNS processes. Using the same algorithm with mnt_root produces correct results.  
> 
> The code follows:
> 
>         char *path;
> ...
>         namespace = current-> namespace
>         down_read(&namespace->sem);
>         list_for_each_entry(vfsmnt_ptr,&namespace->list,mnt_list) {
>                 mount = mntget(vfsmnt_ptr);
>                 dentry = dget(vfsmnt_ptr->mnt_mountpoint);

should be:

dentry = dget(vfsmnt_ptr->mnt_root);

> 
>                 device = vfsmnt_ptr->mnt_devname ? vfsmnt_ptr->mnt_devname : "none";
> 
>                 path = d_path(dentry, mount, buf, PAGE_SIZE);
>                 error = PTR_ERR(path);
>                 if(IS_ERR(path)) {
>                         dput(dentry);
>                         mntput(mount);
>                         goto out;
>                 }
> 
>                 fstype = vfsmnt_ptr->mnt_sb->s_type->name;
>                 printk("%s\t%s\t%s\n",device,path,fstype);
> ---
> 
> $ uname -a
> Linux nectarsys 2.6.10-1-k7 #1 Fri Mar 11 03:13:32 EST 2005 i686 GNU/Linux
> 
> 
> 
> 


Mike Waychison

  reply	other threads:[~2005-06-23 16:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-23 15:03 namespace question cspalletta
2005-06-23 16:25 ` Mike Waychison [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-06-23 18:31 cspalletta
2005-06-23 21:23 ` Al Viro

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=42BAE280.1000801@google.com \
    --to=mikew@google.com \
    --cc=cspalletta@adelphia.net \
    --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