[parted-devel] Stop trying to read "none, sunrpc..."

Bryn M. Reeves bmr at redhat.com
Mon Nov 3 17:23:41 UTC 2008


Joel Granados wrote:
> Hey List:
> 
> Parted, when trying to figure out what device is mounted reads
> /proc/mounts, /proc/swaps and /etc/mtab.  Problem is thta these
> files sometimes contain lines tarting with "none", "sunrpc" and
> others.  This patch avoids these unnecessary IO operations.

I can't think of a situation in which the fs_spec column of these files
would not start with a '/' but where we would still want to continue to
do the stat so ACK to this change.

I had a couple of thoughts looking at this part of the code though - I
wonder if it wouldn't be better to change this routine to use getmntent
and friends instead, as this would avoid having to hard-code line buffer
sizes and invent our own parsing as is currently done.

Also, I think it might be possible to make the routine more robust -
e.g. I think right now, calling ped_partition_is_busy() for a device
that is not itself mounted, but which has a linear device-mapper device
mapped over it will return false, even though it is not safe to operate
on the content of the partition - need to test this & see if I can get
parted to do anything nasty because of it.

Regards,
Bryn.





More information about the parted-devel mailing list