diff --git a/SOURCES/0001-depmod-prevent-module-dependency-files-missing-durin.patch b/SOURCES/0001-depmod-prevent-module-dependency-files-missing-durin.patch
new file mode 100644
index 0000000..0f62724
--- /dev/null
+++ b/SOURCES/0001-depmod-prevent-module-dependency-files-missing-durin.patch
@@ -0,0 +1,33 @@
+From c2996b5fa880e81f63c25e80a4157b2239e32c5d Mon Sep 17 00:00:00 2001
+From: Michal Suchanek <msuchanek@suse.de>
+Date: Mon, 10 Dec 2018 22:29:32 +0100
+Subject: [PATCH 1/2] depmod: prevent module dependency files missing during
+ depmod invocation
+
+depmod deletes the module dependency files before moving the temporary
+files in their place. This results in user seeing no dependency files
+while they are updated. Remove the unlink call. The rename call should
+suffice to move the new file in place and unlink the old one. It should
+also do both atomically so there is no window when no dependency file
+exists.
+
+Signed-off-by: Michal Suchanek <msuchanek@suse.de>
+---
+ tools/depmod.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/tools/depmod.c b/tools/depmod.c
+index 989d9077926c..18c0d61b2db3 100644
+--- a/tools/depmod.c
++++ b/tools/depmod.c
+@@ -2451,7 +2451,6 @@ static int depmod_output(struct depmod *depmod, FILE *out)
+ 			break;
+ 		}
+ 
+-		unlinkat(dfd, itr->name, 0);
+ 		if (renameat(dfd, tmp, dfd, itr->name) != 0) {
+ 			err = -errno;
+ 			CRIT("renameat(%s, %s, %s, %s): %m\n",
+-- 
+2.33.0
+
diff --git a/SOURCES/0002-depmod-prevent-module-dependency-files-corruption-du.patch b/SOURCES/0002-depmod-prevent-module-dependency-files-corruption-du.patch
new file mode 100644
index 0000000..f2fa4db
--- /dev/null
+++ b/SOURCES/0002-depmod-prevent-module-dependency-files-corruption-du.patch
@@ -0,0 +1,62 @@
+From a06bacf500d56b72b5f9b121ebf7f6af9e3df185 Mon Sep 17 00:00:00 2001
+From: Michal Suchanek <msuchanek@suse.de>
+Date: Mon, 17 Dec 2018 23:46:28 +0100
+Subject: [PATCH 2/2] depmod: prevent module dependency files corruption due to
+ parallel invocation.
+
+Depmod does not use unique filename for temporary files. There is no
+guarantee the user does not attempt to run mutiple depmod processes in
+parallel. If that happens a temporary file might be created by
+depmod(1st), truncated by depmod(2nd), and renamed to final name by
+depmod(1st) resulting in corrupted file seen by user.
+
+Due to missing mkstempat() this is more complex than it should be.
+Adding PID and timestamp to the filename should be reasonably reliable.
+Adding O_EXCL as mkstemp does fails creating the file rather than
+corrupting existing file.
+
+Signed-off-by: Michal Suchanek <msuchanek@suse.de>
+---
+ tools/depmod.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/tools/depmod.c b/tools/depmod.c
+index 18c0d61b2db3..0f7e33ccfd59 100644
+--- a/tools/depmod.c
++++ b/tools/depmod.c
+@@ -29,6 +29,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
++#include <sys/time.h>
+ #include <sys/utsname.h>
+ 
+ #include <shared/array.h>
+@@ -2398,6 +2399,9 @@ static int depmod_output(struct depmod *depmod, FILE *out)
+ 	};
+ 	const char *dname = depmod->cfg->dirname;
+ 	int dfd, err = 0;
++	struct timeval tv;
++
++	gettimeofday(&tv, NULL);
+ 
+ 	if (out != NULL)
+ 		dfd = -1;
+@@ -2416,11 +2420,12 @@ static int depmod_output(struct depmod *depmod, FILE *out)
+ 		int r, ferr;
+ 
+ 		if (fp == NULL) {
+-			int flags = O_CREAT | O_TRUNC | O_WRONLY;
++			int flags = O_CREAT | O_EXCL | O_WRONLY;
+ 			int mode = 0644;
+ 			int fd;
+ 
+-			snprintf(tmp, sizeof(tmp), "%s.tmp", itr->name);
++			snprintf(tmp, sizeof(tmp), "%s.%i.%li.%li", itr->name, getpid(),
++					tv.tv_usec, tv.tv_sec);
+ 			fd = openat(dfd, tmp, flags, mode);
+ 			if (fd < 0) {
+ 				ERR("openat(%s, %s, %o, %o): %m\n",
+-- 
+2.33.0
+
diff --git a/SPECS/kmod.spec b/SPECS/kmod.spec
index bd95501..c016f42 100644
--- a/SPECS/kmod.spec
+++ b/SPECS/kmod.spec
@@ -1,6 +1,6 @@
 Name:		kmod
 Version:	25
-Release:	18%{?dist}
+Release:	19%{?dist}
 Summary:	Linux kernel module management utilities
 
 Group:		System Environment/Kernel
@@ -14,6 +14,8 @@ Exclusiveos:	Linux
 Patch01:	kmod-signature-do-not-report-wrong-data-for-pkc-7-signatu.patch
 Patch02:	kmod-libkmod-signature-implement-pkcs7-parsing-with-opens.patch
 Patch03:	kmod-modprobe-ignore-builtin-module-on-recursive-removing.patch
+Patch04:	0001-depmod-prevent-module-dependency-files-missing-durin.patch
+Patch05:	0002-depmod-prevent-module-dependency-files-corruption-du.patch
 
 BuildRoot:     %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 BuildRequires:	chrpath
@@ -57,6 +59,8 @@ applications that wish to load or unload Linux kernel modules.
 %patch01 -p1
 %patch02 -p1
 %patch03 -p1
+%patch04 -p1
+%patch05 -p1
 
 %build
 export V=1
@@ -125,6 +129,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf
 %{_libdir}/libkmod.so
 
 %changelog
+* Mon Nov 29 2021 Yauheni Kaliuta <ykaliuta@redhat.com> - 25-19
+- depmod: fix parallel execution issues
+  Resolves: rhbz#2026938
+
 * Fri Apr 16 2021 Yauheni Kaliuta <ykaliuta@redhat.com> - 25-18
 - weak-modules: do not require dracut wneh using --no-initramfs
   Resolves: rhbz#1935416