- struct obd_device *obd = ofd_obd(ofd);
- struct lr_server_data *lsd = &ofd->ofd_lut.lut_lsd;
- struct lsd_client_data *lcd = NULL;
- struct filter_export_data *fed;
- int cl_idx;
- int rc = 0;
- loff_t off = lsd->lsd_client_start;
-
- CLASSERT(offsetof(struct lsd_client_data, lcd_padding) +
- sizeof(lcd->lcd_padding) == LR_CLIENT_SIZE);
-
- OBD_ALLOC_PTR(lcd);
- if (lcd == NULL)
- RETURN(-ENOMEM);
-
- for (cl_idx = 0; off < fsize; cl_idx++) {
- struct obd_export *exp;
- __u64 last_rcvd;
-
- /* Don't assume off is incremented properly by
- * fsfilt_read_record(), in case sizeof(*lcd)
- * isn't the same as fsd->lsd_client_size. */
- off = lsd->lsd_client_start + cl_idx * lsd->lsd_client_size;
- rc = lut_client_data_read(env, &ofd->ofd_lut, lcd, &off, cl_idx);
- if (rc) {
- CERROR("error reading FILT %s idx %d off %llu: rc %d\n",
- LAST_RCVD, cl_idx, off, rc);
- rc = 0;
- break; /* read error shouldn't cause startup to fail */
- }
-
- if (lcd->lcd_uuid[0] == '\0') {
- CDEBUG(D_INFO, "skipping zeroed client at offset %d\n",
- cl_idx);
- continue;
- }
-
- last_rcvd = lcd->lcd_last_transno;
-
- /* These exports are cleaned up by ofd_disconnect(), so they
- * need to be set up like real exports as ofd_connect() does.
- */
- exp = class_new_export(obd, (struct obd_uuid *)lcd->lcd_uuid);
-
- CDEBUG(D_HA, "RCVRNG CLIENT uuid: %s idx: %d lr: "LPU64
- " srv lr: "LPU64"\n", lcd->lcd_uuid, cl_idx,
- last_rcvd, lsd->lsd_last_transno);
-
- if (IS_ERR(exp)) {
- if (PTR_ERR(exp) == -EALREADY) {
- /* export already exists, zero out this one */
- CERROR("Duplicate export %s!\n", lcd->lcd_uuid);
- continue;
- }
- GOTO(err_out, rc = PTR_ERR(exp));
- }
-
- fed = &exp->exp_filter_data;
- *fed->fed_ted.ted_lcd = *lcd;
-
- rc = lut_client_add(env, exp, cl_idx);
- LASSERTF(rc == 0, "rc = %d\n", rc); /* can't fail existing */
- /* VBR: set export last committed version */
- exp->exp_last_committed = last_rcvd;
- cfs_spin_lock(&exp->exp_lock);
- exp->exp_connecting = 0;
- exp->exp_in_recovery = 0;
- cfs_spin_unlock(&exp->exp_lock);
- obd->obd_max_recoverable_clients++;
- class_export_put(exp);
-
- /* Need to check last_rcvd even for duplicated exports. */
- CDEBUG(D_OTHER, "client at idx %d has last_rcvd = "LPU64"\n",
- cl_idx, last_rcvd);
-
- cfs_spin_lock(&ofd->ofd_lut.lut_translock);
- if (last_rcvd > lsd->lsd_last_transno)
- lsd->lsd_last_transno = last_rcvd;
- cfs_spin_unlock(&ofd->ofd_lut.lut_translock);
+ struct seq_server_site *ss = &ofd->ofd_seq_site;
+ char *lwp_name = NULL;
+ int rc;
+
+ OBD_ALLOC(lwp_name, MAX_OBD_NAME);
+ if (lwp_name == NULL)
+ GOTO(out_free, rc = -ENOMEM);
+
+ rc = tgt_name2lwpname(ofd_name(ofd), lwp_name);
+ if (rc != 0)
+ GOTO(out_free, rc);
+
+ rc = lustre_register_lwp_item(lwp_name, &ss->ss_client_seq->lcs_exp,
+ NULL, NULL);
+ if (rc != 0)
+ GOTO(out_free, rc);
+
+ rc = lustre_register_lwp_item(lwp_name,
+ &ss->ss_server_fld->lsf_control_exp,
+ ofd_register_lwp_callback, ofd);
+ if (rc != 0) {
+ lustre_deregister_lwp_item(&ss->ss_client_seq->lcs_exp);
+ ss->ss_client_seq->lcs_exp = NULL;
+ GOTO(out_free, rc);