Whamcloud - gitweb
LU-8303 lnet: make connection more stable with packet loss
[fs/lustre-release.git] / lustre / target / tgt_lastrcvd.c
index 74e28f8..f0d9222 100644 (file)
@@ -378,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);
@@ -1714,20 +1717,6 @@ 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)) {
                /*
                 * Use maximum possible file offset for declaration to ensure
@@ -1745,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 &&