Blame gfs2/scripts/gfs2_withdraw_helper

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