From fbb9bfa4a5925f8049ef51d8f59eb94920781ec8 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 18 May 2019 23:04:49 -0400 Subject: [PATCH] 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 --- scrub/e2scrub_all.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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}" -- 1.8.3.1