teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0187-gpt-auto-generator-skip-nonexistent-devices.patch

65878a
From 7f3f1b3f979a96182b2eb44eeea86993506108d5 Mon Sep 17 00:00:00 2001
65878a
From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <l.stelmach@samsung.com>
65878a
Date: Tue, 7 Jan 2014 15:00:22 +0100
65878a
Subject: [PATCH] gpt-auto-generator: skip nonexistent devices
65878a
65878a
The devices we work with have eMMC chips for storage. The chips
65878a
provide four "hardware" partitions.  The first is /dev/mmcblk0, it
65878a
takes almost whole space and holds a GPT with several real partitions
65878a
(/dev/mmcblk0p?). Then there are three block devices (mmcblk0boot0,
65878a
mmcblk0boot1, rpmb) that are part of the same hardware as mmcblk0 that
65878a
are presented by the kernel as children of the latter. That relationship
65878a
makes gpt-auto-generator try to peek them but since they are not GPT
65878a
partitions blkid_do_safeprobe() returns -2 making verify_gpt_parition()
65878a
function return -ENODEV.
65878a
---
65878a
 src/gpt-auto-generator/gpt-auto-generator.c | 3 +++
65878a
 1 file changed, 3 insertions(+)
65878a
65878a
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
65878a
index d2b4213..1f09aed 100644
65878a
--- a/src/gpt-auto-generator/gpt-auto-generator.c
65878a
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
65878a
@@ -306,6 +306,9 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
65878a
 
65878a
                 r = verify_gpt_partition(node, &type_id, &nr, &fstype);
65878a
                 if (r < 0) {
65878a
+                        /* skip child devices which are not detected properly */
65878a
+                        if (r == -ENODEV)
65878a
+                                continue;
65878a
                         log_error("Failed to verify GPT partition %s: %s",
65878a
                                   node, strerror(-r));
65878a
                         udev_device_unref(q);