Skip to content

Commit

Permalink
init-rbdmap: fix for recursive umount
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ksperis committed Aug 13, 2013
1 parent b9a5664 commit d9cb2ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/init-rbdmap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d9cb2ea

Please sign in to comment.