[lvm-devel] [PATCH 3/9] Fix dry run exec
Zdenek Kabelac
zkabelac at redhat.com
Thu Oct 7 14:06:33 UTC 2010
Dangerous bug - as user which gives -n/--dry-run flag
could end up with modified lv size but with unresized filesystem.
So make sure recursive exec of lvresize tool has 'dry' prefix.
Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
---
scripts/fsadm.sh | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 2c6a21b..05b6382 100644
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -126,10 +126,13 @@ cleanup() {
IFS=$IFS_OLD
trap 2
- # start LVRESIZE with the filesystem modification flag
- # and allow recursive call of fsadm
- unset FSADM_RUNNING
- test "$DO_LVRESIZE" -eq 2 && exec $LVM lvresize $VERB -r -L$(( $NEWSIZE / 1048576 )) $VOLUME
+ if [ "$DO_LVRESIZE" -eq 2 ]; then
+ # start LVRESIZE with the filesystem modification flag
+ # and allow recursive call of fsadm
+ unset FSADM_RUNNING
+ dry exec $LVM lvresize $VERB $FORCE -r -L${NEWSIZE}b $VOLUME_ORIG
+ fi
+
# error exit status for break
exit ${1:-1}
}
--
1.7.3.1
More information about the lvm-devel
mailing list