public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Vojtech Trefny <vtrefny@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-blivet] rawhide: Fix blivet closing /dev/mapper/control fd via stratis unlock calls (#2549531)
Date: Thu, 15 Oct 2026 13:31:35 GMT	[thread overview]
Message-ID: <179207109501.1.8541324959418801351.rpms-python-blivet-dc7a42d0ef8d@fedoraproject.org> (raw)

A new commit has been pushed.

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

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
 

                 reply	other threads:[~2026-10-15 13:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179207109501.1.8541324959418801351.rpms-python-blivet-dc7a42d0ef8d@fedoraproject.org \
    --to=vtrefny@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox