[parted-devel] [PATCH] unneeded stats...
jgranado at redhat.com
Mon Feb 23 17:01:45 UTC 2009
On Mon, Feb 23, 2009 at 05:46:17PM +0100, Karel Zak wrote:
> 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.
> The current mount(8) always canonicalize all paths, so it never call
> mount(2) syscall with '//'. (RHEL5 != current:-) The more important
> thing is kernel behaviour. You cannot rely on mount(8) -- there is
> more ways how to mount devices.
> I think the best way how to resolve this problem is to call stat(2)
> and ignore everything from /proc/mounts what is not S_IFBLK. It seems
> that paths are unreliable...
Well, I still see the use for the first version of the patch, the one that did not
check for "//". I mean, its still not relevant to check for "none" and
"tmpfs" as devices (and all strings that don't have "/" at the beginning).
Note that we are already stating and checking if they are S_IFBLK. This
comes after we make sure that we are not looking for none paths. So
when we find server mounts they *will* be ignored.
> Karel Zak <kzak at redhat.com>
Thx for the review
Joel Andres Granados
Brno, Czech Republic, Red Hat.
More information about the parted-devel