From 70b4fe5ea82f466d9020fc1e759541a68253d5ed Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 23 Mar 2007 15:23:57 +0000 Subject: [PATCH] b=12005 i=green initialize per-export proc in non-recovery case. report an error when attempting to change failout mode without writeconf --- lustre/include/lustre_disk.h | 2 +- lustre/mgs/mgs_llog.c | 15 +++++++++++---- lustre/obdfilter/filter.c | 20 ++++++++++++-------- lustre/tests/cfg/local.sh | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index b92739e..26ff49d 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -50,7 +50,7 @@ #define LDD_F_REWRITE_LDD 0x0080 /* rewrite the LDD */ #define LDD_F_WRITECONF 0x0100 /* regenerate all logs for this fs */ #define LDD_F_UPGRADE14 0x0200 /* COMPAT_14 */ -#define LDD_F_PARAM_FNID 0x0400 /* process failover nids as params */ +#define LDD_F_PARAM 0x0400 /* process as lctl conf_param */ enum ldd_mount_type { LDD_MT_EXT3 = 0, diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index d6e0de6..0cb5b69 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -1413,15 +1413,22 @@ static int mgs_write_log_params(struct obd_device *obd, struct fs_db *fsdb, goto end_while; /* Processed in mgs_write_log_ost */ - if (class_match_param(ptr, PARAM_FAILMODE, NULL) == 0) + if (class_match_param(ptr, PARAM_FAILMODE, NULL) == 0) { + if (mti->mti_flags & LDD_F_PARAM) { + LCONSOLE_ERROR("%s can only be changed with " + "tunefs.lustre and --writeconf\n", + ptr); + rc = -EPERM; + } goto end_while; + } if (class_match_param(ptr, PARAM_FAILNODE, NULL) == 0) { /* Add a failover nidlist */ rc = 0; /* We already processed failovers params for new targets in mgs_write_log_target */ - if (mti->mti_flags & LDD_F_PARAM_FNID) { + if (mti->mti_flags & LDD_F_PARAM) { CDEBUG(D_MGS, "Adding failnode\n"); rc = mgs_write_log_add_failnid(obd, fsdb, mti); } @@ -1713,7 +1720,7 @@ int mgs_write_log_target(struct obd_device *obd, } else { /* Just update the params from tunefs in mgs_write_log_params */ CDEBUG(D_MGS, "Update params for %s\n", mti->mti_svname); - mti->mti_flags |= LDD_F_PARAM_FNID; + mti->mti_flags |= LDD_F_PARAM; } rc = mgs_write_log_params(obd, fsdb, mti); @@ -1948,7 +1955,7 @@ int mgs_setparam(struct obd_device *obd, struct lustre_cfg *lcfg, char *fsname) mti->mti_svname)) GOTO(out, rc = -EINVAL); - mti->mti_flags = rc | LDD_F_PARAM_FNID; + mti->mti_flags = rc | LDD_F_PARAM; down(&fsdb->fsdb_sem); rc = mgs_write_log_params(obd, fsdb, mti); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index ab43a7e..9a0ad0f 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -161,6 +161,10 @@ static int filter_export_stats_init(struct obd_device *obd, ENTRY; init_brw_stats(&fed->fed_brw_stats); + + if (obd_uuid_equals(&exp->exp_client_uuid, &obd->obd_uuid)) + /* Self-export gets no proc entry */ + RETURN(0); rc = lprocfs_exp_setup(exp); if (rc) @@ -206,10 +210,8 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp, LASSERTF(cl_idx > -2, "%d\n", cl_idx); /* Self-export */ - if (strcmp(fed->fed_fcd->fcd_uuid, obd->obd_uuid.uuid) == 0) { - init_brw_stats(&fed->fed_brw_stats); + if (strcmp(fed->fed_fcd->fcd_uuid, obd->obd_uuid.uuid) == 0) RETURN(0); - } /* the bitmap operations can handle cl_idx > sizeof(long) * 8, so * there's no need for extra complication here @@ -239,7 +241,6 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp, fed->fed_lr_off = le32_to_cpu(filter->fo_fsd->lsd_client_start) + cl_idx * le16_to_cpu(filter->fo_fsd->lsd_client_size); LASSERTF(fed->fed_lr_off > 0, "fed_lr_off = %llu\n", fed->fed_lr_off); - filter_export_stats_init(obd, exp); CDEBUG(D_INFO, "client at index %d (%llu) with UUID '%s' added\n", fed->fed_lr_idx, fed->fed_lr_off, fed->fed_fcd->fcd_uuid); @@ -306,8 +307,6 @@ static int filter_client_free(struct obd_export *exp) CDEBUG(D_INFO, "freeing client at idx %u, offset %lld with UUID '%s'\n", fed->fed_lr_idx, off, fed->fed_fcd->fcd_uuid); - lprocfs_exp_cleanup(exp); - LASSERT(filter->fo_last_rcvd_slots != NULL); off = fed->fed_lr_off; @@ -753,6 +752,7 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) } else { fed = &exp->exp_filter_data; fed->fed_fcd = fcd; + filter_export_stats_init(obd, exp); rc = filter_client_add(obd, exp, cl_idx); LASSERTF(rc == 0, "rc = %d\n", rc); /* can't fail existing */ @@ -2016,6 +2016,8 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, if (rc) GOTO(cleanup, rc); + filter_export_stats_init(obd, exp); + if (!obd->obd_replayable) GOTO(cleanup, rc = 0); @@ -2167,6 +2169,8 @@ static int filter_destroy_export(struct obd_export *exp) if (obd_uuid_equals(&exp->exp_client_uuid, &exp->exp_obd->obd_uuid)) RETURN(0); + lprocfs_exp_cleanup(exp); + if (exp->exp_obd->obd_replayable) filter_client_free(exp); else @@ -2807,12 +2811,12 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa, dparent = filter_parent_lock(obd, group, next_id); if (IS_ERR(dparent)) GOTO(cleanup, rc = PTR_ERR(dparent)); - cleanup_phase = 1; /* filter_parent_unlock(dparent) */ + cleanup_phase = 1; /* filter_parent_unlock(dparent) */ dchild = filter_fid2dentry(obd, dparent, group, next_id); if (IS_ERR(dchild)) GOTO(cleanup, rc = PTR_ERR(dchild)); - cleanup_phase = 2; /* f_dput(dchild) */ + cleanup_phase = 2; /* f_dput(dchild) */ if (dchild->d_inode != NULL) { /* This would only happen if lastobjid was bad on disk*/ diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index 2d24613..deeb91f 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -16,7 +16,7 @@ MDSOPT=${MDSOPT:-"--mountfsoptions=acl"} OSTCOUNT=${OSTCOUNT:-2} OSTDEVBASE=${OSTDEVBASE:-$TMP/${FSNAME}-ost} OSTSIZE=${OSTSIZE:-300000} -OSTOPT="" +OSTOPT=${OSTOPT:-""} # Can specify individual ost devs with # OSTDEV1="/dev/sda" # on specific hosts with -- 1.8.3.1