]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2scrub_all: avoid scrubbing all devices when there is nothing to scrub
authorTheodore Ts'o <tytso@mit.edu>
Sun, 19 May 2019 03:04:49 +0000 (23:04 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 19 May 2019 03:43:55 +0000 (23:43 -0400)
Running lsblk when there are no valid block devicse results in
generating all block devices as the list of devices to scrub; this
results in a lot of e2scrub_all failures.

Addresses-Debian-Bug: #929186

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
scrub/e2scrub_all.in

index 7ee6531583cb923330c851ae72fa1ec9c269de95..abc237e426f3e356940a182672f9487475d359b1 100644 (file)
@@ -103,8 +103,12 @@ fi
 
 # Find scrub targets, make sure we only do this once.
 ls_scan_targets() {
-       lsblk -o NAME,MOUNTPOINT,FSTYPE -P -n -p \
-             $(lvs -o lv_path --noheadings -S "lv_active=active,lv_role=public,lv_role!=snapshot,vg_free>${snap_size_mb}") | \
+    local devices=$(lvs -o lv_path --noheadings -S "lv_active=active,lv_role=public,lv_role!=snapshot,vg_free>${snap_size_mb}")
+
+    if [ -z "$devices" ]; then
+       return 0;
+    fi
+    lsblk -o NAME,MOUNTPOINT,FSTYPE -P -n -p $devices | \
            grep FSTYPE=\"ext\[234\]\" | while read vars ; do
                eval "${vars}"