From 6fe18330660980fc4ec4fd4e960f5415e571a54e Mon Sep 17 00:00:00 2001 From: vitaly Date: Tue, 16 Jun 2009 12:31:38 +0000 Subject: [PATCH] Branch HEAD b=19154 i=adilger i=tappro propagate mount count down the mdt stack so it could be properly used in llog to send it on the connection to ost. --- lustre/cmm/cmm_device.c | 4 ++-- lustre/cmm/cmm_internal.h | 2 +- lustre/cmm/cmm_split.c | 2 +- lustre/cmm/mdc_device.c | 2 +- lustre/include/lclient.h | 2 +- lustre/include/lustre_log.h | 2 +- lustre/include/md_object.h | 7 ++++--- lustre/include/obd.h | 2 +- lustre/include/obd_class.h | 3 ++- lustre/lclient/lcommon_misc.c | 2 +- lustre/mdd/mdd_lov.c | 11 +++++++---- lustre/mds/mds_lov.c | 5 +++-- lustre/mdt/mdt_handler.c | 4 +++- lustre/mdt/mdt_recovery.c | 2 +- lustre/obdclass/llog_obd.c | 1 - lustre/ptlrpc/llog_net.c | 6 +++++- lustre/tests/replay-single.sh | 10 ---------- 17 files changed, 34 insertions(+), 33 deletions(-) diff --git a/lustre/cmm/cmm_device.c b/lustre/cmm/cmm_device.c index 73636ea..deda49e 100644 --- a/lustre/cmm/cmm_device.c +++ b/lustre/cmm/cmm_device.c @@ -662,7 +662,7 @@ static const struct lu_device_operations cmm_lu_ops = { /* --- lu_device_type operations --- */ int cmm_upcall(const struct lu_env *env, struct md_device *md, - enum md_upcall_event ev) + enum md_upcall_event ev, void *data) { int rc; ENTRY; @@ -674,7 +674,7 @@ int cmm_upcall(const struct lu_env *env, struct md_device *md, CERROR("can not init md size %d\n", rc); /* fall through */ default: - rc = md_do_upcall(env, md, ev); + rc = md_do_upcall(env, md, ev, data); } RETURN(rc); } diff --git a/lustre/cmm/cmm_internal.h b/lustre/cmm/cmm_internal.h index 4dc359f..36e9b16 100644 --- a/lustre/cmm/cmm_internal.h +++ b/lustre/cmm/cmm_internal.h @@ -196,7 +196,7 @@ static inline struct cml_object *cmm2cml_obj(struct cmm_object *co) } int cmm_upcall(const struct lu_env *env, struct md_device *md, - enum md_upcall_event ev); + enum md_upcall_event ev, void *data); #ifdef HAVE_SPLIT_SUPPORT diff --git a/lustre/cmm/cmm_split.c b/lustre/cmm/cmm_split.c index 8cb4cd9..4487876 100644 --- a/lustre/cmm/cmm_split.c +++ b/lustre/cmm/cmm_split.c @@ -674,7 +674,7 @@ int cmm_split_dir(const struct lu_env *env, struct md_object *mo) * Disable transacrions for split, since there will be so many trans in * this one ops, conflict with current recovery design. */ - rc = cmm_upcall(env, &cmm->cmm_md_dev, MD_NO_TRANS); + rc = cmm_upcall(env, &cmm->cmm_md_dev, MD_NO_TRANS, NULL); if (rc) { CERROR("Can't disable trans for split, rc %d\n", rc); GOTO(out, rc); diff --git a/lustre/cmm/mdc_device.c b/lustre/cmm/mdc_device.c index d3a7c3b..51386de 100644 --- a/lustre/cmm/mdc_device.c +++ b/lustre/cmm/mdc_device.c @@ -64,7 +64,7 @@ static const struct md_device_operations mdc_md_ops = { 0 }; static int mdc_obd_update(struct obd_device *host, struct obd_device *watched, - enum obd_notify_event ev, void *owner) + enum obd_notify_event ev, void *owner, void *data) { struct mdc_device *mc = owner; int rc = 0; diff --git a/lustre/include/lclient.h b/lustre/include/lclient.h index 8b86063..8c2ec3c 100644 --- a/lustre/include/lclient.h +++ b/lustre/include/lclient.h @@ -390,7 +390,7 @@ __u16 ll_dirent_type_get(struct lu_dirent *ent); int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp); int cl_ocd_update(struct obd_device *host, struct obd_device *watched, - enum obd_notify_event ev, void *owner); + enum obd_notify_event ev, void *owner, void *data); struct ccc_grouplock { struct lu_env *cg_env; diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h index ad6e6ca..e5f5cad 100644 --- a/lustre/include/lustre_log.h +++ b/lustre/include/lustre_log.h @@ -382,6 +382,7 @@ static inline void llog_gen_init(struct llog_ctxt *ctxt) ctxt->loc_gen.mnt_cnt = obd->u.filter.fo_mount_count; else ctxt->loc_gen.mnt_cnt = 0; + ctxt->loc_gen.conn_cnt++; } static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b) @@ -393,7 +394,6 @@ static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b) return(a.conn_cnt < b.conn_cnt ? 1 : 0); } -#define LLOG_GEN_INC(gen) ((gen).conn_cnt ++) #define LLOG_PROC_BREAK 0x0001 #define LLOG_DEL_RECORD 0x0002 diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index f69fac5..6f818b5 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -428,7 +428,7 @@ struct md_upcall { struct md_device *mu_upcall_dev; /** upcall function */ int (*mu_upcall)(const struct lu_env *env, struct md_device *md, - enum md_upcall_event ev); + enum md_upcall_event ev, void *data); }; struct md_device { @@ -460,14 +460,15 @@ static inline void md_upcall_fini(struct md_device *m) } static inline int md_do_upcall(const struct lu_env *env, struct md_device *m, - enum md_upcall_event ev) + enum md_upcall_event ev, void *data) { int rc = 0; down_read(&m->md_upcall.mu_upcall_sem); if (m->md_upcall.mu_upcall_dev != NULL && m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall != NULL) { rc = m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall(env, - m->md_upcall.mu_upcall_dev, ev); + m->md_upcall.mu_upcall_dev, + ev, data); } up_read(&m->md_upcall.mu_upcall_sem); return rc; diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 36d8c01..e596a23 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -945,7 +945,7 @@ enum config_flags { */ struct obd_notify_upcall { int (*onu_upcall)(struct obd_device *host, struct obd_device *watched, - enum obd_notify_event ev, void *owner); + enum obd_notify_event ev, void *owner, void *data); /* Opaque datum supplied by upper layer listener */ void *onu_owner; }; diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 96b9a7d..07f783d 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1495,7 +1495,8 @@ static inline int obd_notify_observer(struct obd_device *observer, */ onu = &observer->obd_upcall; if (onu->onu_upcall != NULL) - rc2 = onu->onu_upcall(observer, observed, ev, onu->onu_owner); + rc2 = onu->onu_upcall(observer, observed, ev, + onu->onu_owner, NULL); else rc2 = 0; diff --git a/lustre/lclient/lcommon_misc.c b/lustre/lclient/lcommon_misc.c index 62a1ca5..ce9b14d 100644 --- a/lustre/lclient/lcommon_misc.c +++ b/lustre/lclient/lcommon_misc.c @@ -88,7 +88,7 @@ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp) */ int cl_ocd_update(struct obd_device *host, struct obd_device *watched, - enum obd_notify_event ev, void *owner) + enum obd_notify_event ev, void *owner, void *data) { struct lustre_client_ocd *lco; struct client_obd *cli; diff --git a/lustre/mdd/mdd_lov.c b/lustre/mdd/mdd_lov.c index 4dd8dbf..eddfebc 100644 --- a/lustre/mdd/mdd_lov.c +++ b/lustre/mdd/mdd_lov.c @@ -60,7 +60,7 @@ #include "mdd_internal.h" static int mdd_notify(struct obd_device *host, struct obd_device *watched, - enum obd_notify_event ev, void *owner) + enum obd_notify_event ev, void *owner, void *data) { struct mdd_device *mdd = owner; int rc = 0; @@ -72,14 +72,17 @@ static int mdd_notify(struct obd_device *host, struct obd_device *watched, case OBD_NOTIFY_ACTIVE: case OBD_NOTIFY_SYNC: case OBD_NOTIFY_SYNC_NONBLOCK: - rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_SYNC); + rc = md_do_upcall(NULL, &mdd->mdd_md_dev, + MD_LOV_SYNC, data); break; case OBD_NOTIFY_CONFIG: - rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_CONFIG); + rc = md_do_upcall(NULL, &mdd->mdd_md_dev, + MD_LOV_CONFIG, data); break; #ifdef HAVE_QUOTA_SUPPORT case OBD_NOTIFY_QUOTA: - rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_QUOTA); + rc = md_do_upcall(NULL, &mdd->mdd_md_dev, + MD_LOV_QUOTA, data); break; #endif default: diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index c7a0f80..dd903df 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -545,7 +545,8 @@ static int mds_lov_update_desc(struct obd_device *obd, int idx, if (obd->obd_upcall.onu_owner) { LASSERT(obd->obd_upcall.onu_upcall != NULL); rc = obd->obd_upcall.onu_upcall(obd, NULL, ev, - obd->obd_upcall.onu_owner); + obd->obd_upcall.onu_owner, + &mds->mds_mount_count); } out: OBD_FREE(ld, sizeof(*ld)); @@ -824,7 +825,7 @@ static int __mds_lov_synchronize(void *data) */ LASSERT(obd->obd_upcall.onu_upcall != NULL); rc = obd->obd_upcall.onu_upcall(obd, NULL, OBD_NOTIFY_QUOTA, - obd->obd_upcall.onu_owner); + obd->obd_upcall.onu_owner,NULL); } #endif EXIT; diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index d596372..39ffd89 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5315,7 +5315,7 @@ static void mdt_allow_cli(struct mdt_device *m, unsigned int flag) } static int mdt_upcall(const struct lu_env *env, struct md_device *md, - enum md_upcall_event ev) + enum md_upcall_event ev, void *data) { struct mdt_device *m = mdt_dev(&md->md_lu_dev); struct md_device *next = m->mdt_child; @@ -5331,6 +5331,8 @@ static int mdt_upcall(const struct lu_env *env, struct md_device *md, CDEBUG(D_INFO, "get max mdsize %d max cookiesize %d\n", m->mdt_max_mdsize, m->mdt_max_cookiesize); mdt_allow_cli(m, CONFIG_SYNC); + if (data) + (*(__u64 *)data) = m->mdt_mount_count; break; case MD_NO_TRANS: mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 8b8ae00..0d794a1 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -482,7 +482,7 @@ static int mdt_server_data_init(const struct lu_env *env, obd->obd_last_committed = mdt->mdt_last_transno; spin_unlock(&mdt->mdt_transno_lock); - mdt->mdt_mount_count++; + mdt->mdt_mount_count = mount_count + 1; lsd->lsd_mount_count = mdt->mdt_mount_count; /* save it, so mount count and last_transno is current */ diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c index 41fb346..4453be1 100644 --- a/lustre/obdclass/llog_obd.c +++ b/lustre/obdclass/llog_obd.c @@ -353,7 +353,6 @@ int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg, ctxt = llog_group_get_ctxt(olg, index); if (!ctxt) RETURN(-ENODEV); - llog_gen_init(ctxt); if (logid && logid->lgl_oid) { rc = llog_create(ctxt, &handle, logid, NULL); diff --git a/lustre/ptlrpc/llog_net.c b/lustre/ptlrpc/llog_net.c index a195f96..00bdd58 100644 --- a/lustre/ptlrpc/llog_net.c +++ b/lustre/ptlrpc/llog_net.c @@ -82,7 +82,7 @@ int llog_origin_connect(struct llog_ctxt *ctxt, } /* FIXME what value for gen->conn_cnt */ - LLOG_GEN_INC(ctxt->loc_gen); + llog_gen_init(ctxt); /* first add llog_gen_rec */ OBD_ALLOC_PTR(lgr); @@ -116,6 +116,10 @@ int llog_origin_connect(struct llog_ctxt *ctxt, if (req == NULL) RETURN(-ENOMEM); + CDEBUG(D_OTHER, "%s mount_count %llu, connection count %llu\n", + ctxt->loc_exp->exp_obd->obd_type->typ_name, + ctxt->loc_gen.mnt_cnt, ctxt->loc_gen.conn_cnt); + req_body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_CONN_BODY); req_body->lgdc_gen = ctxt->loc_gen; req_body->lgdc_logid = ctxt->loc_handle->lgh_id; diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index efc2f0a..74fe997 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -460,12 +460,6 @@ test_20a() { # was test_20 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)" test_20b() { # bug 10480 - # XXX increase the debug level temporary - DEBUG_SAVED=$PTLDEBUG - DEBUG_MB_SAVED=$DEBUG_SIZE - PTLDEBUG=0x33f1404 - DEBUG_SIZE=150 - do_nodes $(comma_list $(nodes_list)) "$LCTL set_param debug=$PTLDEBUG; $LCTL set_param debug_mb=$DEBUG_SIZE" BEFOREUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'` dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 & @@ -490,10 +484,6 @@ test_20b() { # bug 10480 log "before $BEFOREUSED, after $AFTERUSED" [ $AFTERUSED -gt $((BEFOREUSED + 20)) ] && \ error "after $AFTERUSED > before $BEFOREUSED" - # XXX decrease it back - PTLDEBUG=$DEBUG_SAVED - DEBUG_SIZE=$DEBUG_MB_SAVED - do_nodes $(comma_list $(nodes_list)) "$LCTL set_param debug=$PTLDEBUG; $LCTL set_param debug_mb=$DEBUG_SIZE" return 0 } run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)" -- 1.8.3.1