Blame gfs2/scripts/gfs2_withdraw_helper
|
Packit Service |
360c39 |
#!/bin/sh
|
|
Packit Service |
360c39 |
#
|
|
Packit Service |
360c39 |
# Do not run this script manually. This script is called by udev on a gfs2
|
|
Packit Service |
360c39 |
# withdraw uevent and is used to complete the withdraw action and notify the
|
|
Packit Service |
360c39 |
# kernel.
|
|
Packit Service |
360c39 |
#
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
# Sanity checks
|
|
Packit Service |
360c39 |
if [ "$SUBSYSTEM" != "gfs2" ] || [ "$LOCKPROTO" != "lock_dlm" ] ||
|
|
Packit Service |
360c39 |
[ -z "$DEVPATH" ] || [ "$ACTION" != "offline" ]
|
|
Packit Service |
360c39 |
then
|
|
Packit Service |
360c39 |
exit 1 # Nothing to do here
|
|
Packit Service |
360c39 |
fi
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
# Try and suspend the device
|
|
Packit Service |
360c39 |
SYSFS_TOPDIR="/sys"$DEVPATH
|
|
Packit Service |
360c39 |
DM_NAME=$(cat "$SYSFS_TOPDIR/device/dm/name")
|
|
Packit Service |
360c39 |
DM_DEV="/dev/mapper/"$DM_NAME
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
if [ -z "$DM_DEV" ]
|
|
Packit Service |
360c39 |
then
|
|
Packit Service |
360c39 |
/usr/bin/dmsetup suspend $DM_DEV
|
|
Packit Service |
360c39 |
fi
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
# Signal completion of withdraw
|
|
Packit Service |
360c39 |
WD_ACK="$SYSFS_TOPDIR/lock_module/withdraw"
|
|
Packit Service |
360c39 |
if [ -f "$WD_ACK" ]
|
|
Packit Service |
360c39 |
then
|
|
Packit Service |
360c39 |
echo "1" > $WD_ACK
|
|
Packit Service |
360c39 |
fi
|