Merge pull request #23011 from mrc0mmand/TEST-64-md

test: add MD-related tests to TEST-64
This commit is contained in:
Lennart Poettering
2022-04-13 22:26:50 +02:00
committed by GitHub
6 changed files with 102 additions and 6 deletions
+11 -5
View File
@@ -2313,7 +2313,7 @@ _public_ int sd_device_trigger_with_uuid(
_public_ int sd_device_open(sd_device *device, int flags) {
_cleanup_close_ int fd = -1, fd2 = -1;
const char *devname, *subsystem = NULL;
const char *devname, *subsystem = NULL, *val = NULL;
uint64_t q, diskseq = 0;
struct stat st;
dev_t devnum;
@@ -2338,10 +2338,6 @@ _public_ int sd_device_open(sd_device *device, int flags) {
if (r < 0 && r != -ENOENT)
return r;
r = sd_device_get_diskseq(device, &diskseq);
if (r < 0 && r != -ENOENT)
return r;
fd = open(devname, FLAGS_SET(flags, O_PATH) ? flags : O_CLOEXEC|O_NOFOLLOW|O_PATH);
if (fd < 0)
return -errno;
@@ -2359,6 +2355,16 @@ _public_ int sd_device_open(sd_device *device, int flags) {
if (FLAGS_SET(flags, O_PATH))
return TAKE_FD(fd);
r = sd_device_get_property_value(device, "ID_IGNORE_DISKSEQ", &val);
if (r < 0 && r != -ENOENT)
return r;
if (!val || parse_boolean(val) <= 0) {
r = sd_device_get_diskseq(device, &diskseq);
if (r < 0 && r != -ENOENT)
return r;
}
fd2 = open(FORMAT_PROC_FD_PATH(fd), flags);
if (fd2 < 0)
return -errno;