Merge "Check for mount before demoting DRBD filesystem"

This commit is contained in:
Zuul 2019-02-07 21:13:34 +00:00 committed by Gerrit Code Review
commit b880a911db
3 changed files with 49 additions and 2 deletions

View File

@ -1,4 +1,4 @@
COPY_LIST="$FILES_BASE/* \
$DISTRO/patches/* \
$CGCS_BASE/downloads/drbd-8.4.3.tar.gz"
TIS_PATCH_VER=6
TIS_PATCH_VER=7

View File

@ -34,7 +34,7 @@ Source: http://oss.linbit.com/%{name}/8.3/%{name}-%{version}.tar.gz
Source1: drbd.service
# WRS
# StarlingX
Patch0001: 0001-skip_wait_con_int_on_simplex.patch
Patch0002: 0002-drbd-conditional-crm-dependency.patch
Patch0003: 0003-drbd_report_condition.patch
@ -43,6 +43,7 @@ Patch0005: 0005-drbd_reconnect_standby_standalone.patch
Patch0006: 0006-avoid-kernel-userspace-version-check.patch
Patch0007: 0007-Update-OCF-to-attempt-connect-in-certain-states.patch
Patch0008: 0008-Increase-short-cmd-timeout-to-15-secs.patch
Patch0009: 0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch
License: GPLv2+
ExclusiveOS: linux
@ -271,6 +272,7 @@ management utility.
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%build
%configure \

View File

@ -0,0 +1,45 @@
From 017157d21a56410811384a43d0b0cbba6444baeb Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Wed, 6 Feb 2019 01:19:59 -0500
Subject: [PATCH] Check for mounted device before demoting Primary DRBD
resource
Update the OCF script to check for a mounted device when demoting
a resource that's in the Primary state. The state change will fail
if it is still in use, otherwise.
Signed-off-by: Don Penney <don.penney@windriver.com>
---
scripts/drbd.ocf | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index e03bf6d..95da11a 100644
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -720,7 +720,21 @@ drbd_stop() {
;;
$OCF_RUNNING_MASTER)
ocf_log warn "$DRBD_RESOURCE still Primary, demoting."
- do_drbdadm secondary $DRBD_RESOURCE
+ found=no
+ for dev in ${DRBD_DEVICES[@]} ""; do
+ cat /proc/mounts | grep -q "^${dev} "
+ if [ $? -eq 0 ]; then
+ ocf_log warn "${DRBD_RESOURCE} is still mounted via $dev"
+ found=yes
+ break
+ fi
+ done
+ if [ "${found}" = "yes" ]; then
+ ocf_log warn "Waiting to drop $DRBD_RESOURCE"
+ else
+ ocf_log warn "Dropping $DRBD_RESOURCE to Secondary"
+ do_drbdadm secondary $DRBD_RESOURCE
+ fi
esac
$first_try || sleep 1
first_try=false
--
1.8.3.1