commit 60db3c365128dc8aa7e0d3c903c426c8a743b8e2 Author: Andrew Price Date: Tue Aug 18 12:35:52 2015 +0100 scripts: rename gfs2_wd_udev.sh to gfs2_withdraw_helper Makes the name more descriptive and consistent with the name of the udev rules script. Resolves: rhbz#1225634 Signed-off-by: Andrew Price diff --git a/README.build b/README.build index 6487bae..acfde1b 100644 --- a/README.build +++ b/README.build @@ -35,7 +35,7 @@ are not installed by 'make install' and need to be installed manually or during rpm installation to the corresponding locations. 82-gfs2-withdraw.rules in /etc/udev/rules.d/ - gfs2_wd_udev.sh in /usr/sbin/ + gfs2_withdraw_helper in /usr/sbin/ See also doc/README.contributing for details on submitting patches and doc/README.tests for more details regarding the test suite. diff --git a/gfs2/scripts/82-gfs2-withdraw.rules b/gfs2/scripts/82-gfs2-withdraw.rules index 2228615..2c9e0e8 100644 --- a/gfs2/scripts/82-gfs2-withdraw.rules +++ b/gfs2/scripts/82-gfs2-withdraw.rules @@ -1,2 +1,2 @@ -SUBSYSTEM=="gfs2", ACTION=="offline", RUN+="/bin/sh /usr/sbin/gfs2_wd_udev.sh" +SUBSYSTEM=="gfs2", ACTION=="offline", RUN+="/bin/sh /usr/sbin/gfs2_withdraw_helper" diff --git a/gfs2/scripts/Makefile.am b/gfs2/scripts/Makefile.am index dde906f..51764fa 100644 --- a/gfs2/scripts/Makefile.am +++ b/gfs2/scripts/Makefile.am @@ -6,5 +6,5 @@ dist_sbin_SCRIPTS = \ noinst_SCRIPTS = \ 82-gfs2-withdraw.rules \ - gfs2_wd_udev.sh + gfs2_withdraw_helper diff --git a/gfs2/scripts/gfs2_wd_udev.sh b/gfs2/scripts/gfs2_wd_udev.sh deleted file mode 100755 index ac3ce35..0000000 --- a/gfs2/scripts/gfs2_wd_udev.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# Do not run this script manually. This script is called by udev on a gfs2 -# withdraw uevent and is used to complete the withdraw action and notify the -# kernel. -# - -# Sanity checks -if [ "$SUBSYSTEM" != "gfs2" ] || [ "$LOCKPROTO" != "lock_dlm" ] || - [ -z "$DEVPATH" ] || [ "$ACTION" != "offline" ] -then - exit 1 # Nothing to do here -fi - -# Try and suspend the device -SYSFS_TOPDIR="/sys"$DEVPATH -DM_NAME=$(cat "$SYSFS_TOPDIR/device/dm/name") -DM_DEV="/dev/mapper/"$DM_NAME - -if [ -z "$DM_DEV" ] -then - /usr/bin/dmsetup suspend $DM_DEV -fi - -# Signal completion of withdraw -WD_ACK="$SYSFS_TOPDIR/lock_module/withdraw" -if [ -f "$WD_ACK" ] -then - echo "1" > $WD_ACK -fi diff --git a/gfs2/scripts/gfs2_withdraw_helper b/gfs2/scripts/gfs2_withdraw_helper new file mode 100755 index 0000000..ac3ce35 --- /dev/null +++ b/gfs2/scripts/gfs2_withdraw_helper @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Do not run this script manually. This script is called by udev on a gfs2 +# withdraw uevent and is used to complete the withdraw action and notify the +# kernel. +# + +# Sanity checks +if [ "$SUBSYSTEM" != "gfs2" ] || [ "$LOCKPROTO" != "lock_dlm" ] || + [ -z "$DEVPATH" ] || [ "$ACTION" != "offline" ] +then + exit 1 # Nothing to do here +fi + +# Try and suspend the device +SYSFS_TOPDIR="/sys"$DEVPATH +DM_NAME=$(cat "$SYSFS_TOPDIR/device/dm/name") +DM_DEV="/dev/mapper/"$DM_NAME + +if [ -z "$DM_DEV" ] +then + /usr/bin/dmsetup suspend $DM_DEV +fi + +# Signal completion of withdraw +WD_ACK="$SYSFS_TOPDIR/lock_module/withdraw" +if [ -f "$WD_ACK" ] +then + echo "1" > $WD_ACK +fi