From 01700f25f1b90cd581e86070934b9b2fdb1cbb32 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 10 May 2006 18:00:05 +0000 Subject: [PATCH] Branch b1_5 b=10516 Rather than cleanup and re-setup llogs for each OST addition, instead just call setup only. This makes sure that there is no window between the two where someone calling llog_get_ctxt will fail. Change llog_setup to a NOP if it's already set up. --- lustre/include/obd.h | 1 - lustre/lov/lov_log.c | 2 +- lustre/mds/handler.c | 1 - lustre/mds/mds_lov.c | 6 ++---- lustre/obdclass/llog_obd.c | 15 ++++++++------- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 16ea176..cc5b5bd 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -433,7 +433,6 @@ struct mds_obd { struct file *mds_lov_objid_filp; struct file *mds_health_check_filp; unsigned long *mds_client_bitmap; - struct semaphore mds_orphan_recovery_sem; struct upcall_cache *mds_group_hash; struct lustre_quota_info mds_quota_info; diff --git a/lustre/lov/lov_log.c b/lustre/lov/lov_log.c index 34fd545..0b23662 100644 --- a/lustre/lov/lov_log.c +++ b/lustre/lov/lov_log.c @@ -193,7 +193,7 @@ int lov_llog_init(struct obd_device *obd, struct obd_device *tgt, RETURN(rc); CDEBUG(D_CONFIG, "llog init with %d targets\n", count); - LASSERT(lov->desc.ld_tgt_count == count); + /* count may not match ld_tgt_count during dynamic ost add */ for (i = 0, ctgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, ctgt++) { struct obd_device *child; if (!ctgt->ltd_active) diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 252c1fc..5f2e87d 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -1876,7 +1876,6 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb))); - sema_init(&mds->mds_orphan_recovery_sem, 1); sema_init(&mds->mds_epoch_sem, 1); spin_lock_init(&mds->mds_transno_lock); mds->mds_max_mdsize = sizeof(struct lov_mds_md); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 0f95347..d02e9a9 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -295,11 +295,9 @@ static int mds_lov_update_mds(struct obd_device *obd, /* Only do this at first add (idx), or the first time after recovery */ if (idx != MDSLOV_NO_INDEX || 1/*FIXME*/) { CDEBUG(D_CONFIG, "reset llogs idx=%d\n", idx); - /* These two must be atomic */ - down(&mds->mds_orphan_recovery_sem); - obd_llog_finish(obd, old_count); + /* Note that this will cause multiple mds/lov/osc_llog_init's + with no llog_cleanup's, so fns should deal with that. */ llog_cat_initialize(obd, mds->mds_lov_desc.ld_tgt_count); - up(&mds->mds_orphan_recovery_sem); } RETURN(rc); diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c index 5f6e680..ee88e3a 100644 --- a/lustre/obdclass/llog_obd.c +++ b/lustre/obdclass/llog_obd.c @@ -72,16 +72,17 @@ int llog_setup(struct obd_device *obd, int index, struct obd_device *disk_obd, RETURN(-EFAULT); if (obd->obd_llog_ctxt[index]) { - /* During an mds_lov_add_ost, we try to tear down and resetup llogs. - But the mdt teardown does not flow down to the lov/osc's as the - setup does, because the lov/osc must clean up only when they are - done, not when the mdt is done. So instead, we just assume that - if the lov llogs are already set up then we must cleanup first. */ + /* mds_lov_update_mds might call here multiple times. So if the + llog is already set up then don't to do it again. */ CDEBUG(D_CONFIG, "obd %s ctxt %d already set up\n", obd->obd_name, index); - llog_cleanup(obd->obd_llog_ctxt[index]); + ctxt = obd->obd_llog_ctxt[index]; + LASSERT(ctxt->loc_obd == obd); + LASSERT(ctxt->loc_exp == disk_obd->obd_self_export); + LASSERT(ctxt->loc_logops == op); + RETURN(0); } - + OBD_ALLOC(ctxt, sizeof(*ctxt)); if (!ctxt) RETURN(-ENOMEM); -- 1.8.3.1