From: huanghua Date: Thu, 7 Sep 2006 14:45:35 +0000 (+0000) Subject: (1) support mdt reconnection from client; X-Git-Tag: v1_8_0_110~486^2~990 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=fd8c5adb38f155fc8fd4fc8c25e65f4da4e06df7;p=fs%2Flustre-release.git (1) support mdt reconnection from client; (2) fix a bug in open replay: it should be fid2; --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 140bcda..2839ea9 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2876,16 +2876,10 @@ static struct lu_object_operations mdt_obj_ops = { }; /* mds_connect_internal */ -static int mdt_connect_internal(const struct lu_context *ctx, +static int mdt_connect_internal(struct obd_export *exp, struct mdt_device *mdt, - struct obd_export *exp, - struct obd_uuid *cluuid, struct obd_connect_data *data) { - struct mdt_export_data *med = &exp->exp_mdt_data; - struct mdt_client_data *mcd; - int rc; - if (data != NULL) { data->ocd_connect_flags &= MDT_CONNECT_SUPPORTED; data->ocd_ibits_known &= MDS_INODELOCK_FULL; @@ -2914,18 +2908,7 @@ static int mdt_connect_internal(const struct lu_context *ctx, mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name); return -EBADE; } - - OBD_ALLOC_PTR(mcd); - if (mcd != NULL) { - memcpy(mcd->mcd_uuid, cluuid, sizeof mcd->mcd_uuid); - med->med_mcd = mcd; - rc = mdt_client_add(ctx, mdt, med, -1); - if (rc != 0) - OBD_FREE_PTR(mcd); - } else - rc = -ENOMEM; - - return rc; + return 0; } /* mds_connect copy */ @@ -2934,6 +2917,8 @@ static int mdt_obd_connect(const struct lu_context *ctx, struct obd_uuid *cluuid, struct obd_connect_data *data) { + struct mdt_export_data *med; + struct mdt_client_data *mcd; struct obd_export *exp; struct mdt_device *mdt; int rc; @@ -2951,8 +2936,21 @@ static int mdt_obd_connect(const struct lu_context *ctx, exp = class_conn2export(conn); LASSERT(exp != NULL); + med = &exp->exp_mdt_data; + + rc = mdt_connect_internal(exp, mdt, data); + if (rc == 0) { + OBD_ALLOC_PTR(mcd); + if (mcd != NULL) { + memcpy(mcd->mcd_uuid, cluuid, sizeof mcd->mcd_uuid); + med->med_mcd = mcd; + rc = mdt_client_add(ctx, mdt, med, -1); + if (rc != 0) + OBD_FREE_PTR(mcd); + } else + rc = -ENOMEM; + } - rc = mdt_connect_internal(ctx, mdt, exp, cluuid, data); if (rc != 0) class_disconnect(exp); else @@ -2961,6 +2959,21 @@ static int mdt_obd_connect(const struct lu_context *ctx, RETURN(rc); } +static int mdt_obd_reconnect(struct obd_export *exp, struct obd_device *obd, + struct obd_uuid *cluuid, + struct obd_connect_data *data) +{ + int rc; + ENTRY; + + if (exp == NULL || obd == NULL || cluuid == NULL) + RETURN(-EINVAL); + + rc = mdt_connect_internal(exp, mdt_dev(obd->obd_lu_dev), data); + + RETURN(rc); +} + static int mdt_obd_disconnect(struct obd_export *exp) { int rc; @@ -3020,6 +3033,7 @@ static int mdt_destroy_export(struct obd_export *export) if (obd_uuid_equals(&export->exp_client_uuid, &obd->obd_uuid)) RETURN(0); + LASSERT(mdt != NULL); rc = lu_context_init(&ctxt, LCT_MD_THREAD); if (rc) @@ -3110,6 +3124,7 @@ static int mdt_iocontrol(unsigned int cmd, struct obd_export *exp, int len, static struct obd_ops mdt_obd_device_ops = { .o_owner = THIS_MODULE, .o_connect = mdt_obd_connect, + .o_reconnect = mdt_obd_reconnect, .o_disconnect = mdt_obd_disconnect, .o_init_export = mdt_init_export, .o_destroy_export = mdt_destroy_export, diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 13b5b25..67426d8 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -638,7 +638,7 @@ int mdt_open(struct mdt_thread_info *info) if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) { /* this is a replay request. */ - result = mdt_open_by_fid(info,rr->rr_fid1, ldlm_rep, + result = mdt_open_by_fid(info, rr->rr_fid2, ldlm_rep, create_flags); if (result != -ENOENT)