Skip to content

Commit dbf50f1

Browse files
yuwatakeszybz
authored andcommitted
udev: do not set ID_PATH and by-path symlink for nvmf disks
Prompted by #27391. (cherry picked from commit 39a39f1)
1 parent 75d4967 commit dbf50f1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/udev/udev-builtin-path_id.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ static sd_device *handle_ap(sd_device *parent, char **path) {
545545

546546
static int find_real_nvme_parent(sd_device *dev, sd_device **ret) {
547547
_cleanup_(sd_device_unrefp) sd_device *nvme = NULL;
548-
const char *sysname, *end;
548+
const char *sysname, *end, *devpath;
549549
int r;
550550

551551
/* If the device belongs to "nvme-subsystem" (not to be confused with "nvme"), which happens when
@@ -577,6 +577,14 @@ static int find_real_nvme_parent(sd_device *dev, sd_device **ret) {
577577
if (r < 0)
578578
return r;
579579

580+
r = sd_device_get_devpath(nvme, &devpath);
581+
if (r < 0)
582+
return r;
583+
584+
/* If the 'real parent' is (still) virtual, e.g. for nvmf disks, refuse to set ID_PATH. */
585+
if (path_startswith(devpath, "/devices/virtual/"))
586+
return -ENXIO;
587+
580588
*ret = TAKE_PTR(nvme);
581589
return 0;
582590
}

0 commit comments

Comments
 (0)