{
struct obd_import *imp = class_exp2cliimp(lmv->tgts[0].ltd_exp);
__u32 id;
- /*
- * XXX Hack: to get nid we assume that underlying obd device is mdc.
- */
+ /*
+ * XXX Hack: to get nid we assume that underlying obd device is mdc.
+ */
id = imp->imp_connection->c_self ^ (imp->imp_connection->c_self >> 32);
return id % lmv->desc.ld_tgt_count;
}
rc = 0;
}
EXIT;
+#if 0
out:
+#endif
if (rc) {
CERROR("Can't choose MDS, err = %d\n", rc);
} else {
/* Do actuall allocation. */
down_write(&lov->lov_qos.lq_rw_sem);
+
+ /*
+ * Check again. While we were sleeping on @lq_rw_sem something could
+ * change.
+ */
+ if (!lov->lov_qos.lq_dirty_rr) {
+ LASSERT(lov->lov_qos.lq_rr_size);
+ up_write(&lov->lov_qos.lq_rw_sem);
+ RETURN(0);
+ }
+
ost_count = lov->desc.ld_tgt_count;
if (lov->lov_qos.lq_rr_size)
/* Do actuall allocation, use write lock here. */
down_write(&lov->lov_qos.lq_rw_sem);
+
+ /*
+ * Check again, while we were sleeping on @lq_rw_sem things could
+ * change.
+ */
+ if (!lov->lov_qos.lq_dirty) {
+ up_write(&lov->lov_qos.lq_rw_sem);
+ GOTO(out, rc = -EAGAIN);
+ }
ost_count = lov->desc.ld_tgt_count;
if (lov->desc.ld_active_tgt_count < 2)