+test_44() { # 16317
+ setup
+ check_mount || return 2
+ UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
+ STATS_FOUND=no
+ UUIDS=$(do_facet mds "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
+ for VAL in $UUIDS; do
+ NID=$(echo $VAL | cut -d= -f1)
+ CLUUID=$(echo $VAL | cut -d= -f2)
+ [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
+ done
+ [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
+ cleanup
+ return 0
+}
+run_test 44 "mounted client proc entry exists"
+
+test_45() { #17310
+ setup
+ check_mount || return 2
+ stop_mds
+ df -h $MOUNT &
+ log "sleep 60 sec"
+ sleep 60
+#define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
+ do_facet client "lctl set_param fail_loc=0x50f"
+ log "sleep 10 sec"
+ sleep 10
+ manual_umount_client --force || return 3
+ do_facet client "lctl set_param fail_loc=0x0"
+ start_mds
+ mount_client $MOUNT || return 4
+ cleanup
+ return 0
+}
+run_test 45 "long unlink handling in ptlrpcd"
+
+test_46a() {
+ OSTCOUNT=6
+ reformat
+ start_mds || return 1
+ #first client should see only one ost
+ start_ost || return 2
+ wait_osc_import_state mds ost FULL
+ #start_client
+ mount_client $MOUNT || return 3
+
+ start_ost2 || return 4
+ start ost3 `ostdevname 3` $OST_MOUNT_OPTS || return 5
+ start ost4 `ostdevname 4` $OST_MOUNT_OPTS || return 6
+ start ost5 `ostdevname 5` $OST_MOUNT_OPTS || return 7
+ # wait until ost2-5 is sync
+ # ping_interval + 1
+ wait_osc_import_state mds ost2 FULL
+ wait_osc_import_state mds ost3 FULL
+ wait_osc_import_state mds ost4 FULL
+ wait_osc_import_state mds ost5 FULL
+ #second client see all ost's
+
+ mount_client $MOUNT2 || return 8
+ $LFS setstripe $MOUNT2 -c -1 || return 9
+ $LFS getstripe $MOUNT2 || return 10
+
+ echo "ok" > $MOUNT2/widestripe
+ $LFS getstripe $MOUNT2/widestripe || return 11
+ # fill acl buffer for avoid expand lsm to them
+ awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
+ setfacl -m $acl $MOUNT2/widestripe
+ done
+
+ # will be deadlock
+ stat $MOUNT/widestripe || return 12
+
+ umount_client $MOUNT2 || return 13
+ umount_client $MOUNT || return 14
+ stop ost5 -f || return 20
+ stop ost4 -f || return 21
+ stop ost3 -f || return 22
+ stop_ost2 || return 23
+ stop_ost || return 24
+ stop_mds || return 25
+}
+run_test 46a "handle ost additional - wide striped file"
+
+test_47() { #17674
+ reformat
+ setup_noconfig
+ check_mount || return 2
+ $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
+
+ local lru_size=[]
+ local count=0
+ for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
+ if echo $ns | grep "MDT[[:digit:]]*"; then
+ continue
+ fi
+ lrs=$(echo $ns | sed 's/.*lru_size=//')
+ lru_size[count]=$lrs
+ let count=count+1
+ done
+
+ facet_failover ost1
+ facet_failover $SINGLEMDS
+ df -h $MOUNT || return 3
+
+ count=0
+ for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
+ if echo $ns | grep "MDT[[:digit:]]*"; then
+ continue
+ fi
+ lrs=$(echo $ns | sed 's/.*lru_size=//')
+ if ! test "$lrs" -eq "${lru_size[count]}"; then
+ n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
+ error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
+ fi
+ let count=count+1
+ done
+
+ cleanup
+ return 0
+}
+run_test 47 "server restart does not make client loss lru_resize settings"
+
+cleanup_48() {
+ trap 0
+
+ # reformat after this test is needed - if test will failed
+ # we will have unkillable file at FS
+ reformat_and_config
+}
+
+test_48() { # bug 17636
+ reformat
+ setup_noconfig
+ check_mount || return 2
+
+ $LFS setstripe $MOUNT -c -1 || return 9
+ $LFS getstripe $MOUNT || return 10
+
+ echo "ok" > $MOUNT/widestripe
+ $LFS getstripe $MOUNT/widestripe || return 11
+
+ trap cleanup_48 EXIT ERR
+
+ # fill acl buffer for avoid expand lsm to them
+ getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
+ setfacl -m $acl $MOUNT/widestripe
+ done
+
+ stat $MOUNT/widestripe || return 12
+
+ cleanup_48
+ return 0
+}
+run_test 48 "too many acls on file"
+
+# check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
+test_49() { # bug 17710
+ local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
+ local OLD_OST_MKFS_OPTS=$OST_MKFS_OPTS
+ local LOCAL_TIMEOUT=20
+
+
+ OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$LOCAL_TIMEOUT $MKFSOPT $OSTOPT"
+
+ reformat
+ start_mds
+ start_ost
+ mount_client $MOUNT
+ check_mount || return 1
+
+ echo "check ldlm_timout..."
+ LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
+ LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
+ LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
+
+ if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
+ error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
+ fi
+
+ if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
+ error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
+ fi
+
+ umount_client $MOUNT
+ stop_ost || return 2
+ stop_mds || return 3
+
+ OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$((LOCAL_TIMEOUT - 1)) $MKFSOPT $OSTOPT"
+
+ reformat
+ start_mds || return 4
+ start_ost || return 5
+ mount_client $MOUNT || return 6
+ check_mount || return 7
+
+ LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
+ LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
+ LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
+
+ if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
+ error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
+ fi
+
+ if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
+ error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
+ fi
+
+ cleanup || return $?
+
+ MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
+ OST_MKFS_OPTS=$OLD_OST_MKFS_OPTS
+}
+run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
+
+lazystatfs() {
+ # Test both statfs and lfs df and fail if either one fails
+ multiop_bg_pause $1 f_
+ RC1=$?
+ PID=$!
+ killall -USR1 multiop
+ [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
+ wait $PID || { RC1=$?; log "multiop return error "; }
+
+ $LFS df &
+ PID=$!
+ sleep 5
+ kill -s 0 $PID
+ RC2=$?
+ if [ $RC2 -eq 0 ]; then
+ kill -s 9 $PID
+ log "lazystatfs df failed"
+ fi
+
+ RC=0
+ [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
+ return $RC
+}
+
+test_50a() {
+ setup
+ lctl set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile
+
+ lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
+
+ cleanup || return $?
+}
+run_test 50a "lazystatfs all servers available =========================="
+
+test_50b() {
+ setup
+ lctl set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile
+
+ # Wait for client to detect down OST
+ stop_ost || error "Unable to stop OST1"
+ wait_osc_import_state mds ost DISCONN
+
+ lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
+
+ umount_client $MOUNT || error "Unable to unmount client"
+ stop_mds || error "Unable to stop MDS"
+}
+run_test 50b "lazystatfs all servers down =========================="
+
+test_50c() {
+ start_mds || error "Unable to start MDS"
+ start_ost || error "Unable to start OST1"
+ start_ost2 || error "Unable to start OST2"
+ mount_client $MOUNT || error "Unable to mount client"
+ lctl set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile
+
+ # Wait for client to detect down OST
+ stop_ost || error "Unable to stop OST1"
+ wait_osc_import_state mds ost DISCONN
+ lazystatfs $MOUNT || error "lazystatfs failed with one down server"
+
+ umount_client $MOUNT || error "Unable to unmount client"
+ stop_ost2 || error "Unable to stop OST2"
+ stop_mds || error "Unable to stop MDS"
+}
+run_test 50c "lazystatfs one server down =========================="
+
+test_50d() {
+ start_mds || error "Unable to start MDS"
+ start_ost || error "Unable to start OST1"
+ start_ost2 || error "Unable to start OST2"
+ mount_client $MOUNT || error "Unable to mount client"
+ lctl set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile
+
+ # Issue the statfs during the window where the client still
+ # belives the OST to be available but it is in fact down.
+ # No failure just a statfs which hangs for a timeout interval.
+ stop_ost || error "Unable to stop OST1"
+ lazystatfs $MOUNT || error "lazystatfs failed with one down server"
+
+ umount_client $MOUNT || error "Unable to unmount client"
+ stop_ost2 || error "Unable to stop OST2"
+ stop_mds || error "Unable to stop MDS"
+}
+run_test 50d "lazystatfs client/server conn race =========================="
+
+test_50e() {
+ local RC1
+ local pid
+
+ reformat_and_config
+ start_mds || return 1
+ #first client should see only one ost
+ start_ost || return 2
+ wait_osc_import_state mds ost FULL
+
+ # Wait for client to detect down OST
+ stop_ost || error "Unable to stop OST1"
+ wait_osc_import_state mds ost DISCONN
+
+ mount_client $MOUNT || error "Unable to mount client"
+ lctl set_param llite.$FSNAME-*.lazystatfs=0
+
+ multiop_bg_pause $MOUNT _f
+ RC1=$?
+ pid=$!
+
+ if [ $RC1 -ne 0 ]; then
+ log "multiop failed $RC1"
+ else
+ kill -USR1 $pid
+ sleep $(( $TIMEOUT+1 ))
+ kill -0 $pid
+ [ $? -ne 0 ] && error "process isn't sleep"
+ start_ost || error "Unable to start OST1"
+ wait $pid || error "statfs failed"
+ fi
+
+ umount_client $MOUNT || error "Unable to unmount client"
+ stop_ost || error "Unable to stop OST1"
+ stop_mds || error "Unable to stop MDS"
+}
+run_test 50e "normal statfs all servers down =========================="
+
+test_50f() {
+ local RC1
+ local pid
+ CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
+
+ start_mds || error "Unable to start mds"
+ #first client should see only one ost
+ start_ost || error "Unable to start OST1"
+ wait_osc_import_state mds ost FULL
+
+ start_ost2 || error "Unable to start OST2"
+ wait_osc_import_state mds ost2 FULL
+
+ # Wait for client to detect down OST
+ stop_ost2 || error "Unable to stop OST2"
+
+ wait_osc_import_state mds ost2 DISCONN
+ mount_client $MOUNT || error "Unable to mount client"
+ lctl set_param llite.$FSNAME-*.lazystatfs=0
+
+ multiop_bg_pause $MOUNT _f
+ RC1=$?
+ pid=$!
+
+ if [ $RC1 -ne 0 ]; then
+ log "lazystatfs multiop failed $RC1"
+ else
+ kill -USR1 $pid
+ sleep $(( $TIMEOUT+1 ))
+ kill -0 $pid
+ [ $? -ne 0 ] && error "process isn't sleep"
+ start_ost2 || error "Unable to start OST2"
+ wait $pid || error "statfs failed"
+ stop_ost2 || error "Unable to stop OST2"
+ fi
+
+ umount_client $MOUNT || error "Unable to unmount client"
+ stop_ost || error "Unable to stop OST1"
+ stop_mds || error "Unable to stop MDS"
+ writeconf
+}
+run_test 50f "normal statfs one server in down =========================="
+
+test_51() {
+ local LOCAL_TIMEOUT=20
+
+ reformat
+ start_mds
+ start_ost
+ mount_client $MOUNT
+ check_mount || return 1
+
+ mkdir $MOUNT/d1
+ $LFS setstripe -c -1 $MOUNT/d1
+ #define OBD_FAIL_MDS_REINT_DELAY 0x142
+ do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
+ touch $MOUNT/d1/f1 &
+ local pid=$!
+ sleep 2
+ start_ost2 || return 2
+ wait $pid
+ stop_ost2 || return 3
+ cleanup
+}
+run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
+
+cleanup_gss