- if (!(exp->exp_flags & OBD_OPT_FAILOVER)) {
- /* Don't force sync on disconnect if aborting recovery,
- * or it does num_clients * num_osts. b=17194 */
- int need_sync = exp->exp_need_sync &&
- !(exp->exp_flags&OBD_OPT_ABORT_RECOV);
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- rc = fsfilt_write_record(obd, filter->fo_rcvd_filp, &zero_lcd,
- sizeof(zero_lcd), &off, 0);
-
- /* Make sure the server's last_transno is up to date. Do this
- * after the client is freed so we know all the client's
- * transactions have been committed. */
- if (rc == 0)
- filter_update_server_data(obd, filter->fo_rcvd_filp,
- filter->fo_fsd, need_sync);
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ /* Make sure the server's last_transno is up to date.
+ * This should be done before zeroing client slot so last_transno will
+ * be in server data or in client data in case of failure */
+ filter_update_server_data(obd, filter->fo_rcvd_filp, filter->fo_fsd);
+
+ cfs_mutex_down(&fed->fed_lcd_lock);
+ rc = fsfilt_write_record(obd, filter->fo_rcvd_filp, &zero_lcd,
+ sizeof(zero_lcd), &off, 0);
+ fed->fed_lcd = NULL;
+ cfs_mutex_up(&fed->fed_lcd_lock);
+ pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);