Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Fri, 10 Feb 2006 17:39:36 +0000 (17:39 +0000)
committernathan <nathan>
Fri, 10 Feb 2006 17:39:36 +0000 (17:39 +0000)
b=8007
- change screaming plethora of debug "error" messages to loudly-shouting
plethora of debug "warn" messages.
- stop a bare MGS more quickly

12 files changed:
lustre/include/lustre/lustre_user.h
lustre/llite/llite_lib.c
lustre/lov/lov_log.c
lustre/lov/lov_obd.c
lustre/mds/mds_lov.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_fs.c
lustre/mgs/mgs_handler.c
lustre/mgs/mgs_llog.c
lustre/obdclass/obd_config.c
lustre/obdclass/obd_mount.c
lustre/obdfilter/filter.c

index 51fb866..767a92f 100644 (file)
@@ -176,10 +176,11 @@ static inline void obd_str2uuid(struct obd_uuid *uuid, char *tmp)
         uuid->uuid[sizeof(*uuid) - 1] = '\0';
 }
 
-static inline char *obd_uuid2str(struct obd_uuid *uuid)
-{
-        return (char *)uuid->uuid;
-}
+/* If we're not null-terminated, crash here instead of in printf */
+#define obd_uuid2str(x) (                                            \
+        LASSERT((x)->uuid[sizeof(struct obd_uuid) - 1] == '\0'),     \
+        (char *)(x)->uuid                                            \
+)
 
 #define LUSTRE_Q_QUOTAON  0x800002     /* turn quotas on */
 #define LUSTRE_Q_QUOTAOFF 0x800003     /* turn quotas off */
index d422740..d0fb2e3 100644 (file)
@@ -652,7 +652,7 @@ int ll_fill_super(struct super_block *sb)
                 CERROR("No profile found: %s\n", profilenm);
                 GOTO(out_free, err = -EINVAL);
         }
-        CERROR("Found profile %s: mdc=%s osc=%s\n", profilenm, 
+        CDEBUG(D_CONFIG, "Found profile %s: mdc=%s osc=%s\n", profilenm, 
                lprof->lp_mdc, lprof->lp_osc);
 
         OBD_ALLOC(osc, strlen(lprof->lp_osc) +
index 0fcabaf..715b4b8 100644 (file)
@@ -198,8 +198,7 @@ int lov_llog_init(struct obd_device *obd, struct obd_device *tgt,
         if (rc)
                 RETURN(rc);
 
-        //FIXME remove D_ERROR
-        CDEBUG(D_CONFIG | D_ERROR, "llog init with %d targets\n", count);
+        CDEBUG(D_CONFIG, "llog init with %d targets\n", count);
         LASSERT(lov->desc.ld_tgt_count == count);
         for (i = 0, ctgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, ctgt++) {
                 struct obd_device *child;
index 5a6dfe9..f36cebe 100644 (file)
@@ -114,15 +114,15 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
                                         &obd->obd_uuid);
         
         if (!tgt_obd) {
-                CERROR("Target %s not attached\n", tgt_uuid->uuid);
+                CERROR("Target %s not attached\n", obd_uuid2str(tgt_uuid));
                 RETURN(-EINVAL);
         }
         
-        CDEBUG(D_ERROR, "Connect tgt %s (%s)\n", (char *)tgt->uuid.uuid,
+        CDEBUG(D_CONFIG, "Connect tgt %s (%s)\n", obd_uuid2str(tgt_uuid),
                tgt_obd->obd_name);
 
         if (!tgt_obd->obd_set_up) {
-                CERROR("Target %s not set up\n", tgt_uuid->uuid);
+                CERROR("Target %s not set up\n", obd_uuid2str(tgt_uuid));
                 RETURN(-EINVAL);
         }
 
@@ -138,19 +138,20 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
 
         if (imp->imp_invalid) {
                 CERROR("not connecting OSC %s; administratively "
-                       "disabled\n", tgt_uuid->uuid);
+                       "disabled\n", obd_uuid2str(tgt_uuid));
                 rc = obd_register_observer(tgt_obd, obd);
                 if (rc) {
                         CERROR("Target %s register_observer error %d; "
                                "will not be able to reactivate\n",
-                               tgt_uuid->uuid, rc);
+                               obd_uuid2str(tgt_uuid), rc);
                 }
                 RETURN(0);
         }
 
         rc = obd_connect(&conn, tgt_obd, &lov_osc_uuid, data);
         if (rc) {
-                CERROR("Target %s connect error %d\n", tgt_uuid->uuid, rc);
+                CERROR("Target %s connect error %d\n",
+                       obd_uuid2str(tgt_uuid), rc);
                 RETURN(rc);
         }
         tgt->ltd_exp = class_conn2export(&conn);
@@ -158,7 +159,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
         rc = obd_register_observer(tgt_obd, obd);
         if (rc) {
                 CERROR("Target %s register_observer error %d\n",
-                       tgt_uuid->uuid, rc);
+                       obd_uuid2str(tgt_uuid), rc);
                 obd_disconnect(tgt->ltd_exp);
                 tgt->ltd_exp = NULL;
                 RETURN(rc);
@@ -506,7 +507,7 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
 
         tgt = &lov->tgts[index];
         if (!obd_uuid_empty(&tgt->uuid)) {
-                CERROR("UUID %.40s already assigned at LOV target index %d\n",
+                CERROR("UUID %s already assigned at LOV target index %d\n",
                        obd_uuid2str(&tgt->uuid), index);
                 RETURN(-EEXIST);
         }
index 7726861..c3e7567 100644 (file)
@@ -72,8 +72,6 @@ static int mds_lov_read_objids(struct obd_device *obd)
            has fewer targets. Old targets not in the lov descriptor 
            during mds setup may still have valid objids. */
         size = mds->mds_lov_objid_filp->f_dentry->d_inode->i_size;
-
-        CERROR("objid file size: %d\n", size);
         if (size == 0)
                 RETURN(0);
 
index b9f1b49..f6a4073 100644 (file)
@@ -1,9 +1,11 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  Copyright (C) 2001-2005 Cluster File Systems, Inc.
- *   Author Nathan <nathan@clusterfs.com>
- *   Author LinSongTao <lincent@clusterfs.com>
+ *  lustre/mgc/mgc_request.c
+ *  Lustre Management Client config llog handling
+ *
+ *  Copyright (C) 2006 Cluster File Systems, Inc.
+ *   Author Nathan Rutman <nathan@clusterfs.com>
  *
  *   This file is part of Lustre, http://www.lustre.org
  *
  *  requests are coming * in over the wire, so object target modules
  *  do not have a full * method table.)
  */
 #ifndef EXPORT_SYMTAB
 # define EXPORT_SYMTAB
 #endif
 #define DEBUG_SUBSYSTEM S_MGC
-#define D_MGC D_CONFIG|D_ERROR
+#define D_MGC D_CONFIG|D_WARNING
 
 #ifdef __KERNEL__
 # include <linux/module.h>
@@ -211,6 +214,7 @@ static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb,
         struct client_obd *cli = &obd->u.cli;
         struct dentry *dentry;
         int err = 0;
+        ENTRY;
 
         LASSERT(lsi);
         LASSERT(lsi->lsi_srv_mnt == mnt);
@@ -221,22 +225,22 @@ static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb,
 
         obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
         if (IS_ERR(obd->obd_fsops)) {
-               CERROR("No fstype %s rc=%ld\n", MT_STR(lsi->lsi_ldd), 
-                      PTR_ERR(obd->obd_fsops));
-               return(PTR_ERR(obd->obd_fsops));
+                up(&cli->cl_mgc_sem);
+                CERROR("No fstype %s rc=%ld\n", MT_STR(lsi->lsi_ldd), 
+                       PTR_ERR(obd->obd_fsops));
+                RETURN(PTR_ERR(obd->obd_fsops));
         }
 
         cli->cl_mgc_vfsmnt = mnt;
         // FIXME which is the right SB? - filter_common_setup also 
-        CERROR("SB's: fill=%p mnt=%p root=%p\n", sb, mnt->mnt_sb,
+        CDEBUG(D_MGC, "SB's: fill=%p mnt=%p root=%p\n", sb, mnt->mnt_sb,
                mnt->mnt_root->d_inode->i_sb);
-        fsfilt_setup(obd, mnt->mnt_root->d_inode->i_sb);
+        fsfilt_setup(obd, mnt->mnt_sb);
 
         OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt);
         obd->obd_lvfs_ctxt.pwdmnt = mnt;
         obd->obd_lvfs_ctxt.pwd = mnt->mnt_root;
         obd->obd_lvfs_ctxt.fs = get_ds();
-        //obd->obd_lvfs_ctxt.cb_ops = mds_lvfs_ops;
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         dentry = lookup_one_len(MOUNT_CONFIGS_DIR, current->fs->pwd,
@@ -246,25 +250,26 @@ static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb,
                 err = PTR_ERR(dentry);
                 CERROR("cannot lookup %s directory: rc = %d\n", 
                        MOUNT_CONFIGS_DIR, err);
-                goto err_ops;
+                GOTO(err_ops, err);
         }
         cli->cl_mgc_configs_dir = dentry;
 
         /* We keep the cl_mgc_sem until mgc_fs_cleanup */
-        return (0);
+        RETURN(0);
 
 err_ops:        
         fsfilt_put_ops(obd->obd_fsops);
         obd->obd_fsops = NULL;
         cli->cl_mgc_vfsmnt = NULL;
         up(&cli->cl_mgc_sem);
-        return(err);
+        RETURN(err);
 }
 
 static int mgc_fs_cleanup(struct obd_device *obd)
 {
         struct client_obd *cli = &obd->u.cli;
         int rc = 0;
+        ENTRY;
 
         LASSERT(cli->cl_mgc_vfsmnt != NULL);
 
@@ -276,20 +281,12 @@ static int mgc_fs_cleanup(struct obd_device *obd)
                 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         }
 
-        /* never got mount
-        rc = server_put_mount(obd->obd_name, cli->cl_mgc_vfsmnt);
-        if (rc)
-             CERROR("mount_put failed %d\n", rc);
-        */
-
         cli->cl_mgc_vfsmnt = NULL;
-        
         if (obd->obd_fsops) 
                 fsfilt_put_ops(obd->obd_fsops);
         
         up(&cli->cl_mgc_sem);
-        
-        return(rc);
+        RETURN(rc);
 }
 
 static int mgc_cleanup(struct obd_device *obd)
index 9c8e90b..db0b5f7 100644 (file)
@@ -1,12 +1,11 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  mgs/mgs_fs.c
+ *  lustre/mgs/mgs_fs.c
  *  Lustre Management Server (MGS) filesystem interface code
  *
- *  Copyright (C) 2002, 2003 Cluster File Systems, Inc.
- *   Author: Nathan <nathan@clusterfs.com>
- *   Author: LinSongtao <lincent@clusterfs.com>
+ *  Copyright (C) 2006 Cluster File Systems, Inc.
+ *   Author: Nathan Rutman <nathan@clusterfs.com>
  *
  *   This file is part of Lustre, http://www.lustre.org.
  *
@@ -187,15 +186,15 @@ int mgs_fs_cleanup(struct obd_device *obd)
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
         if (mgs->mgs_configs_dir) {
-                CERROR("configs dir dcount=%d\n",
-                       atomic_read(&mgs->mgs_configs_dir->d_count));
+                /*CERROR("configs dir dcount=%d\n",
+                       atomic_read(&mgs->mgs_configs_dir->d_count));*/
                 l_dput(mgs->mgs_configs_dir);
                 mgs->mgs_configs_dir = NULL;
         }
 
         shrink_dcache_parent(mgs->mgs_fid_de);
-        CERROR("fid dir dcount=%d\n",
-               atomic_read(&mgs->mgs_fid_de->d_count));
+        /*CERROR("fid dir dcount=%d\n",
+               atomic_read(&mgs->mgs_fid_de->d_count));*/
         dput(mgs->mgs_fid_de);
 
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
index 9773839..3d6a61d 100644 (file)
@@ -4,9 +4,8 @@
  *  lustre/mgs/mgs_handler.c
  *  Lustre Management Server (mgs) request handler
  *
- *  Copyright (C) 2001-2005 Cluster File Systems, Inc.
- *   Author Nathan <nathan@clusterfs.com>
- *   Author LinSongTao <lincent@clusterfs.com>
+ *  Copyright (C) 2006 Cluster File Systems, Inc.
+ *   Author: Nathan Rutman <nathan@clusterfs.com>
  *
  *   This file is part of Lustre, http://www.lustre.org.
  *
@@ -28,7 +27,7 @@
 # define EXPORT_SYMTAB
 #endif
 #define DEBUG_SUBSYSTEM S_MGS
-#define D_MGS D_CONFIG|D_ERROR
+#define D_MGS D_CONFIG|D_WARNING
 
 #ifdef __KERNEL__
 # include <linux/module.h>
@@ -353,11 +352,11 @@ static int mgs_handle_target_add(struct ptlrpc_request *req)
         /* revoke the config lock so everyone will update */
         lockrc = mgs_get_cfg_lock(obd, mti->mti_fsname, &lockh);
         if (lockrc != ELDLM_OK) {
-                LCONSOLE_ERROR("Can't signal other nodes to update "
+                LCONSOLE_ERROR("%s: Can't signal other nodes to update "
                                "their configuration (%d). Updating local logs "
                                "anyhow; you might have to manually restart "
                                "other nodes to get the latest configuration.\n",
-                               lockrc);
+                               obd->obd_name, lockrc);
         }
 
         /* There can be only 1 server adding at a time - don't want log
@@ -367,10 +366,10 @@ static int mgs_handle_target_add(struct ptlrpc_request *req)
         if (mti->mti_flags & LDD_F_WRITECONF) {
                 rc = mgs_erase_logs(obd, mti->mti_fsname);
                 mti->mti_flags |= LDD_F_NEED_REGISTER;
-                LCONSOLE_WARNING("Logs for fs %s were removed by user request. "
-                                 "All servers must re-register in order to "
-                                 "regenerate the client log.\n",
-                                 mti->mti_fsname);
+                LCONSOLE_WARN("%s: Logs for fs %s were removed by user request."
+                              All servers must re-register in order to "
+                              "regenerate the client log.\n",
+                              obd->obd_name, mti->mti_fsname);
                 mti->mti_flags &= ~LDD_F_WRITECONF;
                 mti->mti_flags |= LDD_F_REWRITE;
         }
@@ -455,7 +454,6 @@ int mgs_handle(struct ptlrpc_request *req)
                 rc = target_handle_disconnect(req);
                 req->rq_status = rc;            /* superfluous? */
                 break;
-
         case MGS_TARGET_ADD:
                 DEBUG_REQ(D_MGS, req, "target add\n");
                 rc = mgs_handle_target_add(req);
@@ -484,7 +482,6 @@ int mgs_handle(struct ptlrpc_request *req)
                 DEBUG_REQ(D_INFO, req, "ping");
                 rc = target_handle_ping(req);
                 break;
-
         case OBD_LOG_CANCEL:
                 DEBUG_REQ(D_MGS, req, "log cancel\n");
                 OBD_FAIL_RETURN(OBD_FAIL_OBD_LOG_CANCEL_NET, 0);
index 2505fdf..57e3c7f 100644 (file)
@@ -2,9 +2,10 @@
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
  *  lustre/mgs/mgs_llog.c
- *  Lustre Management Server (mgs) llog controller
+ *  Lustre Management Server (mgs) config llog creation
  *
- *  Copyright (C) 2001-2005 Cluster File Systems, Inc.
+ *  Copyright (C) 2006 Cluster File Systems, Inc.
+ *   Author: Nathan Rutman <nathan@clusterfs.com>
  *
  *   This file is part of Lustre, http://www.lustre.org.
  *
@@ -26,7 +27,7 @@
 #define EXPORT_SYMTAB
 #endif
 #define DEBUG_SUBSYSTEM S_MGS
-#define D_MGS D_CONFIG|D_ERROR
+#define D_MGS D_CONFIG|D_WARNING
 
 #ifdef __KERNEL__
 #include <linux/module.h>
index bbf0c49..b1ebf84 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  Copyright (c) 2001-2003 Cluster File Systems, Inc.
+ *  Copyright (c) 2001-2006 Cluster File Systems, Inc.
  *
  *   This file is part of the Lustre file system, http://www.lustre.org
  *   Lustre is a trademark of Cluster File Systems, Inc.
@@ -841,7 +841,8 @@ int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
 
         rc = llog_process(llh, class_config_llog_handler, cfg, &cd);
 
-        CDEBUG(D_CONFIG|D_ERROR, "Processed log %s gen %d-%d (%d)\n", name, 
+        // FIXME remove warning
+        CDEBUG(D_CONFIG|D_WARNING, "Processed log %s gen %d-%d (%d)\n", name, 
                cd.first_idx + 1, cd.last_idx, rc);
         if (cfg)
                 cfg->cfg_last_idx = cd.last_idx;
index 4d9d109..ae01049 100644 (file)
@@ -1,10 +1,10 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  lustre/lvfs/lvfs_mount.c
+ *  lustre/obdclass/obd_mount.c
  *  Client/server mount routines
  *
- *  Copyright (c) 2005 Cluster File Systems, Inc.
+ *  Copyright (c) 2006 Cluster File Systems, Inc.
  *   Author: Nathan Rutman <nathan@clusterfs.com>
  *
  *   This file is part of Lustre, http://www.lustre.org/
@@ -372,7 +372,10 @@ out:
 /**************** config llog ********************/
 
 /* Get a config log from the MGS and process it.
-   This func is called for both clients and servers. */
+   This func is called for both clients and servers.
+   Continue to process new statements appended to the logs
+   (whenever the config lock is revoked) until lustre_end_log
+   is called. */
 int lustre_process_log(struct super_block *sb, char *logname, 
                      struct config_llog_instance *cfg)
 {
@@ -404,7 +407,7 @@ int lustre_process_log(struct super_block *sb, char *logname,
         RETURN(rc);
 }
 
-
+/* Stop watching this config log for updates */
 int lustre_end_log(struct super_block *sb, char *logname, 
                        struct config_llog_instance *cfg)
 {
@@ -1146,26 +1149,31 @@ static void server_put_super(struct super_block *sb)
 
         CDEBUG(D_MOUNT, "server put_super %s\n", lsi->lsi_ldd->ldd_svname);
                                                                                        
-        /* tell the mgc to drop the config log */
-        lustre_end_log(sb, lsi->lsi_ldd->ldd_svname, NULL);
+        /* Stop the target */
+        if (IS_MDT(lsi->lsi_ldd) || IS_OST(lsi->lsi_ldd)) {
 
-        obd = class_name2obd(lsi->lsi_ldd->ldd_svname);
-        if (obd) {
-                CDEBUG(D_MOUNT, "stopping %s\n", obd->obd_name);
-                if (lsi->lsi_flags & LSI_UMOUNT_FORCE)
+                /* tell the mgc to drop the config log */
+                lustre_end_log(sb, lsi->lsi_ldd->ldd_svname, NULL);
+                
+                obd = class_name2obd(lsi->lsi_ldd->ldd_svname);
+                if (obd) {
+                        CDEBUG(D_MOUNT, "stopping %s\n", obd->obd_name);
+                        if (lsi->lsi_flags & LSI_UMOUNT_FORCE)
+                                obd->obd_force = 1;
+                        if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER)
+                                obd->obd_fail = 1;
+                        /* We can't seem to give an error return code
+                           to .put_super, so we better make sure we clean up!
+                           FIXME is there a way to get around this? */
                         obd->obd_force = 1;
-                if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER)
-                        obd->obd_fail = 1;
-                /* We can't seem to give an error return code
-                   to .put_super, so we better make sure we clean up!
-                   FIXME is there a way to get around this? */
-                obd->obd_force = 1;
-                class_manual_cleanup(obd);
-        } else {
-                CERROR("no obd %s\n", lsi->lsi_ldd->ldd_svname);
-                server_deregister_mount(lsi->lsi_ldd->ldd_svname);
+                        class_manual_cleanup(obd);
+                } else {
+                        CERROR("no obd %s\n", lsi->lsi_ldd->ldd_svname);
+                        server_deregister_mount(lsi->lsi_ldd->ldd_svname);
+                }
         }
 
+        /* Stop the servers (MDS, OSS) if no longer needed */
         server_stop_servers(sb);
 
         /* If they wanted the mgs to stop separately from the mdt, they
index 1743e65..70256c6 100644 (file)
@@ -1513,7 +1513,7 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf,
         label = fsfilt_label(obd, obd->u.obt.obt_sb);
 
         if (obd->obd_recovering) {
-                LCONSOLE_WARN("OST %s now serving %s (%s%s%s), but will be in"
+                LCONSOLE_WARN("OST %s now serving %s (%s%s%s), but will be in "
                               "recovery until %d %s reconnect, or if no clients"
                               " reconnect for %d:%.02d; during that time new "
                               "clients will not be allowed to connect. "