diff --git a/gfs2-utils.spec b/gfs2-utils.spec index 317796a..37dd1fc 100644 --- a/gfs2-utils.spec +++ b/gfs2-utils.spec @@ -12,7 +12,7 @@ Name: gfs2-utils Version: 3.1.8 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Kernel Summary: Utilities for managing the global file system (GFS2) @@ -33,11 +33,17 @@ Source: https://fedorahosted.org/released/gfs2-utils/gfs2-utils-%{version}.tar.g URL: https://fedorahosted.org/cluster/wiki/HomePage Patch0: fsck_gfs2_replace_recent_i_goal_fixes_with_simple_logic.patch Patch1: gfs2_utils_Fix_hang_on_withdraw.patch +Patch2: scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch +Patch3: scripts_install_the_withdraw_helper_script.patch +Patch4: scripts_install_the_withdraw_udev_rules_script.patch %prep %setup -q -n gfs2-utils-%{version} %patch0 -p 1 -b .fsck_gfs2_replace_recent_i_goal_fixes_with_simple_logic %patch1 -p 1 -b .gfs2_utils_Fix_hang_on_withdraw +%patch2 -p 1 -b .scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper +%patch3 -p 1 -b .scripts_install_the_withdraw_helper_script +%patch4 -p 1 -b .scripts_install_the_withdraw_udev_rules_script %build ./autogen.sh @@ -54,10 +60,6 @@ rm -f %{buildroot}/usr/sbin/gfs2_trace rm -f %{buildroot}/usr/sbin/gfs2_lockcapture rm -f %{buildroot}%{_mandir}/man8/gfs2_trace.8 rm -f %{buildroot}%{_mandir}/man8/gfs2_lockcapture.8 -# Install withdraw helper scripts -install -m 755 gfs2/scripts/gfs2_wd_udev.sh %{buildroot}%{_sbindir}/ -install -D -m 644 gfs2/scripts/82-gfs2-withdraw.rules \ - %{buildroot}%{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules %description The gfs2-utils package contains a number of utilities for creating, @@ -74,12 +76,19 @@ file systems. %{_sbindir}/gfs2_convert %{_sbindir}/gfs2_edit %{_sbindir}/tunegfs2 -%{_sbindir}/gfs2_wd_udev.sh +%{_sbindir}/gfs2_withdraw_helper %{_mandir}/man8/*gfs2* %{_mandir}/man5/* %{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules %changelog +* Thu Aug 20 2015 Andrew Price - 3.1.8-5 +- Add patches to install the withdraw helper script properly: + scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch + scripts_install_the_withdraw_helper_script.patch + scripts_install_the_withdraw_udev_rules_script.patch +- Remove the obsolete udev script installation bits + * Tue Aug 11 2015 Andrew Price - 3.1.8-4 - gfs2-utils: Fix hang on withdraw - Install udev withdraw handler scripts diff --git a/scripts_install_the_withdraw_helper_script.patch b/scripts_install_the_withdraw_helper_script.patch new file mode 100644 index 0000000..de2d182 --- /dev/null +++ b/scripts_install_the_withdraw_helper_script.patch @@ -0,0 +1,27 @@ +commit fdded71f349ec5928a1422bc7edaa7f4f6c0be26 +Author: Andrew Price +Date: Tue Aug 18 12:48:50 2015 +0100 + + scripts: install the withdraw helper script + + Install gfs2_withdraw_helper into /usr/sbin in 'make install'. + + Signed-off-by: Andrew Price + +diff --git a/gfs2/scripts/Makefile.am b/gfs2/scripts/Makefile.am +index 51764fa..056aaa5 100644 +--- a/gfs2/scripts/Makefile.am ++++ b/gfs2/scripts/Makefile.am +@@ -2,9 +2,9 @@ MAINTAINERCLEANFILES = Makefile.in + + dist_sbin_SCRIPTS = \ + gfs2_lockcapture \ +- gfs2_trace ++ gfs2_trace \ ++ gfs2_withdraw_helper + + noinst_SCRIPTS = \ +- 82-gfs2-withdraw.rules \ +- gfs2_withdraw_helper ++ 82-gfs2-withdraw.rules + diff --git a/scripts_install_the_withdraw_udev_rules_script.patch b/scripts_install_the_withdraw_udev_rules_script.patch new file mode 100644 index 0000000..430ea5e --- /dev/null +++ b/scripts_install_the_withdraw_udev_rules_script.patch @@ -0,0 +1,72 @@ +commit 9aa261bd5e65beb757b0953ba43211fc29641952 +Author: Andrew Price +Date: Wed Aug 19 12:13:39 2015 +0100 + + scripts: install the withdraw udev rules script + + Add a --with-udevdir configure option and default to $prefix/lib/udev. + Note that we can't use $libdir for this as that will often be /usr/lib64 + and the udevdir is arch-independent. + + Also add the autoconf bits needed to install 82-gfs2-withdraw.rules into + $udevdir/rules.d + + Signed-off-by: Andrew Price + +diff --git a/README.build b/README.build +index acfde1b..d0a21c3 100644 +--- a/README.build ++++ b/README.build +@@ -31,10 +31,9 @@ To install gfs2-utils, run: + + The following scripts (located in gfs2/scripts) are used to complete + the userland portion of the gfs2 withdraw feature using uevents. They +-are not installed by 'make install' and need to be installed manually +-or during rpm installation to the corresponding locations. ++will be installed by 'make install' to these directories by default: + +- 82-gfs2-withdraw.rules in /etc/udev/rules.d/ ++ 82-gfs2-withdraw.rules in /usr/lib/udev/rules.d/ + gfs2_withdraw_helper in /usr/sbin/ + + See also doc/README.contributing for details on submitting patches and +diff --git a/configure.ac b/configure.ac +index de96e5a..35cafe6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -110,6 +110,12 @@ if test -z "$ncurses_CFLAGS" && test -z "$ncurses_LIBS"; then + ncurses_LIBS=-lncurses + fi + ++AC_ARG_WITH([udevdir], ++ AS_HELP_STRING([--with-udevdir=DIR], ++ [udev directory containing rules.d [default=${prefix}/lib/udev]]), ++ [], [with_udevdir=\${prefix}/lib/udev]) ++AC_SUBST([udevdir], [$with_udevdir]) ++ + # Checks for header files. + AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h]) + AC_CHECK_HEADER([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h])]) +@@ -209,7 +215,9 @@ echo " Configure summary" + echo " ===================" + echo " prefix : $prefix" + echo " exec_prefix : $exec_prefix" ++echo " libdir : $libdir" + echo " sbindir : $sbindir" ++echo " udevdir : $udevdir" + echo " ------------------" + echo " debug build : $enable_debug" + echo " C unit tests : $have_check" +diff --git a/gfs2/scripts/Makefile.am b/gfs2/scripts/Makefile.am +index 056aaa5..d4bda04 100644 +--- a/gfs2/scripts/Makefile.am ++++ b/gfs2/scripts/Makefile.am +@@ -5,6 +5,6 @@ dist_sbin_SCRIPTS = \ + gfs2_trace \ + gfs2_withdraw_helper + +-noinst_SCRIPTS = \ ++udevrulesdir=@udevdir@/rules.d ++dist_udevrules_DATA = \ + 82-gfs2-withdraw.rules +- diff --git a/scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch b/scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch new file mode 100644 index 0000000..7f48867 --- /dev/null +++ b/scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch @@ -0,0 +1,115 @@ +commit bdb6bb67ee4532c2dfb65eeeebcec06bda99d4ff +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. + + 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