ENTRY;
LASSERT(exp != exp->exp_obd->obd_self_export);
+ spin_lock_init(&exp->exp_target_data.ted_nodemap_lock);
+ INIT_LIST_HEAD(&exp->exp_target_data.ted_nodemap_member);
+
OBD_ALLOC_PTR(exp->exp_target_data.ted_lcd);
if (exp->exp_target_data.ted_lcd == NULL)
RETURN(-ENOMEM);
if (tsi->tsi_exp == NULL)
return 0;
- dto = dt_object_locate(tgt->lut_last_rcvd, th->th_dev);
- tti_buf_lcd(tti);
-
- rc = dt_declare_record_write(env, dto, &tti->tti_buf,
- tsi->tsi_exp->exp_target_data.ted_lr_off,
- th);
- if (rc)
- return rc;
-
- tti_buf_lsd(tti);
- rc = dt_declare_record_write(env, dto, &tti->tti_buf, 0, th);
- if (rc)
- return rc;
-
if (tgt_is_multimodrpcs_client(tsi->tsi_exp)) {
- tti->tti_off = atomic_read(&tgt->lut_num_clients) * 8
- * sizeof(struct lsd_reply_data);
+ /*
+ * Use maximum possible file offset for declaration to ensure
+ * ZFS will reserve enough credits for a write anywhere in this
+ * file, since we don't know where in the file the write will be
+ * because a replay slot has not been assigned. This should be
+ * replaced by dmu_tx_hold_append() when available.
+ */
+ tti->tti_off = atomic_read(&tgt->lut_num_clients) * 8 *
+ sizeof(struct lsd_reply_data);
tti->tti_buf.lb_buf = NULL;
tti->tti_buf.lb_len = sizeof(struct lsd_reply_data);
dto = dt_object_locate(tgt->lut_reply_data, th->th_dev);
tti->tti_off, th);
if (rc)
return rc;
+ } else {
+ dto = dt_object_locate(tgt->lut_last_rcvd, th->th_dev);
+ tti_buf_lcd(tti);
+ tti->tti_off = tsi->tsi_exp->exp_target_data.ted_lr_off;
+ rc = dt_declare_record_write(env, dto, &tti->tti_buf,
+ tti->tti_off, th);
+ if (rc)
+ return rc;
}
if (tsi->tsi_vbr_obj != NULL &&