diff --git a/SOURCES/bz1521019-db2-fix-hadr-promote-when-master-failed.patch b/SOURCES/bz1521019-db2-fix-hadr-promote-when-master-failed.patch
new file mode 100644
index 0000000..6f248cc
--- /dev/null
+++ b/SOURCES/bz1521019-db2-fix-hadr-promote-when-master-failed.patch
@@ -0,0 +1,31 @@
+From 051743955c4f1f5fe412875afba94edd2839008c Mon Sep 17 00:00:00 2001
+From: Oyvind Albrigtsen <oalbrigt@redhat.com>
+Date: Wed, 22 Nov 2017 12:25:41 +0100
+Subject: [PATCH] db2: fix HADR promote when master failed
+
+---
+ heartbeat/db2 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/heartbeat/db2 b/heartbeat/db2
+index 63de31582..b67363ec5 100755
+--- a/heartbeat/db2
++++ b/heartbeat/db2
+@@ -617,7 +617,7 @@ db2_instance_status() {
+     if [ $pscount -ge 4 ]; then
+         return $OCF_SUCCESS;
+     elif [ $pscount -ge 1 ]; then
+-        return $OCF_GENERIC_ERR
++        return $OCF_ERR_GENERIC
+     fi
+     return $OCF_NOT_RUNNING
+ }
+@@ -767,7 +767,7 @@ db2_promote() {
+             # must take over 
+             ;;
+ 
+-            STANDBY/PEER/DISCONNECTED|Standby/DisconnectedPeer)
++            STANDBY/PEER/DISCONNECTED|STANDBY/DISCONNECTED_PEER/DISCONNECTED|Standby/DisconnectedPeer)
+             # must take over forced 
+             force="by force peer window only"
+             ;;
diff --git a/SOURCES/bz1524454-ocf_attribute_target-fallback-fix.patch b/SOURCES/bz1524454-ocf_attribute_target-fallback-fix.patch
new file mode 100644
index 0000000..7225e55
--- /dev/null
+++ b/SOURCES/bz1524454-ocf_attribute_target-fallback-fix.patch
@@ -0,0 +1,35 @@
+From f0a7a64d644c604f84ec1668849e1cc5507a8ea8 Mon Sep 17 00:00:00 2001
+From: Damien Ciabrini <dciabrin@redhat.com>
+Date: Tue, 5 Dec 2017 10:43:10 +0100
+Subject: [PATCH] Fix fallback name for ocf_attribute_target
+
+For bundles, various resource agents now use ocf_attribute_target to
+get the name of the pacemaker node to store attributes on.
+
+If a recent version of the resource agent is being run on a pacemaker
+version which does not support bundles, ocf_attribute_target will
+return an empty string as hostname.
+
+Provide a fallback path so the resource agent gets a valid name when
+the resource is not containerized.
+---
+ heartbeat/ocf-shellfuncs.in | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
+index ddd6854e9..2fa6f93f9 100644
+--- a/heartbeat/ocf-shellfuncs.in
++++ b/heartbeat/ocf-shellfuncs.in
+@@ -1010,7 +1010,11 @@ ocf_attribute_target() {
+ 		if [ x$OCF_RESKEY_CRM_meta_container_attribute_target = xhost -a x$OCF_RESKEY_CRM_meta_physical_host != x ]; then
+ 			echo $OCF_RESKEY_CRM_meta_physical_host
+ 		else
+-			echo $OCF_RESKEY_CRM_meta_on_node
++			if [ x$OCF_RESKEY_CRM_meta_on_node != x ]; then
++				echo $OCF_RESKEY_CRM_meta_on_node
++			else
++				ocf_local_nodename
++			fi
+ 		fi
+ 		return
+ 	elif [ x"$OCF_RESKEY_CRM_meta_notify_all_uname" != x ]; then
diff --git a/SPECS/resource-agents.spec b/SPECS/resource-agents.spec
index 3915ce7..11dd861 100644
--- a/SPECS/resource-agents.spec
+++ b/SPECS/resource-agents.spec
@@ -48,7 +48,7 @@
 Name:		resource-agents
 Summary:	Open Source HA Reusable Cluster Resource Scripts
 Version:	3.9.5
-Release:	105%{?dist}.3
+Release:	105%{?dist}.6
 License:	GPLv2+, LGPLv2+ and ASL 2.0
 URL:		https://github.com/ClusterLabs/resource-agents
 %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel}
@@ -239,6 +239,8 @@ Patch178:	bz1493915-1-support-per-host-per-bundle-attribs.patch
 Patch179:	bz1493915-2-support-per-host-per-bundle-attribs.patch
 Patch180:	bz1497076-NovaEvacuate-Instance-HA-OSP12.patch
 Patch181:	bz1512586-galera-recover-from-empty-gvwstate.dat.patch
+Patch182:	bz1521019-db2-fix-hadr-promote-when-master-failed.patch
+Patch183:	bz1524454-ocf_attribute_target-fallback-fix.patch
 
 Obsoletes:	heartbeat-resources <= %{version}
 Provides:	heartbeat-resources = %{version}
@@ -535,6 +537,8 @@ exit 1
 %patch179 -p1 -F2
 %patch180 -p1
 %patch181 -p1
+%patch182 -p1
+%patch183 -p1
 
 %build
 if [ ! -f configure ]; then
@@ -798,6 +802,17 @@ ccs_update_schema > /dev/null 2>&1 ||:
 %endif
 
 %changelog
+* Mon Dec 11 2017 Oyvind Albrigtsen <oalbrigt@redhat.com> - 3.9.5-105.6
+- ocf_attribute_target: add fallback for Pacemaker versions without
+  bundle support
+
+  Resolves: rhbz#1524454
+
+* Wed Dec  6 2017 Oyvind Albrigtsen <oalbrigt@redhat.com> - 3.9.5-105.5
+- db2: fix HADR promote when master failed
+
+  Resolves: rhbz#1521019
+
 * Mon Nov 13 2017 Oyvind Albrigtsen <oalbrigt@redhat.com> - 3.9.5-105.3
 - galera: recover from empty gvwstate.dat