public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Fix API breakage in libblkid
@ 2026-04-08 10:35 cem
  2026-04-08 10:35 ` [PATCH RFC 1/2] Revert "libblkid: add debug message for private DM device skip" cem
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: cem @ 2026-04-08 10:35 UTC (permalink / raw)
  To: kzak; +Cc: util-linux, zkabelac, amulhern

From: Carlos Maiolino <cem@kernel.org>

Patch d05a84b22e54 ("libblkid: check for private DM device before open")
broke blkid_new_probe_from_filename() API.

Before the patch users were able, via the low-level API, to open and
create blkid probes via the device's filename even from private
device-mapper devices.

This change broke Stratis project and xfsprogs.
xfsprogs uses blkid_new_probe_from_filename() to gather topology
information from the device, and the above mentioned change now prevents
it to be done on device-mapper private devices, as Stratis does by
attempting to initialize a XFS filesystem on it.

Quoting the patch description:

"
    blkid_new_probe_from_filename() opens the device before calling
    blkid_probe_set_device(), which checks sysfs_devno_is_dm_private()
    and sets BLKID_FL_NOSCAN_DEV.  But the open() itself bumps the
    kernel open count, so a concurrent DM_DEVICE_REMOVE ioctl sees
    EBUSY even though blkid never actually probes the device.
"

I don't think the last statement here is correct.
blkid_probe_set_device() marks the probe as BLKID_FL_NOSCAN_DEV, but it
does not error out, so, for low-level API calls, we simply ended up
with a probe with BLKID_FL_NOSCAN_DEV set. But the call succeeded and we
ended up with a probe to use and query device's information.

As far as I understood it, the patch aimed to close a possible race
window when issuing a DM_DEVICE_REMOVE ioctl() to the same device being
probed by blkid_new_probe_from_filename().

Regarding the race window which this patch, at least for the low-level
API users, this seems to be something that should be dealt in the user's
side, not within the library. But I didn't dig into the details of the
aforementioned race.

Please take the above with a grain of salt though, we've been using
libblkid for ages, but I never actually looked into the implementation
until today, so, hopefully I did get the details right.

As for xfsprogs, I have a patch which 'fixes' it replacing
blkid_new_probe_from_filename() by blkid_probe_set_device(), but this is
just taping over the root cause, which is the API breakage.


Carlos Maiolino (2):
  Revert "libblkid: add debug message for private DM device skip"
  Revert "libblkid: check for private DM device before open"

 libblkid/src/probe.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
-- 
2.53.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-04-08 15:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08 10:35 [PATCH RFC 0/2] Fix API breakage in libblkid cem
2026-04-08 10:35 ` [PATCH RFC 1/2] Revert "libblkid: add debug message for private DM device skip" cem
2026-04-08 10:35 ` [PATCH RFC 2/2] Revert "libblkid: check for private DM device before open" cem
2026-04-08 11:47 ` [PATCH RFC 0/2] Fix API breakage in libblkid Zdenek Kabelac
2026-04-08 13:19   ` Carlos Maiolino
2026-04-08 13:32     ` Zdenek Kabelac
2026-04-08 14:49       ` Carlos Maiolino
2026-04-08 15:10         ` Zdenek Kabelac

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