Fix scanning of devices with multiple slaves

This commit is contained in:
Valentin Hilbig 2018-01-03 23:50:53 +01:00 • committed by Andrea Mazzoleni
parent c4e08ae69d
commit 3f838753ca
2 changed files with 10 additions and 3 deletions

View file

@ -1,6 +1,11 @@
SnapRAID HISTORY
================
11.3 2018/01 (WIP)
==================
* Fixed handing of Linux devices that have multiple slaves. This affects
the smart/list/devices/down commands [Valentin Hilbig].
11.2 2017/12
============
* Fixed recognition of NTFS hardlinks. They behave differently than

View file

@ -917,18 +917,20 @@ static int devtree(const char* name, const char* custom, dev_t device, devinfo_t
while ((dd = readdir(d)) != 0) {
if (dd->d_name[0] != '.') {
dev_t subdev;
/* for each slave, expand the full potential tree */
pathprint(path, sizeof(path), "/sys/dev/block/%u:%u/slaves/%s/dev", major(device), minor(device), dd->d_name);
device = devread(path);
if (!device) {
subdev = devread(path);
if (!subdev) {
/* LCOV_EXCL_START */
closedir(d);
return -1;
/* LCOV_EXCL_STOP */
}
if (devtree(name, custom, device, parent, list) != 0) {
if (devtree(name, custom, subdev, parent, list) != 0) {
/* LCOV_EXCL_START */
closedir(d);
return -1;