Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-8303 lnet: make connection more stable with packet loss
[fs/lustre-release.git]
/
lustre
/
target
/
tgt_lastrcvd.c
diff --git
a/lustre/target/tgt_lastrcvd.c
b/lustre/target/tgt_lastrcvd.c
index
0c9cc87
..
f0d9222
100644
(file)
--- a/
lustre/target/tgt_lastrcvd.c
+++ b/
lustre/target/tgt_lastrcvd.c
@@
-308,7
+308,7
@@
static void tgt_free_reply_data(struct lu_target *lut,
{
CDEBUG(D_TRACE, "%s: free reply data %p: xid %llu, transno %llu, "
"client gen %u, slot idx %d\n",
- tgt_name(lut), trd, trd->trd_reply.lrd_xid,
+
lut == NULL ? "" :
tgt_name(lut), trd, trd->trd_reply.lrd_xid,
trd->trd_reply.lrd_transno, trd->trd_reply.lrd_client_gen,
trd->trd_index);
@@
-316,7
+316,8
@@
static void tgt_free_reply_data(struct lu_target *lut,
list_del(&trd->trd_list);
ted->ted_reply_cnt--;
- tgt_clear_reply_slot(lut, trd->trd_index);
+ if (lut != NULL)
+ tgt_clear_reply_slot(lut, trd->trd_index);
OBD_FREE_PTR(trd);
}
@@
-331,7
+332,7
@@
static void tgt_release_reply_data(struct lu_target *lut,
{
CDEBUG(D_TRACE, "%s: release reply data %p: xid %llu, transno %llu, "
"client gen %u, slot idx %d\n",
- tgt_name(lut), trd, trd->trd_reply.lrd_xid,
+
lut == NULL ? "" :
tgt_name(lut), trd, trd->trd_reply.lrd_xid,
trd->trd_reply.lrd_transno, trd->trd_reply.lrd_client_gen,
trd->trd_index);
@@
-377,6
+378,9
@@
int tgt_client_alloc(struct obd_export *exp)
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);
@@
-418,9
+422,12
@@
void tgt_client_free(struct obd_export *exp)
OBD_FREE_PTR(ted->ted_lcd);
ted->ted_lcd = NULL;
- /* Slot may be not yet assigned */
- if (ted->ted_lr_idx < 0)
+ /* Target may have been freed (see LU-7430)
+ * Slot may be not yet assigned */
+ if (exp->exp_obd->u.obt.obt_magic != OBT_MAGIC ||
+ ted->ted_lr_idx < 0)
return;
+
/* Clear bit when lcd is freed */
LASSERT(lut && lut->lut_client_bitmap);
if (!test_and_clear_bit(ted->ted_lr_idx, lut->lut_client_bitmap)) {
@@
-745,7
+752,7
@@
void tgt_boot_epoch_update(struct lu_target *tgt)
}
/**
- * commit callback, need to update last_commited value
+ * commit callback, need to update last_commit
t
ed value
*/
struct tgt_last_committed_callback {
struct dt_txn_commit_cb llcc_cb;
@@
-777,7
+784,9
@@
static void tgt_cb_last_committed(struct lu_env *env, struct thandle *th,
if (ccb->llcc_transno > ccb->llcc_exp->exp_last_committed) {
ccb->llcc_exp->exp_last_committed = ccb->llcc_transno;
spin_unlock(&ccb->llcc_tgt->lut_translock);
+
ptlrpc_commit_replies(ccb->llcc_exp);
+ tgt_cancel_slc_locks(ccb->llcc_transno);
} else {
spin_unlock(&ccb->llcc_tgt->lut_translock);
}
@@
-1708,23
+1717,16
@@
int tgt_txn_start_cb(const struct lu_env *env, struct thandle *th,
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);
@@
-1732,6
+1734,14
@@
int tgt_txn_start_cb(const struct lu_env *env, struct thandle *th,
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 &&