[parted-devel] [PATCH] unneeded stats...

Joel Granados jgranado at redhat.com
Mon Feb 23 18:50:28 UTC 2009

On Mon, Feb 23, 2009 at 04:10:58PM +0000, Bryn M. Reeves wrote:
> Joel Granados wrote:
>> On Mon, Feb 23, 2009 at 03:50:02PM +0000, Bryn M. Reeves wrote:
>>> Joel Granados Moreno wrote:
>>>> Hello List
>>>> Here is the reviewed patch for the unneeded stats that we are doing when
>>>> looking for mounted devices.  It is modified to not search for "server
>>>> strings" (//servername/path/to/somewhere)
>>>> Review appreciated
>>> There's a slight gotcha with this approach in that the kernel will   
>>> honour the names that userspace gives it in a mount syscall. E.g. if 
>>> I  mount /dev/sda then that's what appears in /proc/mounts but if I 
>>> mount  //dev/sda, then that's the string that will appear.
>>> E.g.:
>>> # mount //dev/mapper/cyan /mnt
>>> # grep cyan /proc/mounts
>>> //dev/mapper/cyan /mnt ext3 rw,data=ordered 0 0
>> I tested for this situation in my fedora10 environment  With the latest
>> parted.  And if I do the mount with "//" /proc/mounts will show it with
> Yep, just confirmed that on my f10 box so this has changed somewhere  
> between RHEL5's 2.6.18 (where I tested previously) and current upstream.
>> just one.  This comment does make me doubt a little of the patch.  The
>> question here is, will kernel always have this behavior for now on?
> I think we still need to take account of this as users could be running 
> on pretty much any kernel release. It'd be useful if there was a simple 
> check that could tell us whether or not the running kernel will collapse 
> slashes in mounts but I don't think such a think exists.

Be aware that it does not depend on the kernel.  Actually the kernel in
rhel5 does not colaps slashes and the same goes for the one in fedora10.
The one who collapses slashes is mount, before calling mount(3).  If one
calls mount(3) with tow slashes it will show the two slashes in
/proc/mount.  Try with the attached file.  Change the strings to
something that makes sense in you ENV and execute it.
> Regards,
> Bryn.

Joel Andres Granados
Brno, Czech Republic, Red Hat.
-------------- next part --------------
#include <sys/mount.h>

    const char *source = "//dev/sdb1";
    const char *target = "/mnt";
    const char *filesystem = "ext3";
    unsigned long flags = 0;
    const char *data = "";

    mount(source, target, filesystem, flags, data);


More information about the parted-devel mailing list