public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-blivet] f45: Fix blivet closing /dev/mapper/control fd via stratis unlock calls (#2549531)
@ 2026-10-15 13:45 Vojtech Trefny
  0 siblings, 0 replies; only message in thread
From: Vojtech Trefny @ 2026-10-15 13:45 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-blivet
Branch : f45
Commit : ac42d8428519a36fa9e1448ef1711b50217a2a72
Author : Vojtech Trefny <vtrefny@redhat.com>
Date   : 2026-10-15T14:55:14+02:00
Stats  : +73/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-blivet/c/ac42d8428519a36fa9e1448ef1711b50217a2a72?branch=f45

Log:
Fix blivet closing /dev/mapper/control fd via stratis unlock calls (#2549531)

---
diff --git a/0005-Fix-blivet-closing-dev-mapper-control-fd-via-stratis-unlock-calls.patch b/0005-Fix-blivet-closing-dev-mapper-control-fd-via-stratis-unlock-calls.patch
new file mode 100644
index 0000000..ad62ba4
--- /dev/null
+++ b/0005-Fix-blivet-closing-dev-mapper-control-fd-via-stratis-unlock-calls.patch
@@ -0,0 +1,68 @@
+From fd6b4a74dc200f2e68bf78a7706a3dedba277396 Mon Sep 17 00:00:00 2001
+From: Vojtech Trefny <vtrefny@redhat.com>
+Date: Thu, 15 Oct 2026 09:33:23 +0200
+Subject: [PATCH 1/2] Do not query status for non-existing DM devices
+
+No reason for the libblockdev call when the device is not created
+yet.
+---
+ blivet/devices/dm.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/blivet/devices/dm.py b/blivet/devices/dm.py
+index 99e64399a..2a8cc05f8 100644
+--- a/blivet/devices/dm.py
++++ b/blivet/devices/dm.py
+@@ -106,6 +106,8 @@ def device_id(self):
+ 
+     @property
+     def status(self):
++        if not self.exists:
++            return False
+         try:
+             return blockdev.dm.map_exists(self.map_name, True, True)
+         except blockdev.DMError as e:
+
+From 8a46e2753fcc8f6c20602e1cc435973324ee74ec Mon Sep 17 00:00:00 2001
+From: Vojtech Trefny <vtrefny@redhat.com>
+Date: Thu, 15 Oct 2026 09:42:10 +0200
+Subject: [PATCH 2/2] Do not pass '0' as throwaway file descriptor to stratis
+ calls
+
+Stratis pool unlock/start DBus calls require a file descriptor
+even when the unlock method is not specified. We cannot pass 0
+because that can be a valid opened file descriptor. With closed
+stdin this is the first fd opened by the process which happens to
+be /dev/mapper/control opened by libdevmapper. And because DBus
+closes the given file descriptor when the call ends, subsequent
+libdevmapper calls fail with EBADF.
+
+Assisted-By: Claude Opus 4.8 <noreply@anthropic.com>
+---
+ blivet/devicelibs/stratis.py | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/blivet/devicelibs/stratis.py b/blivet/devicelibs/stratis.py
+index 6ec3972cf..317f7b990 100644
+--- a/blivet/devicelibs/stratis.py
++++ b/blivet/devicelibs/stratis.py
+@@ -182,7 +182,8 @@ def unlock_pool(pool_uuid, method=None, passphrase=None, keyfile=None):
+ 
+         key_arg = (True, UnixFD(fd))
+     else:
+-        key_arg = (False, 0)
++        # throwaway fd that can be closed by DBus when the call is done
++        key_arg = (False, UnixFD(os.open(os.devnull, os.O_RDONLY)))
+ 
+     try:
+         proxy = util.SystemBus.get_proxy(STRATIS_SERVICE, STRATIS_PATH, STRATIS_MANAGER_INTF_R8,
+@@ -366,7 +367,8 @@ def start_pool(pool_uuid):
+     try:
+         proxy = util.SystemBus.get_proxy(STRATIS_SERVICE, STRATIS_PATH, STRATIS_MANAGER_INTF_R8,
+                                          client=GLibClientUnix)
+-        ((succ, _uuid), rc, err) = proxy.StartPool(pool_uuid, "uuid", (False, (False, 0)), (False, 0),
++        ((succ, _uuid), rc, err) = proxy.StartPool(pool_uuid, "uuid", (False, (False, 0)),
++                                                   (False, UnixFD(os.open(os.devnull, os.O_RDONLY))),
+                                                    timeout=STRATIS_CALL_TIMEOUT)
+     except DBusError as e:
+         raise StratisError("Failed to start stratis pool '%s': %s" % (pool_uuid, str(e)))

diff --git a/python-blivet.spec b/python-blivet.spec
index 747063a..4bf31fc 100644
--- a/python-blivet.spec
+++ b/python-blivet.spec
@@ -5,7 +5,7 @@ Version: 3.14.2
 
 #%%global prerelease .b2
 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
-Release: 3%{?prerelease}%{?dist}
+Release: 4%{?prerelease}%{?dist}
 Epoch: 1
 License: LGPL-2.1-or-later
 %global realname blivet
@@ -20,6 +20,7 @@ Patch0: 0001-remove-btrfs-plugin.patch
 Patch1: 0002-Flush-RAID-member-caches-after-creating-a-format.patch
 Patch2: 0003-Fix-default-mount-options-for-NTFS.patch
 Patch3: 0004-Drop-the-libparted-device-cache-even-if-the-device-node-is-gone.patch
+Patch4: 0005-Fix-blivet-closing-dev-mapper-control-fd-via-stratis-unlock-calls.patch
 
 # Versions of required components (done so we make sure the buildrequires
 # match the requires versions of things).
@@ -137,6 +138,9 @@ make DESTDIR=%{buildroot} install
 %{python3_sitelib}/*
 
 %changelog
+* Thu Oct 15 2026 Vojtech Trefny <vtrefny@redhat.com> - 1:3.14.2-4
+- Fix blivet closing /dev/mapper/control fd via stratis unlock calls (#2549531)
+
 * Thu Oct 01 2026 Vojtech Trefny <vtrefny@redhat.com> - 1:3.14.2-3
 - Drop the libparted device cache even if the device node is gone
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-15 13:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15 13:45 [rpms/python-blivet] f45: Fix blivet closing /dev/mapper/control fd via stratis unlock calls (#2549531) Vojtech Trefny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox