#!/usr/bin/env bash # Copyright (C) 2008-2017 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions # of the GNU General Public License v.2. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA test_description='Exercise fsadm filesystem resize on crypt devices' SKIP_WITH_LVMLOCKD=1 SKIP_WITH_LVMPOLLD=1 . lib/inittest aux prepare_vg 1 200 # set to "skip" to avoid testing given fs and test warning result # i.e. check_reiserfs=skip check_ext2= check_ext3= check_xfs= check_reiserfs= check_cryptsetup= DROP_SYMLINK= CRYPT_NAME="$PREFIX-tcrypt" CRYPT_DEV="$DM_DEV_DIR/mapper/$CRYPT_NAME" CRYPT_NAME2="$PREFIX-tcrypt2" CRYPT_DEV2="$DM_DEV_DIR/mapper/$CRYPT_NAME2" CRYPT_NAME_PLAIN="$PREFIX-tcryptp" CRYPT_DEV_PLAIN="$DM_DEV_DIR/mapper/$CRYPT_NAME_PLAIN" FORMAT_PARAMS="-i1" which cryptsetup || check_cryptsetup=${check_cryptsetup:-cryptsetup} which mkfs.ext2 || check_ext2=${check_ext2:-mkfs.ext2} which mkfs.ext3 || check_ext3=${check_ext3:-mkfs.ext3} which fsck.ext3 || check_ext3=${check_ext3:-fsck.ext3} which mkfs.xfs || check_xfs=${check_xfs:-mkfs.xfs} which xfs_check || { which xfs_repair || check_xfs=${check_xfs:-xfs_repair} } grep xfs /proc/filesystems || check_xfs=${check_xfs:-no_xfs} which mkfs.reiserfs || check_reiserfs=${check_reiserfs:-mkfs.reiserfs} which reiserfsck || check_reiserfs=${check_reiserfs:-reiserfsck} grep reiserfs /proc/filesystems || check_reiserfs=${check_reiserfs:-no_reiserfs} vg_lv=$vg/$lv1 vg_lv2=$vg/${lv1}bar vg_lv3=$vg/${lv1}plain dev_vg_lv="$DM_DEV_DIR/$vg_lv" dev_vg_lv2="$DM_DEV_DIR/$vg_lv2" dev_vg_lv3="$DM_DEV_DIR/$vg_lv3" mount_dir="mnt" # for recursive call LVM_BINARY=$(which lvm) export LVM_BINARY test ! -d "$mount_dir" && mkdir "$mount_dir" crypt_close() { cryptsetup close "$1" if [ "$?" -eq 0 -a -n "$DROP_SYMLINK" ]; then rm -f "$DM_DEV_DIR/mapper/$1" fi } cleanup_mounted_and_teardown() { umount "$mount_dir" || true crypt_close $CRYPT_NAME > /dev/null 2>&1 || true crypt_close $CRYPT_NAME2 > /dev/null 2>&1 || true crypt_close $CRYPT_NAME_PLAIN > /dev/null 2>&1 || true aux teardown } fscheck_ext3() { fsck.ext3 -p -F -f "$1" } fscheck_xfs() { if which xfs_repair ; then xfs_repair -n "$1" else xfs_check "$1" fi } fscheck_reiserfs() { reiserfsck --check -p -f "$1"