}
wait_update () {
- local node=$1
- local TEST=$2
- local FINAL=$3
- local MAX=${4:-90}
-
- local RESULT
- local WAIT=0
- local sleep=1
- local print=10
- while [ true ]; do
- RESULT=$(do_node $node "$TEST")
- if [ "$RESULT" == "$FINAL" ]; then
- [ -z "$RESULT" -o $WAIT -le $sleep ] ||
- echo "Updated after ${WAIT}s: wanted '$FINAL' got '$RESULT'"
- return 0
- fi
- [ $WAIT -ge $MAX ] && break
- [ $((WAIT % print)) -eq 0 ] &&
- echo "Waiting $((MAX - WAIT)) secs for update"
- WAIT=$((WAIT + sleep))
- sleep $sleep
- done
- echo "Update not seen after ${MAX}s: wanted '$FINAL' got '$RESULT'"
- return 3
+ local verbose=false
+ if [[ "$1" == "--verbose" ]]; then
+ shift
+ verbose=true
+ fi
+
+ local node=$1
+ local TEST=$2
+ local FINAL=$3
+ local MAX=${4:-90}
+ local RESULT
+ local PREV_RESULT
+ local WAIT=0
+ local sleep=1
+ local print=10
+
+ while [ true ]; do
+ RESULT=$(do_node $node "$TEST")
+ if [[ "$RESULT" == "$FINAL" ]]; then
+ [[ -z "$RESULT" || $WAIT -le $sleep ]] ||
+ echo "Updated after ${WAIT}s: wanted '$FINAL'"\
+ "got '$RESULT'"
+ return 0
+ fi
+ if [[ $verbose && "$RESULT" != "$PREV_RESULT" ]]; then
+ echo "Changed after ${WAIT}s: from '$PREV_RESULT'"\
+ "to '$RESULT'"
+ PREV_RESULT=$RESULT
+ fi
+ [[ $WAIT -ge $MAX ]] && break
+ [[ $((WAIT % print)) -eq 0 ]] &&
+ echo "Waiting $((MAX - WAIT)) secs for update"
+ WAIT=$((WAIT + sleep))
+ sleep $sleep
+ done
+ echo "Update not seen after ${MAX}s: wanted '$FINAL' got '$RESULT'"
+ return 3
}
wait_update_facet() {
# empty lustre filesystem may have empty directories lost+found and .lustre
is_empty_fs() {
+ # exclude .lustre & lost+found
[ $(find $1 -maxdepth 1 -name lost+found -o -name .lustre -prune -o \
-print | wc -l) = 1 ] || return 1
[ ! -d $1/lost+found ] || is_empty_dir $1/lost+found || return 1
- [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre || return 1
+ if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.0) ]; then
+ # exclude .lustre/fid (LU-2780)
+ [ $(find $1/.lustre -maxdepth 1 -name fid -prune -o \
+ -print | wc -l) = 1 ] || return 1
+ else
+ [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre || return 1
+ fi
return 0
}
fi
mount -t $(facet_fstype $facet) $opts $ostdev $mntpt ||
return $?
- rc=0;
+ rc=0
for i in $objids; do
rm $mntpt/O/$group/d$((i % 32))/$i || { rc=$?; break; }
done
fi
mount -t $(facet_fstype $facet) $opts $mdtdev $mntpt ||
return $?
- rc=0;
+ rc=0
for f in $files; do
rm $mntpt/ROOT/$f || { rc=$?; break; }
done
local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
- do_facet $SINGLEMDS "$DUMPE2FS -h $mds_dev 2>&1 | grep -q large_xattr"
+ do_facet $SINGLEMDS "$DUMPE2FS -h $mds_dev 2>&1 |
+ grep -E -q '(ea_inode|large_xattr)'"
return ${PIPESTATUS[0]}
}