- dt_trans_stop(env, ofd->ofd_osd, th);
-}
-
-/*
- * last_rcvd & last_committed update callbacks
- */
-static int ofd_last_rcvd_update(struct ofd_thread_info *info,
- struct thandle *th)
-{
- struct ofd_device *ofd = ofd_exp(info->fti_exp);
- struct filter_export_data *fed;
- struct lsd_client_data *lcd;
- __s32 rc = th->th_result;
- __u64 *transno_p;
- loff_t off;
- int err;
- bool lw_client = false;
-
- ENTRY;
-
- LASSERT(ofd);
- LASSERT(info->fti_exp);
-
- if ((info->fti_exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0)
- lw_client = true;
-
- fed = &info->fti_exp->exp_filter_data;
- LASSERT(fed);
- lcd = fed->fed_ted.ted_lcd;
- /* if the export has already been disconnected, we have no last_rcvd
- * slot, update server data with latest transno then */
- if (lcd == NULL) {
- CWARN("commit transaction for disconnected client %s: rc %d\n",
- info->fti_exp->exp_client_uuid.uuid, rc);
- err = tgt_server_data_write(info->fti_env, &ofd->ofd_lut, th);
- RETURN(err);
- }
- /* ofd connect may cause transaction before export has last_rcvd
- * slot */
- if (fed->fed_ted.ted_lr_idx < 0 && !lw_client)
- RETURN(0);
- off = fed->fed_ted.ted_lr_off;
-
- transno_p = &lcd->lcd_last_transno;
- lcd->lcd_last_xid = info->fti_xid;
-
- /*
- * When we store zero transno in mcd we can lost last transno value
- * because mcd contains 0, but msd is not yet written
- * The server data should be updated also if the latest
- * transno is rewritten by zero. See the bug 11125 for details.
- */
- if (info->fti_transno == 0 &&
- *transno_p == ofd->ofd_lut.lut_last_transno) {
- spin_lock(&ofd->ofd_lut.lut_translock);
- ofd->ofd_lut.lut_lsd.lsd_last_transno =
- ofd->ofd_lut.lut_last_transno;
- spin_unlock(&ofd->ofd_lut.lut_translock);
- tgt_server_data_write(info->fti_env, &ofd->ofd_lut, th);
- }
-
- *transno_p = info->fti_transno;
- if (lw_client) {
- /* Although lightweight (LW) connections have no slot in
- * last_rcvd, we still want to maintain the in-memory
- * lsd_client_data structure in order to properly handle reply
- * reconstruction. */
- struct lu_target *tg =&ofd->ofd_lut;
- bool update = false;
-
- err = 0;
- /* All operations performed by LW clients are synchronous and
- * we store the committed transno in the last_rcvd header */
- spin_lock(&tg->lut_translock);
- if (info->fti_transno > tg->lut_lsd.lsd_last_transno) {
- tg->lut_lsd.lsd_last_transno = info->fti_transno;
- update = true;
- }
- spin_unlock(&tg->lut_translock);
- if (update)
- err = tgt_server_data_write(info->fti_env, tg, th);
- } else {
- LASSERT(fed->fed_ted.ted_lr_off > 0);
- err = tgt_client_data_write(info->fti_env, &ofd->ofd_lut, lcd,
- &off, th);
- }
-
- RETURN(err);