}
run_test 5f "mds down, cleanup after failed mount (bug 2712)"
+test_5g() {
+ modprobe lustre
+ [ $(lustre_version_code client) -lt $(version_code 2.9.53) ] &&
+ { skip "automount of debugfs missing before 2.9.53" && return 0; }
+ umount /sys/kernel/debug
+ $LCTL get_param -n devices | egrep -v "error" && \
+ error "lctl can't access debugfs data"
+ grep " debugfs " /etc/mtab || error "debugfs failed to remount"
+}
+run_test 5g "handle missing debugfs"
+
test_6() {
setup
manual_umount_client
destroy_zpool $facet $poolname
done
fi
+ combined_mgs_mds || start_mgs || rc=$?
return $rc
}
local mdt2_is_available=false
local node=$(facet_active_host $SINGLEMDS)
local r="do_node $node"
- local node2=$(facet_active_host mds2)
local tmp=$TMP/t32
local img_commit
local img_kernel
local stripe_count
local dir
+ combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
trap 'trap - RETURN; t32_test_cleanup' RETURN
load_modules
mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
fi
- add fs2mds $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
+ add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
$mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
error_noexit "Mkfs new MDT failed"
return 1
}
- [[ $(facet_fstype mds1) != zfs ]] || import_zpool fs2mds
+ [[ $(facet_fstype mds1) != zfs ]] || import_zpool mds1
$r $TUNEFS --dryrun $fs2mdsdev || {
error_noexit "tunefs.lustre before mounting the MDT"
return
fi
- local inode_slab=$(do_facet $SINGLEMDS \
- "awk '/ldiskfs_inode_cache/ { print \\\$5 }' /proc/slabinfo")
+ do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
+ local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
+ awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
if [ -z "$inode_slab" ]; then
skip "ldiskfs module has not been loaded"
return
fi
- echo "$inode_slab ldisk inodes per page"
- if [ "$inode_slab" -ge "3" ] ; then
- # If kmalloc-128 is also 1 per page - this is a debug kernel
- # and so this is not an error.
- local kmalloc128=$(do_facet $SINGLEMDS \
- "awk '/^(kmalloc|size)-128 / { print \\\$5 }' /proc/slabinfo")
- # 32 128-byte chunks in 4k
- [ "$kmalloc128" -eq "32" ] ||
- error "ldisk inode size is too big, $inode_slab objs per page"
- fi
+ echo "$inode_slab ldiskfs inodes per page"
+ [ "${inode_slab%.*}" -ge "3" ] && return 0
- return
+ # If kmalloc-128 is also 1 per page - this is a debug kernel
+ # and so this is not an error.
+ local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
+ awk '/^(kmalloc|size)-128 / { print $5 / $6 }')
+ # 32 128-byte chunks in 4k
+ [ "${kmalloc128%.*}" -lt "32" ] ||
+ error "ldiskfs inode too big, only $inode_slab objs/page, " \
+ "kmalloc128 = $kmalloc128 objs/page"
}
-run_test 63 "Verify each page can at least hold 3 ldisk inodes"
+run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
test_64() {
start_mds || error "unable to start MDS"
local ostdev=$(ostdevname 1)
local cmd="$E2FSCK -fnvd $mdsdev"
local fn=3
+ local add_options
[ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
skip "ldiskfs only test" && return
+ if combined_mgs_mds; then
+ add_options='--reformat'
+ else
+ add_options='--reformat --replace'
+ fi
+
#tune MDT with "-O extents"
for num in $(seq $MDSCOUNT); do
add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
- --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
+ $add_options $(mdsdevname $num) $(mdsvdevname $num) ||
error "add mds $num failed"
do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
error "$TUNE2FS failed on mds${num}"
done
- add ost1 $(mkfs_opts ost1 $ostdev) --reformat $ostdev ||
+ add ost1 $(mkfs_opts ost1 $ostdev) $add_options $ostdev ||
error "add $ostdev failed"
- start_mgsmds || error "start mds failed"
+ start_mds || error "start mds failed"
start_ost || error "start ost failed"
mount_client $MOUNT || error "mount client failed"
}
run_test 81 "sparse OST indexing"
-# Wait OSTs to be active on both client and MDT side.
-wait_osts_up() {
- local cmd="$LCTL get_param -n lov.$FSNAME-clilov-*.target_obd |
- awk 'BEGIN {c = 0} /ACTIVE/{c += 1} END {printf \\\"%d\\\", c}'"
- wait_update $HOSTNAME "eval $cmd" $OSTCOUNT ||
- error "wait_update OSTs up on client failed"
-
- cmd="$LCTL get_param -n lod.$FSNAME-MDT*-*.target_obd | sort -u |
- awk 'BEGIN {c = 0} /ACTIVE/{c += 1} END {printf \\\"%d\\\", c}'"
- wait_update_facet $SINGLEMDS "eval $cmd" $OSTCOUNT ||
- error "wait_update OSTs up on MDT failed"
-}
-
# Here we exercise the stripe placement functionality on a file system that
# has formatted the OST with a random index. With the file system the following
# functionality is tested:
}
run_test 101 "Race MDT->OST reconnection with create"
+test_102() {
+ cleanup || error "cleanup failed with $?"
+
+ local mds1dev=$(mdsdevname 1)
+ local mds1mnt=$(facet_mntpt mds1)
+ local mds1fstype=$(facet_fstype mds1)
+ local mds1opts=$MDS_MOUNT_OPTS
+
+ if [ $mds1fstype == ldiskfs ] &&
+ ! do_facet mds1 test -b $mds1dev; then
+ mds1opts=$(csa_add "$mds1opts" -o loop)
+ fi
+ if [[ $mds1fstype == zfs ]]; then
+ import_zpool mds1 || return ${PIPESTATUS[0]}
+ fi
+
+ # unload all and only load libcfs to allow fail_loc setting
+ do_facet mds1 lustre_rmmod || error "unable to unload modules"
+ do_facet mds1 modprobe libcfs || error "libcfs not loaded"
+ do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
+
+ #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
+ do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
+
+ do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
+ error "mdt start must fail"
+ do_facet mds1 lsmod \| grep obdclass && error "obdclass must not load"
+
+ do_facet mds1 "$LCTL set_param fail_loc=0x0"
+
+ do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
+ error "mdt start must not fail"
+
+ cleanup || error "cleanup failed with $?"
+}
+run_test 102 "obdclass module cleanup upon error"
+
+test_renamefs() {
+ local newname=$1
+
+ echo "rename $FSNAME to $newname"
+
+ if [ ! combined_mgs_mds ]; then
+ local facet=$(mgsdevname)
+
+ do_facet mgs \
+ "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
+ error "(7) Fail to rename MGS"
+ if [ "$(facet_fstype $facet)" = "zfs" ]; then
+ reimport_zpool mgs $newname-mgs
+ fi
+ fi
+
+ for num in $(seq $MDSCOUNT); do
+ local facet=$(mdsdevname $num)
+
+ do_facet mds${num} \
+ "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
+ error "(8) Fail to rename MDT $num"
+ if [ "$(facet_fstype $facet)" = "zfs" ]; then
+ reimport_zpool mds${num} $newname-mdt${num}
+ fi
+ done
+
+ for num in $(seq $OSTCOUNT); do
+ local facet=$(ostdevname $num)
+
+ do_facet ost${num} \
+ "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
+ error "(9) Fail to rename OST $num"
+ if [ "$(facet_fstype $facet)" = "zfs" ]; then
+ reimport_zpool ost${num} $newname-ost${num}
+ fi
+ done
+}
+
+test_103_set_pool() {
+ local pname=$1
+ local ost_x=$2
+
+ do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
+ error "Fail to add $ost_x to $FSNAME.$pname"
+ wait_update $HOSTNAME \
+ "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
+ grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
+ error "$ost_x is NOT in pool $FSNAME.$pname"
+}
+
+test_103_check_pool() {
+ local save_fsname=$1
+ local errno=$2
+
+ stat $DIR/$tdir/test-framework.sh ||
+ error "($errno) Fail to stat"
+ do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
+ error "($errno) Fail to list $FSNAME.pool1"
+ do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
+ error "($errno) Fail to list $FSNAME.$save_fsname"
+ do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
+ grep ${FSNAME}-OST0000 ||
+ error "($errno) List $FSNAME.$save_fsname is invalid"
+
+ local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
+ [ "$pname" = "$save_fsname" ] ||
+ error "($errno) Unexpected pool name $pname"
+}
+
+test_103() {
+ check_mount_and_prep
+ rm -rf $DIR/$tdir
+ mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
+ cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
+ error "(2) Fail to copy test-framework.sh"
+
+ do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
+ error "(3) Fail to create $FSNAME.pool1"
+ # name the pool name as the fsname
+ do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
+ error "(4) Fail to create $FSNAME.$FSNAME"
+
+ test_103_set_pool $FSNAME OST0000
+
+ $SETSTRIPE -p $FSNAME $DIR/$tdir/d0 ||
+ error "(6) Fail to setstripe on $DIR/$tdir/d0"
+
+ KEEP_ZPOOL=true
+ stopall
+
+ test_renamefs mylustre
+
+ local save_fsname=$FSNAME
+ FSNAME="mylustre"
+ setupall
+
+ test_103_check_pool $save_fsname 7
+
+ if [ $OSTCOUNT -ge 2 ]; then
+ test_103_set_pool $save_fsname OST0001
+ fi
+
+ $SETSTRIPE -p $save_fsname $DIR/$tdir/f0 ||
+ error "(16) Fail to setstripe on $DIR/$tdir/f0"
+
+ stopall
+
+ test_renamefs tfs
+
+ FSNAME="tfs"
+ setupall
+
+ test_103_check_pool $save_fsname 17
+
+ stopall
+
+ test_renamefs $save_fsname
+
+ FSNAME=$save_fsname
+ setupall
+ KEEP_ZPOOL=false
+}
+run_test 103 "rename filesystem name"
+
if ! combined_mgs_mds ; then
stop mgs
fi