From: rread Date: Wed, 15 Oct 2003 23:55:25 +0000 (+0000) Subject: b=2111 X-Git-Tag: v1_7_0_51~2^9~237 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9e671bc44f14c17745bb48cf345cf2d485487415;p=fs%2Flustre-release.git b=2111 r=peter - most of this is Peter patch from 2111, including making sure obd_log_exp is set once. - my integration with 0conf - add an obd method "obd_pre_cleanup" so the log export can be disconnected, and allow the device to be fully cleaned up. --- diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 01a03a2..043fd97 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -271,6 +271,12 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) } } + if (OBT(obd) && OBP(obd, pre_cleanup)) { + err = obd_pre_cleanup(obd, flags); + if (err) + RETURN(err); + } + if (atomic_read(&obd->obd_refcount) == 1 || flags & OBD_OPT_FORCE) { /* this will stop new connections, and need to @@ -542,8 +548,12 @@ int class_config_parse_llog(struct obd_export *exp, char *name, struct llog_handle *llh; struct obd_device *obd = exp->exp_obd; int rc, rc2; + ENTRY; - obd->obd_log_exp = class_export_get(exp); + if (obd->obd_log_exp == NULL) { + CERROR("No log export on obd:%s\n", obd->obd_name); + RETURN(-ENOTCONN); + } rc = llog_create(obd, &llh, NULL, name); if (rc) { @@ -562,8 +572,6 @@ parse_out: if (rc == 0) rc = rc2; - class_export_put(obd->obd_log_exp); - obd->obd_log_exp = NULL; RETURN(rc); } diff --git a/lustre/ptlrpc/llogd.c b/lustre/ptlrpc/llogd.c index 58e3109..9c74326 100644 --- a/lustre/ptlrpc/llogd.c +++ b/lustre/ptlrpc/llogd.c @@ -48,7 +48,7 @@ int llogd_create(struct ptlrpc_request *req) int rc, rc2; ENTRY; - LASSERT(obd->obd_log_exp == NULL); + LASSERT(obd->obd_log_exp != NULL); body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); @@ -69,7 +69,6 @@ int llogd_create(struct ptlrpc_request *req) } push_ctxt(&saved, &obd->obd_ctxt, NULL); - obd->obd_log_exp = class_export_get(exp); rc = llog_create(obd, &loghandle, logid, name); if (rc) @@ -84,11 +83,9 @@ int llogd_create(struct ptlrpc_request *req) out_close: rc2 = llog_close(loghandle); - class_export_put(obd->obd_log_exp); if (!rc) rc = rc2; out_pop: - obd->obd_log_exp = NULL; pop_ctxt(&saved, &obd->obd_ctxt, NULL); out: RETURN(rc); @@ -108,7 +105,7 @@ int llogd_next_block(struct ptlrpc_request *req) int rc, rc2; ENTRY; - LASSERT(obd->obd_log_exp == NULL); + LASSERT(obd->obd_log_exp != NULL); body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); @@ -122,7 +119,6 @@ int llogd_next_block(struct ptlrpc_request *req) GOTO(out, rc = -ENOMEM); push_ctxt(&saved, &obd->obd_ctxt, NULL); - obd->obd_log_exp = class_export_get(exp); rc = llog_create(obd, &loghandle, &body->lgd_logid, NULL); if (rc) @@ -152,8 +148,6 @@ int llogd_next_block(struct ptlrpc_request *req) out_close: rc2 = llog_close(loghandle); - class_export_put(obd->obd_log_exp); - obd->obd_log_exp = NULL; if (!rc) rc = rc2; @@ -177,7 +171,7 @@ int llogd_read_header(struct ptlrpc_request *req) int rc, rc2; ENTRY; - LASSERT(obd->obd_log_exp == NULL); + LASSERT(obd->obd_log_exp != NULL); body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); @@ -191,7 +185,6 @@ int llogd_read_header(struct ptlrpc_request *req) GOTO(out, rc = -ENOMEM); push_ctxt(&saved, &obd->obd_ctxt, NULL); - obd->obd_log_exp = class_export_get(exp); rc = llog_create(obd, &loghandle, &body->lgd_logid, NULL); if (rc) @@ -212,8 +205,6 @@ int llogd_read_header(struct ptlrpc_request *req) out_close: rc2 = llog_close(loghandle); - class_export_put(obd->obd_log_exp); - obd->obd_log_exp = NULL; if (!rc) rc = rc2;