From: Theodore Ts'o Date: Sun, 19 May 2019 03:04:49 +0000 (-0400) Subject: e2scrub_all: avoid scrubbing all devices when there is nothing to scrub X-Git-Tag: v1.45.2~15 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=fbb9bfa4a5925f8049ef51d8f59eb94920781ec8;p=tools%2Fe2fsprogs.git e2scrub_all: avoid scrubbing all devices when there is nothing to scrub 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 --- diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in index 7ee6531..abc237e 100644 --- a/scrub/e2scrub_all.in +++ b/scrub/e2scrub_all.in @@ -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}"