- if is_linux; then
- typeset TRIES=0
- typeset THREAD_PID
- while [[ $TRIES -lt 50 ]]; do
- THREAD_PID=$(pgrep spa_vdev_remove)
- [[ "$THREAD_PID" ]] && break
- sleep 0.1
- (( TRIES = TRIES + 1 ))
- done
- [[ "$THREAD_PID" ]] || \
- log_fail "removal thread is not running TRIES=$TRIES THREAD_PID=$THREAD_PID"
- else
- #
- # Try to get the address of the removal thread.
- #
- typeset THREAD_ADDR=$(mdb -ke "$1::print \
- spa_t spa_vdev_removal->svr_thread" | awk "{print \$3}")
-
- #
- # if address is NULL it means that the thread is
- # not running.
- #
- [[ "$THREAD_ADDR" = 0 ]] && \
- log_fail "removal thread is not running"
- fi
-