if (rc)
GOTO(out, rc);
+ rc = lod_qos_ost_in_use_clear(env, lo->ldo_stripenr);
+ if (rc)
+ GOTO(out, rc);
+
if (--lqr->lqr_start_count <= 0) {
lqr->lqr_start_idx = cfs_rand() % osts->op_count;
lqr->lqr_start_count =
if (rc)
GOTO(out, rc);
+ rc = lod_qos_ost_in_use_clear(env, lo->ldo_stripenr);
+ if (rc)
+ GOTO(out, rc);
+
good_osts = 0;
/* Find all the OSTs that are valid stripe candidates */
for (i = 0; i < osts->op_count; i++) {
*/
if (lod_qos_is_ost_used(env, idx, nfound))
continue;
+ lod_qos_ost_in_use(env, nfound, idx);
o = lod_qos_declare_object_on(env, m, idx, th);
if (IS_ERR(o)) {
- CERROR("can't declare new object on #%u: %d\n",
- idx, (int) PTR_ERR(o));
+ QOS_DEBUG("can't declare object on #%u: %d\n",
+ idx, (int) PTR_ERR(o));
continue;
}
- lod_qos_ost_in_use(env, nfound, idx);
lo->ldo_stripe[nfound++] = o;
lod_qos_used(m, osts, idx, &total_weight);
rc = 0;
break;
}
+ }
- /* should never satisfy below condition */
- if (rc) {
- CERROR("Didn't find any OSTs?\n");
- break;
+ if (unlikely(nfound != stripe_cnt)) {
+ /*
+ * when the decision to use weighted algorithm was made
+ * we had enough appropriate OSPs, but this state can
+ * change anytime (no space on OST, broken connection, etc)
+ * so it's possible OSP won't be able to provide us with
+ * an object due to just changed state
+ */
+ LCONSOLE_INFO("wanted %d, found %d\n", stripe_cnt, nfound);
+ for (i = 0; i < nfound; i++) {
+ LASSERT(lo->ldo_stripe[i]);
+ lu_object_put(env, &lo->ldo_stripe[i]->do_lu);
+ lo->ldo_stripe[i] = NULL;
}
+
+ /* makes sense to rebalance next time */
+ m->lod_qos.lq_dirty = 1;
+ m->lod_qos.lq_same_space = 0;
+
+ rc = -EAGAIN;
}
- LASSERT(nfound == stripe_cnt);
out:
cfs_up_write(&m->lod_qos.lq_rw_sem);
GOTO(out, rc = -ENOMEM);
lo->ldo_stripes_allocated = lo->ldo_stripenr;
- rc = lod_qos_ost_in_use_clear(env, lo->ldo_stripenr);
- if (rc)
- GOTO(out, rc);
-
lod_getref(d);
/* XXX: support for non-0 files w/o objects */
if (lo->ldo_def_stripe_offset >= d->lod_desc.ld_tgt_count) {
echo Max free space: OST $MAXI: $MAXV
}
-test_116() {
+test_116a() { # was previously test_116()
[ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2 OSTs" && return
echo -n "Free space priority "
rm -rf $DIR/$tdir
}
-run_test 116 "stripe QOS: free space balance ==================="
+run_test 116a "stripe QOS: free space balance ==================="
+
+test_116b() { # LU-2093
+#define OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
+ local old_rr
+ old_rr=$(do_facet $SINGLEMDS lctl get_param -n lov.*mdtlov*.qos_threshold_rr)
+ do_facet $SINGLEMDS lctl set_param lov.*mdtlov*.qos_threshold_rr 0
+ mkdir -p $DIR/$tdir
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x147
+ createmany -o $DIR/$tdir/f- 20 || error "can't create"
+ do_facet $SINGLEMDS lctl set_param fail_loc=0
+ rm -rf $DIR/$tdir
+ do_facet $SINGLEMDS lctl set_param lov.*mdtlov*.qos_threshold_rr $old_rr
+}
+run_test 116b "QoS shouldn't LBUG if not enough OSTs found on the 2nd pass"
test_117() # bug 10891
{