mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
teardown stray filesystems too
This commit is contained in:
parent
e21ef74f11
commit
181b1f9fec
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.86 -
|
Version 2.02.86 -
|
||||||
=================================
|
=================================
|
||||||
|
Teardown any stray devices with $COMMON_PREFIX during test runs.
|
||||||
Reinstate correct permissions when creating mirrors. [2.02.85]
|
Reinstate correct permissions when creating mirrors. [2.02.85]
|
||||||
Append 'm' attribute to pv_attr for missing PVs.
|
Append 'm' attribute to pv_attr for missing PVs.
|
||||||
Annotate CLVMD_CMD_SYNC_NAMES in decode_cmd.
|
Annotate CLVMD_CMD_SYNC_NAMES in decode_cmd.
|
||||||
|
@ -90,34 +90,47 @@ teardown_devs() {
|
|||||||
rm -f DEVICES # devs is set in prepare_devs()
|
rm -f DEVICES # devs is set in prepare_devs()
|
||||||
rm -f LOOP
|
rm -f LOOP
|
||||||
|
|
||||||
# Try to remove test devices
|
# Attempt to remove any loop devices that failed to get torn down if earlier tests aborted
|
||||||
# resume any linears to be sure we do not deadlock
|
test -n "$COMMON_PREFIX" && {
|
||||||
STRAY_DEVS=$(dmsetup table | grep linear | sed 's/:.*//' | grep $COMMON_PREFIX | cut -d' ' -f 1)
|
# Resume any linears to be sure we do not deadlock
|
||||||
for dm in $STRAY_DEVS ; do
|
|
||||||
# FIXME: only those really suspended
|
|
||||||
dmsetup resume $dm 2>/dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
# Now try to remove devices
|
|
||||||
finish=0
|
|
||||||
while [ $finish -eq 0 ] ; do
|
|
||||||
finish=1
|
|
||||||
STRAY_DEVS=$(dmsetup table | sed 's/:.*//' | grep $COMMON_PREFIX | cut -d' ' -f 1)
|
STRAY_DEVS=$(dmsetup table | sed 's/:.*//' | grep $COMMON_PREFIX | cut -d' ' -f 1)
|
||||||
for dm in $STRAY_DEVS ; do
|
for dm in $STRAY_DEVS ; do
|
||||||
echo "Trying to remove stalled $dm"
|
# FIXME: only those really suspended
|
||||||
dmsetup remove $dm 2>/dev/null
|
echo dmsetup resume $dm
|
||||||
# Sucessful remove means repeat the loop once more
|
dmsetup resume $dm || true
|
||||||
[ $? -eq 0 ] && finish=0
|
|
||||||
done
|
done
|
||||||
done
|
|
||||||
|
|
||||||
# Remove any loop devices that failed to get torn down if earlier tests aborted
|
STRAY_MOUNTS=`mount | grep $COMMON_PREFIX | cut -d\ -f1`
|
||||||
STRAY_LOOPS=`losetup -a | grep $COMMON_PREFIX | cut -d: -f1`
|
if test -n "$STRAY_MOUNTS"; then
|
||||||
if test -n "$STRAY_LOOPS"; then
|
echo "Removing stray mounted devices containing $COMMON_PREFIX:"
|
||||||
echo "Removing stray loop devices containing $COMMON_PREFIX:"
|
mount | grep $COMMON_PREFIX
|
||||||
losetup -a | grep $COMMON_PREFIX
|
umount -fl $STRAY_MOUNTS || true
|
||||||
losetup -d $STRAY_LOOPS 2>/dev/null || true
|
sleep 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
init_udev_transaction
|
||||||
|
NUM_REMAINING_DEVS=999
|
||||||
|
while NUM_DEVS=`dmsetup table | grep ^$COMMON_PREFIX | wc -l` && \
|
||||||
|
test $NUM_DEVS -lt $NUM_REMAINING_DEVS -a $NUM_DEVS -ne 0; do
|
||||||
|
echo "Removing $NUM_DEVS stray mapped devices with names beginning with $COMMON_PREFIX:"
|
||||||
|
STRAY_DEVS=$(dmsetup table | sed 's/:.*//' | grep $COMMON_PREFIX | cut -d' ' -f 1)
|
||||||
|
dmsetup info -c | grep ^$COMMON_PREFIX
|
||||||
|
for dm in $STRAY_DEVS ; do
|
||||||
|
echo dmsetup remove $dm
|
||||||
|
dmsetup remove $dm || true
|
||||||
|
done
|
||||||
|
NUM_REMAINING_DEVS=$NUM_DEVS
|
||||||
|
done
|
||||||
|
finish_udev_transaction
|
||||||
|
udev_wait
|
||||||
|
|
||||||
|
STRAY_LOOPS=`losetup -a | grep $COMMON_PREFIX | cut -d: -f1`
|
||||||
|
if test -n "$STRAY_LOOPS"; then
|
||||||
|
echo "Removing stray loop devices containing $COMMON_PREFIX:"
|
||||||
|
losetup -a | grep $COMMON_PREFIX
|
||||||
|
losetup -d $STRAY_LOOPS || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
Loading…
Reference in New Issue
Block a user