From 9eb349dc8eda85435758e2f6b4d6795ab14df863 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 20 Feb 2006 21:47:39 +0000 Subject: [PATCH] Branch b1_4_mountconf b=9863 - record timestamp in config log markers for future 9863 use b=8192 - don't match existing locks in mgc_enqueue b=9846 - fix client lov name for lctl conf_param --- lustre/include/linux/lustre_idl.h | 3 ++- lustre/include/linux/obd.h | 4 ++-- lustre/mgc/mgc_request.c | 30 +++++++++++------------------- lustre/mgs/mgs_handler.c | 14 +++----------- lustre/mgs/mgs_llog.c | 16 +++++++++++++--- lustre/obdclass/obd_mount.c | 2 +- lustre/utils/llog_reader.c | 8 ++++++-- 7 files changed, 38 insertions(+), 39 deletions(-) diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index b64635f..12ec935 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -1018,7 +1018,8 @@ extern void lustre_swab_mgs_target_info(struct mgs_target_info *oinfo); struct cfg_marker { __u32 cm_step; /* aka config version */ __u32 cm_flags; - __u32 cm_timestamp; + time_t cm_createtime; /*when this record was first created */ + time_t cm_canceltime; /*when this record is no longer valid*/ char cm_svname[16]; char cm_comment[40]; }; diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index a022671..6fe23c8 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -387,9 +387,9 @@ struct mgs_obd { struct super_block *mgs_sb; struct dentry *mgs_configs_dir; struct dentry *mgs_fid_de; - spinlock_t mgs_fs_db_lock; + spinlock_t mgs_fs_db_lock; /* add/remove db's */ struct list_head mgs_fs_db_list; - struct semaphore mgs_log_sem; + struct semaphore mgs_log_sem; /* unused */ }; struct mds_obd { diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 8f00bd0..463eaca 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -374,12 +374,16 @@ static int mgc_async_requeue(void *data) /* FIXME sleep a few seconds here to allow the server who caused the lock revocation to finish its setup */ - /* re-send server info every time, in case MGS needs to regen its - logs */ +#if 0 + /* Re-send server info every time, in case MGS needs to regen its + logs (for write_conf). Do we need this? It's extra RPCs for + every server at every update. */ server_register_target(cld->cld_cfg.cfg_sb); +#endif + rc = mgc_process_log(the_mgc, cld); + class_export_put(the_mgc->obd_self_export); - RETURN(rc); } @@ -417,13 +421,12 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, CERROR("original grant failed, won't requeue\n"); break; } - if (!data) { CERROR("missing data, won't requeue\n"); break; } - /* Reenque the lock in a separate thread, because we must + /* Re-enqueue the lock in a separate thread, because we must return from this fn before that lock can be taken. */ rc = kernel_thread(mgc_async_requeue, data, CLONE_VM | CLONE_FS); @@ -445,7 +448,7 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, RETURN(rc); } -/* based on ll_get_dir_page and osc_enqueue. */ +/* Take a config lock so we can get cancel notifications */ static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm, __u32 type, ldlm_policy_data_t *policy, __u32 mode, int *flags, void *bl_cb, void *cp_cb, void *gl_cb, @@ -460,24 +463,13 @@ static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm, CDEBUG(D_MGC, "Enqueue for %s (res "LPX64")\n", cld->cld_logname, cld->cld_resid.name[0]); - /* Search for already existing locks.*/ - rc = ldlm_lock_match(obd->obd_namespace, 0, &cld->cld_resid, type, - NULL, mode, lockh); - if (rc == 1) - RETURN(ELDLM_OK); - + /* We need a callback for every lockholder, so don't try to + ldlm_lock_match (see rev 1.1.2.11.2.47) */ rc = ldlm_cli_enqueue(exp, NULL, obd->obd_namespace, cld->cld_resid, type, NULL, mode, flags, mgc_blocking_ast, ldlm_completion_ast, NULL, data, NULL, 0, NULL, lockh); - if (rc == 0) { - /* Allow matches for other clients mounted on this host */ - struct ldlm_lock *lock = ldlm_handle2lock(lockh); - LASSERT(lock); - ldlm_lock_allow_match(lock); - LDLM_LOCK_PUT(lock); - } RETURN(rc); } diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 057dfad..7bccab85 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -288,10 +288,9 @@ static int mgs_get_cfg_lock(struct obd_device *obd, char *fsname, static int mgs_put_cfg_lock(struct lustre_handle *lockh) { - CERROR("mgs_unlock\n"); - + ENTRY; ldlm_lock_decref(lockh, LCK_EX); - return 0; + RETURN(0); } /* rc=0 means ok */ @@ -362,10 +361,7 @@ static int mgs_handle_target_reg(struct ptlrpc_request *req) obd->obd_name, lockrc); } - /* There can be only 1 server adding at a time - don't want log - writing contention. */ - /* Actually this should be okay because of the per-fs fsdb sem */ - //down(&obd->u.mgs.mgs_log_sem); + /* Log writing contention is handled by the fsdb_sem */ if (mti->mti_flags & LDD_F_WRITECONF) { rc = mgs_erase_logs(obd, mti->mti_fsname); @@ -410,7 +406,6 @@ static int mgs_handle_target_reg(struct ptlrpc_request *req) } out: - //up(&obd->u.mgs.mgs_log_sem); /* done with log update */ if (lockrc == ELDLM_OK) mgs_put_cfg_lock(&lockh); @@ -604,10 +599,7 @@ int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len, CDEBUG(D_MGS, "set param on fs %s device %s\n", fsname, devname); - //down(&obd->u.mgs.mgs_log_sem); rc = mgs_setparam(obd, fsname, lcfg); - //up(&obd->u.mgs.mgs_log_sem); - if (rc) { CERROR("setparam err %d\n", rc); GOTO(out_free, rc); diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index a777c65..78d3bc1 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -543,18 +543,20 @@ static int record_marker(struct obd_device *obd, struct llog_handle *llh, char *svname, char *comment) { struct cfg_marker marker; + struct timeval tv; struct lustre_cfg_bufs bufs; struct lustre_cfg *lcfg; int rc; - CDEBUG(D_MGS, "marker %#x %s\n", flags, comment); - if (flags & CM_START) fsdb->fsdb_gen++; marker.cm_step = fsdb->fsdb_gen; marker.cm_flags = flags; strncpy(marker.cm_svname, svname, sizeof(marker.cm_svname)); strncpy(marker.cm_comment, comment, sizeof(marker.cm_comment)); + do_gettimeofday(&tv); + marker.cm_createtime = tv.tv_sec; + marker.cm_canceltime = 0; lustre_cfg_bufs_reset(&bufs, NULL); lustre_cfg_bufs_set(&bufs, 1, &marker, sizeof(marker)); lcfg = lustre_cfg_new(LCFG_MARKER, &bufs); @@ -1340,7 +1342,15 @@ int mgs_setparam(struct obd_device *obd, char *fsname, struct lustre_cfg *lcfg) name_destroy(logname); name_create(fsname, "-client", &logname); name_create(fsname, "-clilov", &lovname); - rc = mgs_write_log_direct(obd, fsdb, logname, lovname, lcfg); + /* Now, we still have to fix the devname (from the mdtlov + to the clilov) within the lcfg. We could copy the whole + lcfg... */ + devname = lustre_cfg_string(lcfg, 0); + if (strlen(devname) == strlen(lovname)) { + strcpy(devname, lovname); /* ...or just hack it! */ + rc = mgs_write_log_direct(obd, fsdb, logname, + lovname, lcfg); + } name_destroy(lovname); up(&fsdb->fsdb_sem); } diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 5f2a7f8..2fa8d31 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -1425,7 +1425,7 @@ int lustre_common_put_super(struct super_block *sb) } /* BUSY just means that there's some other obd that needs the mgc. Let him clean it up. */ - CDEBUG(D_MOUNT, "MGC busy, will stop later\n"); + CDEBUG(D_MOUNT, "MGC still in use\n"); } lustre_put_lsi(sb); RETURN(rc); diff --git a/lustre/utils/llog_reader.c b/lustre/utils/llog_reader.c index a6c60ba..6e29ae8 100644 --- a/lustre/utils/llog_reader.c +++ b/lustre/utils/llog_reader.c @@ -329,14 +329,18 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) } case(LCFG_MARKER):{ struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1); + if (marker->cm_flags & CM_SKIP) { if (marker->cm_flags & CM_START) (*skip)++; if (marker->cm_flags & CM_END) (*skip)--; } - printf("marker %d (flags=%#x) %.16s '%s'", marker->cm_step, - marker->cm_flags, marker->cm_svname, marker->cm_comment); + printf("marker %d (flags=%#x) %.16s '%s' %s:%s", marker->cm_step, + marker->cm_flags, marker->cm_svname, + marker->cm_comment, ctime(&marker->cm_createtime), + marker->cm_canceltime ? + ctime(&marker->cm_canceltime) : ""); break; } default: -- 1.8.3.1