1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-02 13:47:27 +03:00

udev: do not set ID_PATH and by-path symlink for nvmf disks

Prompted by #27391.
This commit is contained in:
Yu Watanabe 2023-05-10 15:47:44 +09:00 committed by Mike Yuan
parent eb29296937
commit 39a39f18f2

View File

@ -545,7 +545,7 @@ static sd_device *handle_ap(sd_device *parent, char **path) {
static int find_real_nvme_parent(sd_device *dev, sd_device **ret) { static int find_real_nvme_parent(sd_device *dev, sd_device **ret) {
_cleanup_(sd_device_unrefp) sd_device *nvme = NULL; _cleanup_(sd_device_unrefp) sd_device *nvme = NULL;
const char *sysname, *end; const char *sysname, *end, *devpath;
int r; int r;
/* If the device belongs to "nvme-subsystem" (not to be confused with "nvme"), which happens when /* 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) {
if (r < 0) if (r < 0)
return r; return r;
r = sd_device_get_devpath(nvme, &devpath);
if (r < 0)
return r;
/* If the 'real parent' is (still) virtual, e.g. for nvmf disks, refuse to set ID_PATH. */
if (path_startswith(devpath, "/devices/virtual/"))
return -ENXIO;
*ret = TAKE_PTR(nvme); *ret = TAKE_PTR(nvme);
return 0; return 0;
} }