diff --git a/.gitignore b/.gitignore
index 717d2b1..4115b2d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/tdb-1.3.6.tar.gz
+SOURCES/tdb-1.3.8.tar.gz
diff --git a/.libtdb.metadata b/.libtdb.metadata
index 718e594..b7b6ff6 100644
--- a/.libtdb.metadata
+++ b/.libtdb.metadata
@@ -1 +1 @@
-613a39ca88322c3277c0c09cdbe7e5fa5a54331e SOURCES/tdb-1.3.6.tar.gz
+3ac6779e14ed37caa27d5243777a2c7c485ef087 SOURCES/tdb-1.3.8.tar.gz
diff --git a/SOURCES/tbd-deadlock.patch b/SOURCES/tbd-deadlock.patch
deleted file mode 100644
index d7083a1..0000000
--- a/SOURCES/tbd-deadlock.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-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 b8fc060..eda20d8 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.6
-Release: 2%{?dist}
+Version: 1.3.8
+Release: 1%{?dist}
 Group: System Environment/Daemons
 Summary: The tdb library
 License: LGPLv3+
@@ -22,7 +22,6 @@ BuildRequires: python-devel
 Provides: bundled(libreplace)
 
 # Patches
-Patch0001:      tbd-deadlock.patch
 
 %description
 A library that implements a trivial database.
@@ -54,7 +53,6 @@ Python bindings for libtdb
 
 %prep
 %setup -q -n tdb-%{version}
-%patch0001 -p3
 
 %build
 %configure --disable-rpath \
@@ -101,6 +99,7 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python-tdb
 %defattr(-,root,root,-)
 %{python_sitearch}/tdb.so
+%{python_sitearch}/_tdb_text.py*
 
 %post -p /sbin/ldconfig
 
@@ -111,6 +110,10 @@ rm -rf $RPM_BUILD_ROOT
 %postun -n python-tdb -p /sbin/ldconfig
 
 %changelog
+* Fri Apr  1 2016 Jakub Hrozek <jhrozek@redhat.com> - 1.3.8-1
+- Rebase libtdb to 1.3.8
+- Related: rhbz#1322690
+
 * 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