diff --git a/.gitignore b/.gitignore
index 6813066..717d2b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/tdb-1.3.0.tar.gz
+SOURCES/tdb-1.3.6.tar.gz
diff --git a/.libtdb.metadata b/.libtdb.metadata
index 57b6796..718e594 100644
--- a/.libtdb.metadata
+++ b/.libtdb.metadata
@@ -1 +1 @@
-44ed95d6b58670d2835a8703d44ab1a40173960e SOURCES/tdb-1.3.0.tar.gz
+613a39ca88322c3277c0c09cdbe7e5fa5a54331e SOURCES/tdb-1.3.6.tar.gz
diff --git a/SOURCES/0001-tdb-include-include-stdbool.h-in-tdb.h.patch b/SOURCES/0001-tdb-include-include-stdbool.h-in-tdb.h.patch
deleted file mode 100644
index 33a15cb..0000000
--- a/SOURCES/0001-tdb-include-include-stdbool.h-in-tdb.h.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 4e14a437963ba54987cd58b4e0705d9a6d8aea6f Mon Sep 17 00:00:00 2001
-From: Adam Williamson <awilliam@redhat.com>
-Date: Fri, 23 May 2014 10:08:14 -0700
-Subject: [PATCH] tdb/include: include stdbool.h in tdb.h
-
-Commit db5bda56bf08 (tdb: add TDB_MUTEX_LOCKING support) adds a bool, but does
-not include stdbool.h. This causes any build including tdb.h to fail, at least
-for me with GCC 4.9.0.
----
- lib/tdb/include/tdb.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/tdb.h b/include/tdb.h
-index 5ea5e60..03e429c 100644
---- a/include/tdb.h
-+++ b/include/tdb.h
-@@ -31,6 +31,7 @@ extern "C" {
- #endif
- 
- #include <signal.h>
-+#include <stdbool.h>
- 
- /**
-  * @defgroup tdb The tdb API
--- 
-1.9.3
-
diff --git a/SOURCES/tbd-deadlock.patch b/SOURCES/tbd-deadlock.patch
new file mode 100644
index 0000000..d7083a1
--- /dev/null
+++ b/SOURCES/tbd-deadlock.patch
@@ -0,0 +1,58 @@
+From ff8d4157e611053c70120cb57692827dd31a5024 Mon Sep 17 00:00:00 2001
+From: Volker Lendecke <vl@samba.org>
+Date: Mon, 6 Jul 2015 13:13:36 +0200
+Subject: [PATCH] tdb: Fix bug 11381, deadlock
+
+This fixes a deadlock in tdb that is a bad interaction between tdb_lockall
+and tdb_traverse. This deadlock condition has been around even before
+tdb mutexes, it's just that the kernel fcntl EDEADLK detection protected
+us from this ABBA lock condition to become a real deadlock stalling
+processes. With tdb mutexes, this deadlock protection is gone, so we do
+lock dead.
+
+This patch glosses over this particular ABBA condition, making tdb with
+mutexes behave the same as tdb without mutexes. Admittedly this is no
+real fix, but it works around a real user's problem.
+
+Bug: https://bugzilla.samba.org/show_bug.cgi?id=11381
+Signed-off-by: Volker Lendecke <vl@samba.org>
+Reviewed-by: Jeremy Allison <jra@samba.org>
+(cherry picked from commit 1061a9cafda7d73ebcd2f74e69e74f4adc485d5d)
+---
+ lib/tdb/common/traverse.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/lib/tdb/common/traverse.c b/lib/tdb/common/traverse.c
+index 618670f..e18e3c3 100644
+--- a/lib/tdb/common/traverse.c
++++ b/lib/tdb/common/traverse.c
+@@ -245,13 +245,25 @@ _PUBLIC_ int tdb_traverse(struct tdb_context *tdb,
+ 		 tdb_traverse_func fn, void *private_data)
+ {
+ 	struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
++	enum tdb_lock_flags lock_flags;
+ 	int ret;
+ 
+ 	if (tdb->read_only || tdb->traverse_read) {
+ 		return tdb_traverse_read(tdb, fn, private_data);
+ 	}
+ 
+-	if (tdb_transaction_lock(tdb, F_WRLCK, TDB_LOCK_WAIT)) {
++	lock_flags = TDB_LOCK_WAIT;
++
++	if (tdb->allrecord_lock.count != 0) {
++		/*
++		 * This avoids a deadlock between tdb_lockall() and
++		 * tdb_traverse(). See
++		 * https://bugzilla.samba.org/show_bug.cgi?id=11381
++		 */
++		lock_flags = TDB_LOCK_NOWAIT;
++	}
++
++	if (tdb_transaction_lock(tdb, F_WRLCK, lock_flags)) {
+ 		return -1;
+ 	}
+ 
+-- 
+2.1.0
+
diff --git a/SPECS/libtdb.spec b/SPECS/libtdb.spec
index 017e396..b8fc060 100644
--- a/SPECS/libtdb.spec
+++ b/SPECS/libtdb.spec
@@ -5,8 +5,8 @@
 %{!?python_version: %global python_version %(%{__python} -c "from distutils.sysconfig import get_python_version; print(get_python_version())")}
 
 Name: libtdb
-Version: 1.3.0
-Release: 1%{?dist}
+Version: 1.3.6
+Release: 2%{?dist}
 Group: System Environment/Daemons
 Summary: The tdb library
 License: LGPLv3+
@@ -22,7 +22,7 @@ BuildRequires: python-devel
 Provides: bundled(libreplace)
 
 # Patches
-Patch0001:  0001-tdb-include-include-stdbool.h-in-tdb.h.patch
+Patch0001:      tbd-deadlock.patch
 
 %description
 A library that implements a trivial database.
@@ -54,7 +54,7 @@ Python bindings for libtdb
 
 %prep
 %setup -q -n tdb-%{version}
-%patch0001 -p1 -b .stdbool
+%patch0001 -p3
 
 %build
 %configure --disable-rpath \
@@ -111,6 +111,16 @@ rm -rf $RPM_BUILD_ROOT
 %postun -n python-tdb -p /sbin/ldconfig
 
 %changelog
+* Wed Aug 19 2015 Jakub Hrozek <jhrozek@redhat.com> - 1.3.6-2
+- Resolves: rhbz#1241015 - tdb deadlocks if you acquire allrecord_lock
+                           and start two traverses
+
+* Sun Jun 14 2015 Jakub Hrozek <jhrozek@redhat.com> - 1.3.6-1
+- Resolves: rhbz#1226048 - Rebase libtdb to at least 1.3.4 in RHEL-7.2
+
+* Wed Jun  3 2015 Jakub Hrozek <jhrozek@redhat.com> - 1.3.5-1
+- Resolves: rhbz#1226048 - Rebase libtdb to at least 1.3.4 in RHEL-7.2
+
 * Thu Sep  4 2014 Jakub Hrozek <jhrozek@redhat.com> - 1.3.0-1
 - Resolves: rhbz#1133915 - Rebase libtdb to version 1.3.0 or newer