|
|
db8e98 |
commit 40b872651561de2e8a06fdb1b792be8874e2b19a
|
|
|
db8e98 |
Author: Abhi Das <adas@redhat.com>
|
|
|
db8e98 |
Date: Tue Aug 4 11:00:51 2015 -0500
|
|
|
db8e98 |
|
|
|
db8e98 |
gfs2-utils: Fix hang on withdraw
|
|
|
db8e98 |
|
|
|
db8e98 |
Issuing a withdraw on a gfs2 filesystem causes a hang. When
|
|
|
db8e98 |
gfs_controld was removed, the userspace functionality that
|
|
|
db8e98 |
completes a withdraw operation went away. This causes gfs2
|
|
|
db8e98 |
kernel to hang waiting for a withdraw completion ack from
|
|
|
db8e98 |
userspace.
|
|
|
db8e98 |
|
|
|
db8e98 |
This patchset introduces a uevent-based shell script to do
|
|
|
db8e98 |
the job that gfs_controld used to do on withdraw. An 'offline'
|
|
|
db8e98 |
uevent triggers the execution of this script. This script
|
|
|
db8e98 |
suspends the device associated with the filesystem and signals
|
|
|
db8e98 |
a completed withdraw to the kernel.
|
|
|
db8e98 |
|
|
|
db8e98 |
Resolves: rhbz#1225634
|
|
|
db8e98 |
Signed-off-by: Abhi Das <adas@redhat.com>
|
|
|
db8e98 |
|
|
|
db8e98 |
diff --git a/README.build b/README.build
|
|
|
db8e98 |
index f4ebe53..6487bae 100644
|
|
|
db8e98 |
--- a/README.build
|
|
|
db8e98 |
+++ b/README.build
|
|
|
db8e98 |
@@ -29,5 +29,14 @@ To install gfs2-utils, run:
|
|
|
db8e98 |
|
|
|
db8e98 |
make install
|
|
|
db8e98 |
|
|
|
db8e98 |
+The following scripts (located in gfs2/scripts) are used to complete
|
|
|
db8e98 |
+the userland portion of the gfs2 withdraw feature using uevents. They
|
|
|
db8e98 |
+are not installed by 'make install' and need to be installed manually
|
|
|
db8e98 |
+or during rpm installation to the corresponding locations.
|
|
|
db8e98 |
+
|
|
|
db8e98 |
+ 82-gfs2-withdraw.rules in /etc/udev/rules.d/
|
|
|
db8e98 |
+ gfs2_wd_udev.sh in /usr/sbin/
|
|
|
db8e98 |
+
|
|
|
db8e98 |
See also doc/README.contributing for details on submitting patches and
|
|
|
db8e98 |
doc/README.tests for more details regarding the test suite.
|
|
|
db8e98 |
+
|
|
|
db8e98 |
diff --git a/gfs2/scripts/82-gfs2-withdraw.rules b/gfs2/scripts/82-gfs2-withdraw.rules
|
|
|
db8e98 |
new file mode 100644
|
|
|
db8e98 |
index 0000000..2228615
|
|
|
db8e98 |
--- /dev/null
|
|
|
db8e98 |
+++ b/gfs2/scripts/82-gfs2-withdraw.rules
|
|
|
db8e98 |
@@ -0,0 +1,2 @@
|
|
|
db8e98 |
+SUBSYSTEM=="gfs2", ACTION=="offline", RUN+="/bin/sh /usr/sbin/gfs2_wd_udev.sh"
|
|
|
db8e98 |
+
|
|
|
db8e98 |
diff --git a/gfs2/scripts/Makefile.am b/gfs2/scripts/Makefile.am
|
|
|
db8e98 |
index 62fb2fe..dde906f 100644
|
|
|
db8e98 |
--- a/gfs2/scripts/Makefile.am
|
|
|
db8e98 |
+++ b/gfs2/scripts/Makefile.am
|
|
|
db8e98 |
@@ -3,3 +3,8 @@ MAINTAINERCLEANFILES = Makefile.in
|
|
|
db8e98 |
dist_sbin_SCRIPTS = \
|
|
|
db8e98 |
gfs2_lockcapture \
|
|
|
db8e98 |
gfs2_trace
|
|
|
db8e98 |
+
|
|
|
db8e98 |
+noinst_SCRIPTS = \
|
|
|
db8e98 |
+ 82-gfs2-withdraw.rules \
|
|
|
db8e98 |
+ gfs2_wd_udev.sh
|
|
|
db8e98 |
+
|
|
|
db8e98 |
diff --git a/gfs2/scripts/gfs2_wd_udev.sh b/gfs2/scripts/gfs2_wd_udev.sh
|
|
|
db8e98 |
new file mode 100755
|
|
|
db8e98 |
index 0000000..ac3ce35
|
|
|
db8e98 |
--- /dev/null
|
|
|
db8e98 |
+++ b/gfs2/scripts/gfs2_wd_udev.sh
|
|
|
db8e98 |
@@ -0,0 +1,30 @@
|
|
|
db8e98 |
+#!/bin/sh
|
|
|
db8e98 |
+#
|
|
|
db8e98 |
+# Do not run this script manually. This script is called by udev on a gfs2
|
|
|
db8e98 |
+# withdraw uevent and is used to complete the withdraw action and notify the
|
|
|
db8e98 |
+# kernel.
|
|
|
db8e98 |
+#
|
|
|
db8e98 |
+
|
|
|
db8e98 |
+# Sanity checks
|
|
|
db8e98 |
+if [ "$SUBSYSTEM" != "gfs2" ] || [ "$LOCKPROTO" != "lock_dlm" ] ||
|
|
|
db8e98 |
+ [ -z "$DEVPATH" ] || [ "$ACTION" != "offline" ]
|
|
|
db8e98 |
+then
|
|
|
db8e98 |
+ exit 1 # Nothing to do here
|
|
|
db8e98 |
+fi
|
|
|
db8e98 |
+
|
|
|
db8e98 |
+# Try and suspend the device
|
|
|
db8e98 |
+SYSFS_TOPDIR="/sys"$DEVPATH
|
|
|
db8e98 |
+DM_NAME=$(cat "$SYSFS_TOPDIR/device/dm/name")
|
|
|
db8e98 |
+DM_DEV="/dev/mapper/"$DM_NAME
|
|
|
db8e98 |
+
|
|
|
db8e98 |
+if [ -z "$DM_DEV" ]
|
|
|
db8e98 |
+then
|
|
|
db8e98 |
+ /usr/bin/dmsetup suspend $DM_DEV
|
|
|
db8e98 |
+fi
|
|
|
db8e98 |
+
|
|
|
db8e98 |
+# Signal completion of withdraw
|
|
|
db8e98 |
+WD_ACK="$SYSFS_TOPDIR/lock_module/withdraw"
|
|
|
db8e98 |
+if [ -f "$WD_ACK" ]
|
|
|
db8e98 |
+then
|
|
|
db8e98 |
+ echo "1" > $WD_ACK
|
|
|
db8e98 |
+fi
|