Package: aoetools
Version: 30-3
Severity: normal
Tags: patch


There are two issues with /etc/init.d/aoetools.  One is on startup, the
second on stop.

I have a patch - hopefully attached to this report.  I didn't bother to send
a patch for /etc/default/aoetools, where i've only defined AOE_TMOUT to be
30.


The startup problem
~~~~~~~~~~~~~~~~~~~

Scenario:

 - ocfs2 filesystem 
 - on an aoe device 
 - accessed via the bond0 (round-robin) interface

the relevant line in fstab is 

/dev/etherd/e104.0 /srv ocfs2 defaults,_netdev 0 0


What happens with the original setup is that 

 1 bond0 is brought up with ifup
 2 the aoe module is loaded and /dev/etherd/discover shows up
 3 /etc/init.d/aoetools tries to mount /srv, but /dev/etherd/e104.0 doesn't
   yet exist
 4 the ocfs2 cluster gets initialized and /etc/init.d/ocfs2 tries to mount 
   /srv, but the block device is still not there
 5 link comes up on the slaves of bond0
 6 /dev/etherd/e104.0 is discovered (a few long seconds too late)


My solution:

- keep list of block devices rather than mountpoints in $waitaoe
- in a time-limited loop, test for the presence of a block device before
  trying to mount it or sleep one second otherwise
- the above loop is limited to $AOE_TMOUT (defined in /etc/default/aoetools)
  seconds




The stop problem
~~~~~~~~~~~~~~~~

In my setup, "/etc/init.d/ocfs2 stop" will umount the AOE-backed filesystem,
so when "/etc/init.d/aoetools stop" tries to umount it (again!), the umount
command fails, and because of the "set -e", the script exits immediately,
skipping the LVM/vgchange part and the removing of the module.

My approach was to check if the block device is mounted before trying to
umount.


I hope my changes to the init script don't break anything else.  In
particular, I haven't tested any LVM on AOE on this system.



Regards,
adc

 


-- System Information:
Debian Release: 5.0.3
  APT prefers proposed-updates
  APT policy: (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-openvz-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages aoetools depends on:
ii  libc6                       2.7-18lenny1 GNU C Library: Shared libraries
ii  lsb-base                    3.2-20       Linux Standard Base 3.2 init scrip

aoetools recommends no packages.

aoetools suggests no packages.

-- no debconf information
--- aoetools.debian     2009-12-03 11:18:57.000000000 -0500
+++ aoetools    2009-12-03 12:09:03.000000000 -0500
@@ -61,7 +61,7 @@
             continue
             ;;
           /dev/etherd/*)
-            waitaoe="$waitaoe $MTPT"
+            waitaoe="$waitaoe $DEV"
         esac
     done
 
@@ -130,10 +130,28 @@
 
     if [ -n "$waitaoe" ]
     then
-        for mountpt in $waitaoe; do
-            echo "Mounting $mountpt..."
-            mount $mountpt
-            #log_action_begin_msg "Waiting for $mountpt."
+        for dev in $waitaoe; do
+           i=0
+            echo -n "Waiting for and mounting $dev:"
+            while test $i -lt $AOE_TMOUT
+            do
+               if test -b $dev
+               then
+                   echo -n " ready,"
+                   mount $dev && echo "  mounted." || echo ""
+                   break
+               else
+                   aoe-discover 
+                   echo -n "."
+                   sleep 1
+                   let i=$i+1
+               fi
+           done                
+           if test $i -eq $AOE_TMOUT
+           then
+               echo " TIMEOUT!!"
+           fi
+            #log_action_begin_msg "Waiting for $dev."
         done
     else
        echo "Nothing to mount."
@@ -145,9 +163,8 @@
 
     if [ -n "$waitaoe" ]
     then
-        for mountpt in $waitaoe; do
-            echo "Unmounting $mountpt..."
-            umount $mountpt
+        for dev in $waitaoe; do
+           grep ^$dev /proc/mounts && echo "Unmounting $dev..." && umount $dev
         done
     fi
 
@@ -171,7 +188,7 @@
     
        ;;
   stop)
-       echo -n "Stopping $DESC: "
+       echo "Stopping $DESC: "
 
     do_stop
 

Reply via email to