From: Laurent Barbe Date: Tue, 13 Aug 2013 15:16:35 +0000 (+0200) Subject: init-rbdmap: fix for recursive umount X-Git-Tag: v0.68~87^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d9cb2ead36e1338079da624e1b95e9621bfda1ef;p=ceph.git init-rbdmap: fix for recursive umount 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 --- diff --git a/src/init-rbdmap b/src/init-rbdmap index 6ea4af7624b5..16d618a6c0d5 100755 --- a/src/init-rbdmap +++ b/src/init-rbdmap @@ -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