blob: a8eb35c553a03458488f5bba5772cf5db8746316 [file] [log] [blame]
From 7f24eb3b71bee502e365f0db251e65fd857b5062 Mon Sep 17 00:00:00 2001
From: Meena Shanmugam <meenashanmugam@google.com>
Date: Fri, 1 Apr 2022 17:13:43 +0000
Subject: [PATCH] Workaround to probe disk partitions.
When the disk partitions are probed from systemd-udevd,
blkid_probe_get_wholedisk_devno function returns prtition devno istead
of whole disk devno. FOr example, wholedisk devno is 0x800 and partition
that is probed is 0x801, blkid_probe_get_wholedisk_devno function
suppose to return 0x800, but it returns 0x801(sda1). sda1 will not have
any partition information, hence it fails to update the udev database
with parition information. So insead of calling blkid_probe_get_wholedisk_devno
mask the partition number in the devno to get the whole disk.
---
libblkid/src/probe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index 31706240f..dd9c422d7 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -1850,14 +1850,14 @@ blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr)
{
dev_t disk;
- if (blkid_probe_is_wholedisk(pr))
+ if (!(blkid_probe_get_devno(pr) & 0x00FF))
return NULL; /* this is not partition */
if (pr->parent)
/* this is cloned blkid_probe, use parent's stuff */
return blkid_probe_get_wholedisk_probe(pr->parent);
- disk = blkid_probe_get_wholedisk_devno(pr);
+ disk = blkid_probe_get_devno(pr) & 0xFF00;
if (pr->disk_probe && pr->disk_probe->devno != disk) {
/* we have disk prober, but for another disk... close it */
--
2.35.1.1094.g7c7d902a7c-goog