summaryrefslogtreecommitdiff
path: root/scrub/e2scrub_all.in
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2019-05-18 23:04:49 -0400
committerTheodore Ts'o <tytso@mit.edu>2019-05-18 23:43:55 -0400
commitfbb9bfa4a5925f8049ef51d8f59eb94920781ec8 (patch)
tree01b18abad185199eefbfca136d59a0a489a29cf5 /scrub/e2scrub_all.in
parent9d41a057d9643505942628c919869a7019646276 (diff)
downloade2fsprogs-fbb9bfa4a5925f8049ef51d8f59eb94920781ec8.tar.gz
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 <tytso@mit.edu>
Diffstat (limited to 'scrub/e2scrub_all.in')
-rw-r--r--scrub/e2scrub_all.in8
1 files changed, 6 insertions, 2 deletions
diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
index 7ee65315..abc237e4 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}"