All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: namespace question
@ 2005-06-23 18:31 cspalletta
  2005-06-23 21:23 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: cspalletta @ 2005-06-23 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: mikew

 
---- Mike Waychison <mikew@google.com> wrote: 
> 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 using dpath iteratively on the mnt_mountpoint member ... I get a curious doubling of the mount point names:

>> 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

>  Using the same algorithm with mnt_root produces correct results.  

> >                 dentry = dget(vfsmnt_ptr->mnt_mountpoint);
> 
> should be:
> 
> dentry = dget(vfsmnt_ptr->mnt_root);

Yes I pointed that out above - what I want to know is why the doubling of the names for mnt_mntpoint.  It must be used for something, I suppose.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: namespace question
  2005-06-23 18:31 namespace question cspalletta
@ 2005-06-23 21:23 ` Al Viro
  0 siblings, 0 replies; 4+ messages in thread
From: Al Viro @ 2005-06-23 21:23 UTC (permalink / raw)
  To: cspalletta; +Cc: linux-kernel, mikew

On Thu, Jun 23, 2005 at 02:31:02PM -0400, cspalletta@adelphia.net wrote:
> > > Running a kernel module using dpath iteratively on the mnt_mountpoint member ... I get a curious doubling of the mount point names:
> 
> >> 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
> 
> >  Using the same algorithm with mnt_root produces correct results.  
> 
> > >                 dentry = dget(vfsmnt_ptr->mnt_mountpoint);
> > 
> > should be:
> > 
> > dentry = dget(vfsmnt_ptr->mnt_root);
> 
> Yes I pointed that out above - what I want to know is why the doubling of the names for mnt_mntpoint.  It must be used for something, I suppose.

You are passing d_path() inconsistent arguments and get BS result.
Garbage in, garbage out...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: namespace question
  2005-06-23 15:03 cspalletta
@ 2005-06-23 16:25 ` Mike Waychison
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Waychison @ 2005-06-23 16:25 UTC (permalink / raw)
  To: cspalletta; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* namespace question
@ 2005-06-23 15:03 cspalletta
  2005-06-23 16:25 ` Mike Waychison
  0 siblings, 1 reply; 4+ messages in thread
From: cspalletta @ 2005-06-23 15:03 UTC (permalink / raw)
  To: linux-kernel

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);

                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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-23 21:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-23 18:31 namespace question cspalletta
2005-06-23 21:23 ` Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2005-06-23 15:03 cspalletta
2005-06-23 16:25 ` Mike Waychison

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.