Skip devices without a backing block device (network/virtual filesystems) in device operations

This commit is contained in:
Andrea Mazzoleni 2026-11-11 21:58:10 +01:00
parent 487305a760
commit 47e439ddff
3 changed files with 23 additions and 2 deletions

View file

@ -8,6 +8,11 @@ SnapRAID HISTORY
Daemon). This prevents potential execution failures of child
processes (such as smartctl) on systems where nested job objects are
not supported.
* Skip disks on network or virtual filesystems (such as NFS, CIFS,
FUSE, or tmpfs) in device operations like 'up', 'down', 'smart',
and 'probe' on Linux, instead of failing with an error. If no
physical device remains, the operation completes successfully with
an informational message.
15.1 2026/10
============

View file

@ -1237,13 +1237,16 @@ int state_device_force(struct snapraid_state* state, int operation, tommy_list*
}
}
/* distinguish skipped devices from unsupported device queries */
if (ret == 0 && tommy_list_empty(&low)) {
ret = -1;
if (tommy_list_empty(&high)) {
ret = -1;
log_error(ESOFT, "No accessible devices selected for this operation.\n");
goto bail;
}
/* not an error, the selected disks are on network or virtual filesystems without a block device to manage */
msg_info("No physical devices found for the selected disks, nothing to do.\n");
goto bail;
}
if (ret != 0) {

View file

@ -4375,6 +4375,16 @@ int devquery(tommy_list* high, tommy_list* low)
struct dev_struct* dev = j->data;
uint64_t access_stat;
/*
* Major 0 is an anonymous superblock (NFS, CIFS, FUSE, tmpfs, overlay, ...)
* not backed by a block device. Btrfs/Bcachefs/ZFS are already dereferenced
* to their member devices, so what remains has no physical disk to manage.
*/
if (major(dev->device) == 0) {
log_tag("device:%s:skip:%u:%u: no block device\n", esc_tag(devinfo->name), major(dev->device), minor(dev->device));
continue;
}
/* retrieve access stat for the high level device */
if (devstat(dev->device, &access_stat) == 0) {
/* cumulate access stat in the first split */
@ -4420,6 +4430,9 @@ int devquery(tommy_list* high, tommy_list* low)
#else
(void)high;
(void)low;
/* device operations are unsupported in this platform */
failed = 1;
#endif
return failed ? -1 : degraded ? 1 : 0;