[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    Re: [Linux-ha-dev] [patch] OCF Filesystem agent doesn't check
From:       Dejan Muhamedagic <dejanmm () fastmail ! fm>
Date:       2008-04-23 9:34:26
Message-ID: 20080423093425.GA24231 () rondo ! homenet
[Download RAW message or body]

Hi,

On Wed, Apr 23, 2008 at 02:40:59PM +1000, Simon Horman wrote:
> On Mon, Apr 21, 2008 at 10:45:59AM +0100, Andrew Suffield wrote:
> > On Mon, Apr 21, 2008 at 10:22:01AM +0100, David Lee wrote:
> > > Solaris doesn't have a "/proc/mounts".  What it does have is the ability
> > > (like Linux) to list the kernel mount table from a simple "mount" command.
> > 
> > Irritatingly, the Linux 'mount' command doesn't do this, it merely
> > dumps out whatever is in /etc/mtab at the time. This is because some
> > information relating to loopback and user mounts is only available in
> > mtab, since it's only used by the userspace tools.
> > 
> > This means it is similarly unreliable - the only way to find out
> > what the kernel's really up to on Linux is to inspect /proc/mounts
> > directly.
> 
> I wonder if entries that are not present in /proc/mounts might be a
> problem, especially as this information is used to search for and
> unmount sub-mounts under the managed mount-point.
> 
> In any case, is this patch what you were thinking of?
> 
> Index: heartbeat/resources/OCF/Filesystem
> ===================================================================
> --- heartbeat.orig/resources/OCF/Filesystem	2008-04-23 14:23:53.000000000 +1000
> +++ heartbeat/resources/OCF/Filesystem	2008-04-23 14:35:55.000000000 +1000
> @@ -177,9 +177,12 @@ flushbufs() {
>      return 0
>  }
>  
> -# Take advantage of /etc/mtab if present, use portable mount command
> -# otherwise. Normalize format to "dev mountpoint fstype".
> +# Take advantage of /proc/mounts or /etc/mtab if present,
> +# use portable mount command otherwise.
> +# Normalize format to "dev mountpoint fstype".
>  list_mounts() {
> +	if [ -f "/proc/mounts" -a -r "/proc/mounts" ]; then
> +		cut -d' ' -f1,2,3 </proc/mounts
>  	if [ -f "/etc/mtab" -a -r "/etc/mtab" ]; then

It should be elif here! I think that the patch is fine. BTW, not
being able to rely on mount(8) to print accurate information is
really a nuisance.

Cheers,

Dejan

>  		cut -d' ' -f1,2,3 </etc/mtab
>  	else
> 
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic