/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * lustre/obdclass/obd_mount.c
- * Client/server mount routines
+ * GPL HEADER START
*
- * Copyright (c) 2006 Cluster File Systems, Inc.
- * Author: Nathan Rutman <nathan@clusterfs.com>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * This file is part of Lustre, http://www.lustre.org/
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
*
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see [sun.com URL with a
+ * copy of GPLv2].
*
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/obdclass/obd_mount.c
+ *
+ * Client/server mount routines
+ *
+ * Author: Nathan Rutman <nathan@clusterfs.com>
*/
/*********** mount lookup *********/
DECLARE_MUTEX(lustre_mount_info_lock);
-struct list_head server_mount_info_list = LIST_HEAD_INIT(server_mount_info_list);
+static CFS_LIST_HEAD(server_mount_info_list);
static struct lustre_mount_info *server_find_mount(const char *name)
{
"communication errors between this node and "
"the MGS, a bad configuration, or other "
"errors. See the syslog for more "
- "information.\n", mgc->obd_name, logname,
+ "information.\n", mgc->obd_name, logname,
rc);
/* class_obd_list(); */
DECLARE_MUTEX(mgc_start_lock);
-/* Set up a mgcobd to process startup logs */
+/** Set up a mgc obd to process startup logs
+ *
+ * \param sb [in] super block of the mgc obd
+ *
+ * \retval 0 success, otherwise error code
+ */
static int lustre_start_mgc(struct super_block *sb)
{
struct lustre_handle mgc_conn = {0, };
- struct obd_connect_data ocd = { 0 };
+ struct obd_connect_data *data = NULL;
struct lustre_sb_info *lsi = s2lsi(sb);
struct obd_device *obd;
struct obd_export *exp;
mutex_down(&mgc_start_lock);
obd = class_name2obd(mgcname);
- if (obd) {
+ if (obd && !obd->obd_stopping) {
/* Re-using an existing MGC */
atomic_inc(&obd->u.cli.cl_mgc_refcount);
recov_bk++;
CDEBUG(D_MOUNT, "%s: Set MGC reconnect %d\n", mgcname,recov_bk);
rc = obd_set_info_async(obd->obd_self_export,
- strlen(KEY_INIT_RECOV_BACKUP),
+ sizeof(KEY_INIT_RECOV_BACKUP),
KEY_INIT_RECOV_BACKUP,
sizeof(recov_bk), &recov_bk, NULL);
GOTO(out, rc = 0);
/* Try all connections, but only once. */
recov_bk = 1;
rc = obd_set_info_async(obd->obd_self_export,
- strlen(KEY_INIT_RECOV_BACKUP),
+ sizeof(KEY_INIT_RECOV_BACKUP),
KEY_INIT_RECOV_BACKUP,
sizeof(recov_bk), &recov_bk, NULL);
if (rc)
/* nonfatal */
- CERROR("can't set %s %d\n", KEY_INIT_RECOV_BACKUP, rc);
+ CWARN("can't set %s %d\n", KEY_INIT_RECOV_BACKUP, rc);
/* We connect to the MGS at setup, and don't disconnect until cleanup */
-
- ocd.ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_FID;
- ocd.ocd_version = LUSTRE_VERSION_CODE;
-
- rc = obd_connect(NULL, &mgc_conn, obd, &(obd->obd_uuid), &ocd);
+ OBD_ALLOC_PTR(data);
+ if (data == NULL)
+ GOTO(out, rc = -ENOMEM);
+ data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_FID |
+ OBD_CONNECT_AT;
+ data->ocd_version = LUSTRE_VERSION_CODE;
+ rc = obd_connect(NULL, &mgc_conn, obd, &(obd->obd_uuid), data, NULL);
+ OBD_FREE_PTR(data);
if (rc) {
CERROR("connect failed %d\n", rc);
GOTO(out, rc);
obd = lsi->lsi_mgc;
if (!obd)
RETURN(-ENOENT);
-
lsi->lsi_mgc = NULL;
+
mutex_down(&mgc_start_lock);
if (!atomic_dec_and_test(&obd->u.cli.cl_mgc_refcount)) {
/* This is not fatal, every client that stops
GOTO(out, rc = -EBUSY);
}
- /* The MGC has no recoverable data in any case.
+ /* The MGC has no recoverable data in any case.
* force shotdown set in umount_begin */
obd->obd_no_recov = 1;
- if (obd->u.cli.cl_mgc_mgsexp)
- obd_disconnect(obd->u.cli.cl_mgc_mgsexp);
+ if (obd->u.cli.cl_mgc_mgsexp) {
+ /* An error is not fatal, if we are unable to send the
+ disconnect mgs ping evictor cleans up the export */
+ rc = obd_disconnect(obd->u.cli.cl_mgc_mgsexp);
+ if (rc)
+ CDEBUG(D_MOUNT, "disconnect failed %d\n", rc);
+ }
/* Save the obdname for cleaning the nid uuids, which are
obdname_XX */
/* cl_mgc_sem in mgc insures we sleep if the mgc_fs is busy */
rc = obd_set_info_async(mgc->obd_self_export,
- strlen("set_fs"), "set_fs",
+ sizeof(KEY_SET_FS), KEY_SET_FS,
sizeof(*sb), sb, NULL);
if (rc) {
CERROR("can't set_fs %d\n", rc);
CDEBUG(D_MOUNT, "Unassign mgc disk\n");
rc = obd_set_info_async(mgc->obd_self_export,
- strlen("clear_fs"), "clear_fs",
+ sizeof(KEY_CLEAR_FS), KEY_CLEAR_FS,
0, NULL, NULL);
RETURN(rc);
}
/* Register the target */
/* FIXME use mgc_process_config instead */
rc = obd_set_info_async(mgc->u.cli.cl_mgc_mgsexp,
- strlen("register_target"), "register_target",
+ sizeof(KEY_REGISTER_TARGET), KEY_REGISTER_TARGET,
sizeof(*mti), mti, NULL);
- if (rc) {
- CERROR("registration with the MGS failed (%d)\n", rc);
+ if (rc)
GOTO(out, rc);
- }
/* Always update our flags */
ldd->ldd_flags = mti->mti_flags & ~LDD_F_REWRITE_LDD;
lsi->lsi_ldd->ldd_svname);
GOTO(out_mgc, rc);
}
+ /* non-fatal error of registeration with MGS */
+ if (rc)
+ CDEBUG(D_MOUNT, "Cannot register with MGS: %d\n", rc);
/* Let the target look up the mount using the target's name
(we can't pass the sb or mnt through class_process_config.) */
CDEBUG(D_MOUNT, "server put_super %s\n", tmpname);
/* Stop the target */
- if (IS_MDT(lsi->lsi_ldd) || IS_OST(lsi->lsi_ldd)) {
+ if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOSVC) &&
+ (IS_MDT(lsi->lsi_ldd) || IS_OST(lsi->lsi_ldd))) {
struct lustre_profile *lprof = NULL;
/* tell the mgc to drop the config log */
/* stop the mgc before the mgs so the connection gets cleaned
up */
lustre_stop_mgc(sb);
- server_stop_mgs(sb);
+ /* if MDS start with --nomgs, don't stop MGS then */
+ if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOMGS))
+ server_stop_mgs(sb);
}
/* Clean the mgc and sb */
}
/* start MGS before MGC */
- if (IS_MGS(lsi->lsi_ldd)) {
+ if (IS_MGS(lsi->lsi_ldd) && !(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOMGS)) {
rc = server_start_mgs(sb);
if (rc)
GOTO(out_mnt, rc);
} else if (strncmp(s1, "nosvc", 5) == 0) {
lmd->lmd_flags |= LMD_FLG_NOSVC;
clear++;
+ } else if (strncmp(s1, "nomgs", 5) == 0) {
+ lmd->lmd_flags |= LMD_FLG_NOMGS;
+ clear++;
/* ost exclusion list */
} else if (strncmp(s1, "exclude=", 8) == 0) {
rc = lmd_make_exclusion(lmd, s1 + 7);
.name = "lustre",
.get_sb = lustre_get_sb,
.kill_sb = lustre_kill_super,
- .fs_flags = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV,
+ .fs_flags = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
+ LL_RENAME_DOES_D_MOVE,
};
int lustre_register_fs(void)
EXPORT_SYMBOL(server_name2index);
EXPORT_SYMBOL(server_mti_print);
EXPORT_SYMBOL(do_lcfg);
-
-