[LTP] [PATCH v3 2/3] lib/tst_device.c: check for BTRFS_SUPER_MAGIC instead of device major of 0
Petr Vorel
pvorel@suse.cz
Tue Feb 18 13:50:29 CET 2025
Hi Jeff,
> stat() may return a major number of 0 in st_dev for any number of
> pseudo file systems. Check for the exact file system instead. There
> should be no change in behavior with this patch.
LGTM, thank you!
Reviewed-by: Petr Vorel <pvorel@suse.cz>
FYI I'll apply very minor formatting fix before merge.
Kind regards,
Petr
+++ lib/tst_device.c
@@ -559,12 +559,10 @@ static void btrfs_get_uevent_path(char *tmp_path, char *uevent_path)
uevent_path[0] = '\0';
- if (d) {
- sprintf(uevent_path, "%s/%s/uevent",
- bdev_path, d->d_name);
- } else {
- tst_brkm(TBROK | TERRNO, NULL, "No backing device found while looking in %s.", bdev_path);
- }
+ if (d)
+ sprintf(uevent_path, "%s/%s/uevent", bdev_path, d->d_name);
+ else
+ tst_brkm(TBROK | TERRNO, NULL, "No backing device found while looking in %s", bdev_path);
if (SAFE_READDIR(NULL, dir))
tst_resm(TINFO, "Warning: used first of multiple backing device.");
@@ -600,7 +598,7 @@ void tst_find_backing_dev(const char *path, char *dev, size_t dev_size)
if (fsbuf.f_type == TST_BTRFS_MAGIC) {
btrfs_get_uevent_path(tmp_path, uevent_path);
} else if (dev_major == 0) {
- tst_brkm(TBROK, NULL, "%s resides on an unsupported pseudo-file system.", path);
+ tst_brkm(TBROK, NULL, "%s resides on an unsupported pseudo-file system", path);
} else {
tst_resm(TINFO, "Use uevent strategy");
sprintf(uevent_path,
More information about the ltp
mailing list