__u32 *lmd_exclude; /* array of OSTs to ignore */
};
-#define LMD_FLG_CLIENT 0x0002 /* Mounting a client only */
-#define LMD_FLG_RECOVER 0x0004 /* Allow recovery */
-#define LMD_FLG_NOSVC 0x0008 /* Only start MGS/MGC for servers,
+#define LMD_FLG_SERVER 0x0001 /* Mounting a server */
+#define LMD_FLG_CLIENT 0x0002 /* Mounting a client */
+#define LMD_FLG_ABORT_RECOV 0x0008 /* Abort recovery */
+#define LMD_FLG_NOSVC 0x0010 /* Only start MGS/MGC for servers,
no other services */
#define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
/* from the (client) config log, figure out:
1. which ost's/mdt's are configured (by index)
2. what the last config step is
+ 3. COMPAT_146 lov name
+ 4. COMPAT_146 mdt lov name
+ 5. COMPAT_146 mdc name
*/
-/* FIXME is it better to have a separate db file, instead of parsing the info
- out of the client log? */
+/* It might be better to have a separate db file, instead of parsing the info
+ out of the client log. This is slow and potentially error-prone. */
static int mgs_fsdb_handler(struct llog_handle *llh, struct llog_rec_hdr *rec,
void *data)
{
struct llog_handle *llh;
int rc = 0;
- /* FIXME cache the empty state in the db */
-
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT),
&llh, NULL, name);
/* write the lcfg in all logs for the given fs */
int mgs_write_log_direct_all(struct obd_device *obd, struct fs_db *fsdb,
- char *fsname, struct lustre_cfg *lcfg)
+ char *fsname, struct lustre_cfg *lcfg)
{
struct mgs_obd *mgs = &obd->u.mgs;
struct list_head dentry_list;
ENTRY;
/* We need to set params for any future logs
- as well. FIXME Append this file to every new log. */
+ as well. FIXME Append this file to every new log.
+ Actually, we should store as params (text), not llogs. Or
+ in a database. */
name_create(&logname, fsname, "-params");
if (mgs_log_is_empty(obd, logname)) {
struct llog_handle *llh = NULL;
if (mti->mti_flags & LDD_F_UPGRADE14) {
/* Old client log already has MDC entry, but needs mount opt
for new client name (lustre-client) */
+ /* FIXME Old MDT log already has an old mount opt
+ which we should remove (currently handled by
+ class_del_profiles()) */
rc = record_mount_opt(obd, llh, cliname, fsdb->fsdb_clilov,
fsdb->fsdb_mdc);
/* end COMPAT_146 */
/* The ost startup log */
/* If the ost log already exists, that means that someone reformatted
- the ost and it called target_add again.
- FIXME check and warn here, maybe inc config ver #? Or abort,
- and claim there's already a server with that name? Maybe need
- another flag to say it's okay to rewrite.
- Heck, what do we do about the client and mds logs? We better
- abort. */
+ the ost and it called target_add again. */
if (!mgs_log_is_empty(obd, mti->mti_svname)) {
LCONSOLE_ERROR("The config log for %s already exists, yet the "
"server claims it never registered. It may have"
" been reformatted, or the index changed. Use "
" tunefs.lustre --writeconf to regenerate "
" all logs.\n", mti->mti_svname);
- return -EALREADY;
+ RETURN(-EALREADY);
}
/*
attach obdfilter ost1 ost1_UUID
/* If we're upgrading, the old mdt log already has our
entry. Let's do a fake one for fun. */
flags = CM_SKIP | CM_UPGRADE146;
- /* FIXME add to all mdt logs for CMD */
- // FIXME need real mdt name -- but MDT may not have registered yet!
+ /* FIXME add to all MDT logs for CMD */
+ /* FIXME need real MDT name, but MDT may not have registered yet! */
name_create(&logname, mti->mti_fsname, "-MDT0000");
mgs_write_log_osc(obd, fsdb, mti, logname, fsdb->fsdb_mdtlov, flags);
name_destroy(logname);
len = strlen(ptr);
CDEBUG(D_MGS, "next param '%.*s'\n", len, ptr);
+ /* Stored in MOUNT_DATA_FILE, modified via tunefs.lustre */
if (class_match_param(ptr, PARAM_MGSNODE, &endptr) == 0)
GOTO(end_while, rc);
RETURN(-ENOENT);
CDEBUG(D_MGS, "Checking for new failnids for %s\n", mti->mti_svname);
- // FIXME check logs
- /* FIXME we need a real database lookup. Create on-disk db of known
- size, lookup by index */
- /* Check each nid, or check only nid0 and add all if nid0 is missing?
- What if someone adds a net to a node? Better check everything. */
- /* if nid 0 is missing, mgs_write_log_add_failnid.
- if just one nid is missing, add uuid for nodeuuid[nid0]).
- */
- /* Hey, we can just check mti->params to see if we're already in
- the failover list */
+ /* FIXME We can just check mti->params to see if we're already in
+ the failover list. Modify mti->params for rewriting back at
+ server_register_target(). */
down(&fsdb->fsdb_sem);
rc = mgs_write_log_add_failnid(obd, fsdb, mti);
} else {
if (rc == EALREADY) {
/* Update a target entry in the logs */
- // FIXME mark old log sections as invalid, add new.
CERROR("updates not yet implemented\n");
+ /* FIXME mark old log sections as invalid,
+ inc config ver #, add new log sections.
+ Make sure to update client and mds logs too
+ if needed */
RETURN(-ENXIO);
}
}
RETURN(-ENOENT);
}
- /* FIXME Old MDT log already has an old mount opt
- which we should drop */
rc = mgs_write_log_target(obd, mti);
RETURN(rc);
}
RETURN(0);
}
-/* Deregister anyone referencing the mnt. Everyone should have
- put_mount in *_cleanup, but this is a catch-all in case of err... */
-/* FIXME this should be removed from lustre_free_lsi, which may be called
- from server_put_mount _before_ it gets to server_deregister_mount.
- Leave it here for now for the error message it shows... */
-static void server_deregister_mount_all(struct vfsmount *mnt)
-{
- struct list_head *tmp, *n;
- struct lustre_mount_info *lmi;
- ENTRY;
-
- if (!mnt) {
- EXIT;
- return;
- }
-
- //down(&lustre_mount_info_lock);
- list_for_each_safe(tmp, n, &server_mount_info_list) {
- lmi = list_entry(tmp, struct lustre_mount_info, lmi_list_chain);
- if (lmi->lmi_mnt == mnt) {
- CERROR("Mount %p still referenced by %s\n", mnt,
- lmi->lmi_name);
- //OBD_FREE(lmi->lmi_name, strlen(lmi->lmi_name) + 1);
- //list_del(&lmi->lmi_list_chain);
- //OBD_FREE(lmi, sizeof(*lmi));
- }
- }
- //up(&lustre_mount_info_lock);
- EXIT;
-}
-
/* obd's look up a registered mount using their name. This is just
for initial obd setup to find the mount struct. It should not be
called every time you want to mntget. */
/* nonfatal */
CERROR("can't set %s %d\n", KEY_INIT_RECOV_BACKUP, rc);
- /* FIXME add ACL support? */
- //ocd.ocd_connect_flags = OBD_CONNECT_ACL;
-
/* We connect to the MGS at setup, and don't disconnect until cleanup */
rc = obd_connect(&mgc_conn, obd, &(obd->obd_uuid), &ocd);
if (rc) {
GOTO(out, rc);
}
- if (!class_name2obd(lsi->lsi_ldd->ldd_svname)) {
+ obd = class_name2obd(lsi->lsi_ldd->ldd_svname);
+ if (!obd) {
CERROR("no server named %s was started\n",
lsi->lsi_ldd->ldd_svname);
- rc = -ENXIO;
+ GOTO(out, rc = -ENXIO);
}
+
+ if ((lsi->lsi_lmd->lmd_flags & LMD_FLG_ABORT_RECOV) &&
+ (OBP(obd, iocontrol)))
+ obd_iocontrol(OBD_IOC_ABORT_RECOVERY, obd->obd_self_export,
+ 0, NULL, NULL);
out:
/* Release the mgc fs for others to use */
LASSERT(lsi->lsi_llsbi == NULL);
- server_deregister_mount_all(lsi->lsi_srv_mnt);
-
OBD_FREE(lsi, sizeof(*lsi));
s2lsi_nocast(sb) = NULL;
Note ext3/ldiskfs can't be mounted ro. */
s_flags = sb->s_flags;
- /* Pre-mount ext3 to read the MOUNT_DATA_FILE */
- CDEBUG(D_MOUNT, "Pre-mount ext3 %s\n", lmd->lmd_dev);
- mnt = do_kern_mount("ext3", s_flags, lmd->lmd_dev, 0);
+ /* Pre-mount ldiskfs to read the MOUNT_DATA_FILE */
+ CDEBUG(D_MOUNT, "Pre-mount ldiskfs %s\n", lmd->lmd_dev);
+ mnt = do_kern_mount("ldiskfs", s_flags, lmd->lmd_dev, 0);
if (IS_ERR(mnt)) {
rc = PTR_ERR(mnt);
- CERROR("premount ext3 failed (%d), trying ldiskfs\n", rc);
- /* If ext3 fails (bec. of mballoc, extents), try ldiskfs */
- mnt = do_kern_mount("ldiskfs", s_flags, lmd->lmd_dev, 0);
+ CERROR("premount ldiskfs failed (%d), trying ext3\n", rc);
+ /* If ldisk fails, try ext3 */
+ mnt = do_kern_mount("ext3", s_flags, lmd->lmd_dev, 0);
if (IS_ERR(mnt)) {
rc = PTR_ERR(mnt);
- CERROR("premount ldiskfs failed: rc = %d\n", rc);
+ CERROR("premount ext3 failed: rc = %d\n", rc);
GOTO(out_free, rc);
}
}
}
lmd->lmd_magic = LMD_MAGIC;
- /* Default flags */
- lmd->lmd_flags |= LMD_FLG_RECOVER;
+ /* Set default flags here */
s1 = options;
while (*s1) {
/* Client options are parsed in ll_options: eg. flock,
user_xattr, acl */
- if (strncmp(s1, "recov", 5) == 0)
- /* FIXME do something with the RECOVER flag - see lconf */
- lmd->lmd_flags |= LMD_FLG_RECOVER;
- else if (strncmp(s1, "norecov", 7) == 0)
- lmd->lmd_flags &= ~LMD_FLG_RECOVER;
+ /* Parse non-ldiskfs options here */
+ if (strncmp(s1, "abort_recov", 11) == 0)
+ lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
else if (strncmp(s1, "nosvc", 5) == 0)
lmd->lmd_flags |= LMD_FLG_NOSVC;
-
/* ost exclusion list */
else if (strncmp(s1, "exclude=", 8) == 0) {
rc = lmd_make_exclusion(lmd, s1 + 7);
{ "noacl", 1, 1, 0 }, /* Disable ACL support */
{ "nosvc", 0, 0, 0 }, /* Only start MGS/MGC, nothing else */
{ "exclude", 0, 0, 0 }, /* OST exclusion list */
+ { "abort_recov", 0, 0, 0 }, /* Abort recovery */
{ NULL, 0, 0, 0 }
};
/****************************************************************************/