]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-rbdmap: fix for recursive umount
authorLaurent Barbe <laurent@ksperis.com>
Tue, 13 Aug 2013 15:16:35 +0000 (17:16 +0200)
committerLaurent Barbe <laurent@ksperis.com>
Tue, 13 Aug 2013 16:06:14 +0000 (18:06 +0200)
Umount is not always done in the correct order.
For exemple in that case :
/dev/rbd1 on /myrbd
/dev/rbd2 on /myrbd/.snapshots/@GMT-2013.08.09-10.14.44
rbd2 should be umounted before rbd1

Signed-off-by: Laurent Barbe <laurent@ksperis.com>
src/init-rbdmap

index 6ea4af7624b5497965bccb4e7abe6e3a8ed6b501..16d618a6c0d5b432bd405b76674d806351fcf7ab 100755 (executable)
@@ -62,14 +62,14 @@ do_map() {
 do_unmap() {
        log_daemon_msg "Stopping $DESC"
        RET=0
+       # Recursive umount that depends /dev/rbd*
+       MNTDEP=$(findmnt --mtab | awk '$2 ~ /^\/dev\/rbd[0-9]*$/ {print $1}' | sort -r)
+       for MNT in $MNTDEP; do
+               umount $MNT
+       done 
        # Unmap all rbd device
        for DEV in /dev/rbd[0-9]*; do
                log_progress_msg $DEV
-               # Umount before unmap
-               MNTDEP=$(findmnt --mtab --source $DEV --output TARGET | sed 1,1d | sort -r)
-               for MNT in $MNTDEP; do
-                       umount $MNT || sleep 1 && umount -l $DEV
-               done
                rbd unmap $DEV
                [ $? -ne "0" ] && RET=1
        done