#define LCFG_HDR_SIZE(count) \
size_round(offsetof (struct lustre_cfg, lcfg_buflens[(count)]))
+/* If not LCFG_REQUIRED, we can ignore this cmd and go on. */
+#define LCFG_REQUIRED 0x0001000
+
enum lcfg_command_type {
LCFG_ATTACH = 0x00cf001,
LCFG_DETACH = 0x00cf002,
LCFG_DEL_CONN = 0x00cf00c,
LCFG_LOV_ADD_OBD = 0x00cf00d,
LCFG_LOV_DEL_OBD = 0x00cf00e,
- LCFG_PARAM = 0x00cf00f,
- LCFG_MARKER = 0x00cf010,
- LCFG_LOG_START = 0x00cf011,
- LCFG_LOG_END = 0x00cf012,
+ LCFG_PARAM = 0x00ce00f,
+ LCFG_MARKER = 0x00ce010,
+ LCFG_LOG_START = 0x00ce011,
+ LCFG_LOG_END = 0x00ce012,
};
struct lustre_cfg_bufs {
#define MOUNT_DATA_FILE MOUNT_CONFIGS_DIR"/mountdata"
#define MDT_LOGS_DIR "LOGS" /* COMPAT_146 */
-#define LDD_MAGIC 0xbabb0001
+#define LDD_MAGIC 0x1dd00001
#define LDD_F_SV_TYPE_MDT 0x0001
#define LDD_F_SV_TYPE_OST 0x0002
#define MTI_NIDS_MAX 10
#endif
+#define LDD_INCOMPAT_SUPP 0
+#define LDD_ROCOMPAT_SUPP 0
+
+/* FIXME does on-disk ldd have to be a fixed endianness? (like last_rcvd) */
struct lustre_disk_data {
__u32 ldd_magic;
- __u32 ldd_config_ver; /* not used? */
+ __u32 ldd_feature_compat; /* compatible feature flags */
+ __u32 ldd_feature_rocompat;/* read-only compatible feature flags */
+ __u32 ldd_feature_incompat;/* incompatible feature flags */
+
+ __u32 ldd_config_ver; /* config rewrite count - not used */
__u32 ldd_flags; /* LDD_SV_TYPE */
enum ldd_mount_type ldd_mount_type; /* target fs type LDD_MT_* */
char ldd_fsname[64]; /* filesystem this server is part of */
__u16 ldd_mgsnid_count;
__u16 ldd_failnid_count; /* server failover nid count */
lnet_nid_t ldd_mgsnid[MTI_NIDS_MAX]; /* mgmt nid list; lmd can
- override */
+ override */
lnet_nid_t ldd_failnid[MTI_NIDS_MAX]; /* server failover nids */
char ldd_mount_opts[2048]; /* target fs mount opts */
obd_str2uuid (&tgtuuid, str);
target = class_uuid2obd(&tgtuuid);
+ /* COMPAT_146 */
if (!target) {
target = class_name2obd(str);
}
+ /* old (pre 1.6) lustre_process_log tries to connect to mdsname
+ (eg. mdsA) instead of uuid. Since 1.6 changes names, the above
+ hack fails. */
+ if (!target) {
+ snprintf((char *)tgtuuid.uuid, sizeof(tgtuuid), "%s_UUID", str);
+ target = class_uuid2obd(&tgtuuid);
+ }
+ /* end COMPAT_146 */
if (!target || target->obd_stopping || !target->obd_set_up) {
DEBUG_REQ(D_ERROR, req, "UUID '%s' is not available "
}
case LCFG_LOV_DEL_OBD:
/* Unimplemented */
- LASSERT(0);
+ CERROR("lov_del_obd unimplemented\n");
+ rc = -ENOSYS;
+ break;
case LCFG_LOG_START: {
struct config_llog_data *cld;
struct config_llog_instance *cfg;
lockrc);
}
+ /* COMPAT_146 */
if (mti->mti_flags & LDD_F_UPGRADE14) {
CDEBUG(D_MGS, "upgrading fs %s from pre-1.6\n",
mti->mti_fsname);
mti->mti_flags &= ~LDD_F_UPGRADE14;
}
+ /* end COMPAT_146 */
if (mti->mti_flags & LDD_F_NEED_REGISTER) {
CDEBUG(D_MGS, "adding %s, index=%d\n", mti->mti_svname,
return rc;
}
+
+/* COMPAT_146 */
/***************** upgrade pre-mountconf logs to mountconf *****************/
int mgs_upgrade_logs_14(struct obd_device *obd, struct fs_db *db,
RETURN(rc);
}
+/* end COMPAT_146 */
/******************** unused *********************/
} else if (name) {
/* COMPAT_146 */
- if (obd->obd_type->typ_name == LUSTRE_MDS_NAME) {
+ if (strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME) == 0) {
handle->lgh_file = llog_filp_open(MDT_LOGS_DIR, name,
open_flags, 0644);
} else {
ENTRY;
/* COMPAT_146 */
- if (obd->obd_type->typ_name == LUSTRE_MDS_NAME)
+ if (strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME) == 0)
dir = MDT_LOGS_DIR;
else
/* end COMPAT_146 */
}
}
out:
+ if ((err == -ENOSYS || err == -EINVAL) &&
+ !(lcfg->lcfg_command & LCFG_REQUIRED)) {
+ CWARN("Skipping optional command %#x\n", lcfg->lcfg_command);
+ err = 0;
+ }
return err;
}
MOUNT_DATA_FILE, rc, len);
GOTO(out_close, rc = -EINVAL);
}
+ rc = 0;
if (ldd->ldd_magic != LDD_MAGIC) {
CERROR("Bad magic in %s: %x!=%x\n", MOUNT_DATA_FILE,
GOTO(out_close, rc = -EINVAL);
}
- rc = 0;
+ if (ldd->ldd_feature_incompat & ~LDD_INCOMPAT_SUPP) {
+ CERROR("%s: unsupported incompat filesystem feature(s) %x\n",
+ ldd->ldd_svname,
+ ldd->ldd_feature_incompat & ~LDD_INCOMPAT_SUPP);
+ GOTO(out_close, rc = -EINVAL);
+ }
+ if (ldd->ldd_feature_rocompat & ~LDD_ROCOMPAT_SUPP) {
+ CERROR("%s: unsupported read-only filesystem feature(s) %x\n",
+ ldd->ldd_svname,
+ ldd->ldd_feature_rocompat & ~LDD_ROCOMPAT_SUPP);
+ /* Do something like remount filesystem read-only */
+ GOTO(out_close, rc = -EINVAL);
+ }
+
ldd_print(ldd);
out_close:
#ifndef TUNEFS
"\t\t--mkfsoptions=<opts> : format options\n"
"\t\t--reformat: overwrite an existing disk\n"
+#else
+ "\t\t--nomgs: turn off MGS service on this MDT\n"
#endif
"\t\t--print: just report what we would do; don't write to "
"disk\n"
fwrite(&mop->mo_ldd, sizeof(mop->mo_ldd), 1, filep);
fclose(filep);
+ /* COMPAT_146 */
#ifdef TUNEFS
/* Check for upgrade */
if ((mop->mo_ldd.ldd_flags & (LDD_F_UPGRADE14 | LDD_F_SV_TYPE_MGS))
== (LDD_F_UPGRADE14 | LDD_F_SV_TYPE_MGS)) {
- /* Copy the old logs to fsname-client, fsname-mdt */
+ char *term;
vprint("Copying old logs\n");
+ /* Copy the old logs to fsname-client, fsname-mdt */
sprintf(filepnm, "%s/%s/%s-client",
mntpt, MOUNT_CONFIGS_DIR, mop->mo_ldd.ldd_fsname);
sprintf(cmd, "cp %s/%s/client %s", mntpt, MDT_LOGS_DIR,
mop->mo_device,
mop->mo_ldd.ldd_fsname, MOUNT_CONFIGS_DIR,
mop->mo_ldd.ldd_fsname);
- ret = 1;
goto out_umnt;
}
- /* copy the mdt log as well - name from mdt_UUID
+ /* Copy the mdt log as well - name from mdt_UUID
to fsname-MDT0000 */
- /* FIXME Yuk - parse the client log to find mdt name? */
- //filep = fopen(filepnm, "r");
-
+ ret = 1;
+ strcpy(filepnm, mop->mo_ldd.ldd_uuid);
+ term = strstr(filepnm, "_UUID");
+ if (term) {
+ *term = '\0';
+ sprintf(cmd, "cp %s/%s/%s %s/%s/%s",
+ mntpt, MDT_LOGS_DIR, filepnm,
+ mntpt, MOUNT_CONFIGS_DIR,
+ mop->mo_ldd.ldd_svname);
+ if (verbose > 1)
+ printf("cmd: %s\n", cmd);
+ ret = system(cmd);
+ }
+ if (ret) {
+ fprintf(stderr, "%s: Can't copy 1.4 config %s/%s "
+ "(%d)\n", progname, MDT_LOGS_DIR, filepnm, ret);
+ fprintf(stderr, "mount -t ext3 %s somewhere, "
+ "find the MDT log for fs %s and "
+ "copy it manually into %s/%s, "
+ "then umount.\n",
+ mop->mo_device,
+ mop->mo_ldd.ldd_fsname, MOUNT_CONFIGS_DIR,
+ mop->mo_ldd.ldd_svname);
+ goto out_umnt;
+ }
}
#endif
+ /* end COMPAT_146 */
+
out_umnt:
vprint("unmounting backing device\n");
goto out_rmdir;
}
-
sprintf(filepnm, "%s/%s", mntpt, MOUNT_DATA_FILE);
filep = fopen(filepnm, "r");
if (filep) {
vprint("Reading %s\n", MOUNT_DATA_FILE);
fread(&mop->mo_ldd, sizeof(mop->mo_ldd), 1, filep);
- /* drop FL_MGS from old config if FL_MDT is set --
- will re-set based on --mgsnode/--mgs */
- if (mop->mo_ldd.ldd_flags & LDD_F_SV_TYPE_MDT)
- mop->mo_ldd.ldd_flags &= ~LDD_F_SV_TYPE_MGS;
} else {
+ /* COMPAT_146 */
/* Try to read pre-1.6 config from last_rcvd */
struct lr_server_data lsd;
fprintf(stderr, "%s: Unable to read %s, trying last_rcvd\n",
mop->mo_ldd.ldd_flags = LDD_F_SV_TYPE_OST;
mop->mo_ldd.ldd_svindex = lsd.lsd_ost_index;
} else {
- if ((ret = access(filepnm, F_OK)) == 0)
+ if ((ret = access(filepnm, F_OK)) == 0) {
mop->mo_ldd.ldd_flags =
LDD_F_SV_TYPE_MDT |
LDD_F_SV_TYPE_MGS;
- else
+ /* Old MDT's are always index 0
+ (pre CMD) */
+ mop->mo_ldd.ldd_svindex = 0;
+ } else {
+ /* The index won't be correct */
mop->mo_ldd.ldd_flags =
- LDD_F_SV_TYPE_OST;
- /* The index won't be correct */
- mop->mo_ldd.ldd_flags |= LDD_F_NEED_INDEX;
+ LDD_F_SV_TYPE_OST | LDD_F_NEED_INDEX;
+ }
}
}
sizeof(mop->mo_ldd.ldd_uuid));
mop->mo_ldd.ldd_flags |= LDD_F_UPGRADE14;
}
+ /* end COMPAT_146 */
fclose(filep);
out_umnt:
{"mgsnid", 1, 0, 'm'},
{"mkfsoptions", 1, 0, 'k'},
{"mountfsoptions", 1, 0, 'o'},
+ {"nomgs", 0, 0, 'N'},
{"ost", 0, 0, 'O'},
{"print", 0, 0, 'p'},
{"quiet", 0, 0, 'q'},
{"verbose", 0, 0, 'v'},
{0, 0, 0, 0}
};
- char *optstring = "b:C:d:n:f:hI:MGm:k:o:Opqrw:c:s:i:t:v";
+ char *optstring = "b:C:d:n:f:hI:MGm:k:No:Opqrw:c:s:i:t:v";
char opt;
int longidx;
strncpy(mop->mo_ldd.ldd_fsname, optarg,
sizeof(mop->mo_ldd.ldd_fsname) - 1);
break;
+ case 'N':
+ mop->mo_ldd.ldd_flags &= ~LDD_F_SV_TYPE_MGS;
+ break;
case 'o':
mountopts = optarg;
break;