{
struct lov_desc *desc = <d->ltd_lov_desc;
int rc;
+ ENTRY;
LASSERT(d);
LASSERT(tgt);
}
spin_unlock(&d->lod_lock);
}
+ if (rc == -ENOTCONN) {
+ /* In case that the ENOTCONN for inactive OST state is
+ * mistreated as MDT disconnection state by the client,
+ * this error should be changed to someone else.
+ */
+ rc = -EREMOTEIO;
+ }
- return rc;
+ RETURN(rc);
}
static int lod_is_tgt_usable(struct lu_tgt_descs *ltd, struct lu_tgt_desc *tgt)
}
run_test 27ce "more stripes than OSTs with -o"
+test_27cf() {
+ local osp_proc="osp.$FSNAME-OST0000-osc-MDT000*.active"
+ local pid=0
+
+ test_mkdir -p $DIR/$tdir || error "failed to mkdir $DIR/$tdir"
+ do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=0"
+ stack_trap "do_facet $SINGLEMDS $LCTL set_param -n $osp_proc=1" EXIT
+ wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 1" ||
+ error "failed to set $osp_proc=0"
+
+ $LFS setstripe -o 0 $DIR/$tdir/$tfile &
+ pid=$!
+ sleep 1
+ do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=1"
+ wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 0" ||
+ error "failed to set $osp_proc=1"
+ wait $pid
+ [[ $pid -ne 0 ]] ||
+ error "should return error due to $osp_proc=0"
+}
+run_test 27cf "'setstripe -o' on inactive OSTs should return error"
+
test_27d() {
test_mkdir $DIR/$tdir
$LFS setstripe -c 0 -i -1 -S 0 $DIR/$tdir/$tfile ||
}
if (ioctl(fd, LL_IOC_LOV_SETSTRIPE, lum) != 0) {
- char *errmsg = "stripe already set";
+ char errmsg[512] = "stripe already set";
rc = -errno;
if (errno != EEXIST && errno != EALREADY)
- errmsg = strerror(errno);
+ strncpy(errmsg, strerror(errno), sizeof(errmsg) - 1);
+ if (rc == -EREMOTEIO)
+ snprintf(errmsg, sizeof(errmsg),
+ "inactive OST among your specified %d OST(s)",
+ param->lsp_stripe_count);
llapi_err_noerrno(LLAPI_MSG_ERROR,
"setstripe error for '%s': %s", name, errmsg);