ENTRY;
target_cleanup_recovery(m->mdt_md_dev.md_lu_dev.ld_obd);
- mdt_fs_cleanup(ctx, m);
ping_evictor_stop();
mdt_stop_ptlrpc_service(m);
mdt_fld_fini(ctx, m);
+ mdt_fs_cleanup(ctx, m);
/* finish the stack */
mdt_stack_fini(ctx, m, md2lu_dev(m->mdt_child));
static int mdt_destroy_export(struct obd_export *export)
{
struct mdt_export_data *med;
- struct obd_device *obd = export->exp_obd;
- struct mdt_device *mdt;
+ struct obd_device *obd = export->exp_obd;
+ struct mdt_device *mdt;
struct mdt_thread_info *info;
- struct lu_context ctxt;
+ struct lu_context ctxt;
+ struct md_attr *ma;
+ int lmm_size;
+ int cookie_size;
int rc = 0;
ENTRY;
info = lu_context_key_get(&ctxt, &mdt_thread_key);
LASSERT(info != NULL);
memset(info, 0, sizeof *info);
+
+ ma = &info->mti_attr;
+ lmm_size = mdt->mdt_max_mdsize;
+ cookie_size = mdt->mdt_max_cookiesize;
+ OBD_ALLOC(ma->ma_lmm, lmm_size);
+ OBD_ALLOC(ma->ma_cookie, cookie_size);
+
+ if (ma->ma_lmm == NULL || ma->ma_cookie == NULL)
+ GOTO(out, rc = -ENOMEM);
+ ma->ma_need = MA_LOV | MA_COOKIE;
+
/* Close any open files (which may also cause orphan unlinking). */
spin_lock(&med->med_open_lock);
while (!list_empty(&med->med_open_head)) {
class_handle_unhash(&mfd->mfd_handle);
list_del_init(&mfd->mfd_list);
spin_unlock(&med->med_open_lock);
- mdt_mfd_close(&ctxt, mdt, mfd, &info->mti_attr);
+ mdt_mfd_close(&ctxt, mdt, mfd, ma);
/* TODO: if we close the unlinked file,
* we need to remove it's objects from OST */
mdt_object_put(&ctxt, o);
spin_unlock(&med->med_open_lock);
mdt_client_free(&ctxt, mdt, med);
+out:
+ if (ma->ma_lmm)
+ OBD_FREE(ma->ma_lmm, lmm_size);
+ if (ma->ma_cookie)
+ OBD_FREE(ma->ma_cookie, cookie_size);
lu_context_exit(&ctxt);
lu_context_fini(&ctxt);
{
int rc;
- /* FIXME: this should be an ASSERT */
- if (dt == NULL)
- return -EFAULT;
+ LASSERTF(dt != NULL, "dt is NULL when we want to read record\n");
rc = dt->do_body_ops->dbo_read(ctx, dt, buf, count, pos);
{
int rc;
- /* FIXME: this should be an ASSERT */
- if (dt == NULL)
- return -EFAULT;
+ LASSERTF(dt != NULL, "dt is NULL when we want to write record\n");
rc = dt->do_body_ops->dbo_write(ctx, dt, buf, count, pos, th);
if (rc == count)
struct mdt_server_data *msd,
struct thandle *th)
{
+ int rc;
loff_t off = 0;
- return mdt_write_record(ctx, mdt->mdt_last_rcvd,
- msd, sizeof(*msd), &off, th);
+
+ rc = mdt_write_record(ctx, mdt->mdt_last_rcvd,
+ msd, sizeof(*msd), &off, th);
+
+ CDEBUG(D_INFO, "write last_rcvd header rc = %d:\n"
+ "uuid = %s\n"
+ "last_transno = "LPU64"\n",
+ rc,
+ msd->msd_uuid,
+ msd->msd_last_transno);
+ return rc;
}
static int mdt_read_last_rcvd(const struct lu_context *ctx,
struct mdt_client_data *mcd,
loff_t *off, struct thandle *th)
{
- return mdt_write_record(ctx, mdt->mdt_last_rcvd,
- mcd, sizeof(*mcd), off, th);
+ int rc;
+ rc = mdt_write_record(ctx, mdt->mdt_last_rcvd,
+ mcd, sizeof(*mcd), off, th);
+
+ CDEBUG(D_INFO, "write mcd rc = %d:\n"
+ "uuid = %s\n"
+ "last_transno = "LPU64"\n"
+ "last_xid = "LPU64"\n"
+ "last_result = %d\n"
+ "last_data = %d\n"
+ "last_close_transno = "LPU64"\n"
+ "last_close_xid = "LPU64"\n"
+ "last_close_result = %d\n",
+ rc,
+ mcd->mcd_uuid,
+ mcd->mcd_last_transno,
+ mcd->mcd_last_xid,
+ mcd->mcd_last_result,
+ mcd->mcd_last_data,
+ mcd->mcd_last_close_transno,
+ mcd->mcd_last_close_xid,
+ mcd->mcd_last_close_result);
+ return rc;
}
static int mdt_init_clients_data(const struct lu_context *ctx,
dt_txn_callback_del(mdt->mdt_bottom, &mdt->mdt_txn_cb);
class_disconnect_exports(obd); /* cleans up client info too */
-
if (mdt->mdt_last_rcvd)
lu_object_put(ctx, &mdt->mdt_last_rcvd->do_lu);
mdt->mdt_last_rcvd = NULL;