mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 04:17:02 -05:00
Skip devices without a backing block device (network/virtual filesystems) in device operations
This commit is contained in:
parent
487305a760
commit
47e439ddff
3 changed files with 23 additions and 2 deletions
5
HISTORY
5
HISTORY
|
|
@ -8,6 +8,11 @@ SnapRAID HISTORY
|
||||||
Daemon). This prevents potential execution failures of child
|
Daemon). This prevents potential execution failures of child
|
||||||
processes (such as smartctl) on systems where nested job objects are
|
processes (such as smartctl) on systems where nested job objects are
|
||||||
not supported.
|
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
|
15.1 2026/10
|
||||||
============
|
============
|
||||||
|
|
|
||||||
|
|
@ -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)) {
|
if (ret == 0 && tommy_list_empty(&low)) {
|
||||||
ret = -1;
|
|
||||||
if (tommy_list_empty(&high)) {
|
if (tommy_list_empty(&high)) {
|
||||||
|
ret = -1;
|
||||||
log_error(ESOFT, "No accessible devices selected for this operation.\n");
|
log_error(ESOFT, "No accessible devices selected for this operation.\n");
|
||||||
goto bail;
|
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) {
|
if (ret != 0) {
|
||||||
|
|
|
||||||
|
|
@ -4375,6 +4375,16 @@ int devquery(tommy_list* high, tommy_list* low)
|
||||||
struct dev_struct* dev = j->data;
|
struct dev_struct* dev = j->data;
|
||||||
uint64_t access_stat;
|
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 */
|
/* retrieve access stat for the high level device */
|
||||||
if (devstat(dev->device, &access_stat) == 0) {
|
if (devstat(dev->device, &access_stat) == 0) {
|
||||||
/* cumulate access stat in the first split */
|
/* cumulate access stat in the first split */
|
||||||
|
|
@ -4420,6 +4430,9 @@ int devquery(tommy_list* high, tommy_list* low)
|
||||||
#else
|
#else
|
||||||
(void)high;
|
(void)high;
|
||||||
(void)low;
|
(void)low;
|
||||||
|
|
||||||
|
/* device operations are unsupported in this platform */
|
||||||
|
failed = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return failed ? -1 : degraded ? 1 : 0;
|
return failed ? -1 : degraded ? 1 : 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue