Whamcloud - gitweb
Branch: HEAD
[fs/lustre-release.git] / lustre / obdclass / obd_config.c
index b61a28e..a0b582c 100644 (file)
@@ -37,7 +37,7 @@
 #endif
 #include <linux/lustre_log.h>
 #include <linux/lprocfs_status.h>
-#include <portals/list.h>
+#include <libcfs/list.h>
 
 
 /* Create a new device and set the type, name and uuid.  If
@@ -50,39 +50,26 @@ static int class_attach(struct lustre_cfg *lcfg)
         char *typename, *name, *uuid;
         int rc, len, cleanup_phase = 0;
 
-        if (!lcfg->lcfg_inllen1 || !lcfg->lcfg_inlbuf1) {
+        if (!LUSTRE_CFG_BUFLEN(lcfg, 1)) {
                 CERROR("No type passed!\n");
                 RETURN(-EINVAL);
         }
-        if (lcfg->lcfg_inlbuf1[lcfg->lcfg_inllen1 - 1] != 0) {
-                CERROR("Type not nul terminated!\n");
-                RETURN(-EINVAL);
-        }
-        typename = lcfg->lcfg_inlbuf1;
+        typename = lustre_cfg_string(lcfg, 1);
 
-        if (!lcfg->lcfg_dev_namelen || !lcfg->lcfg_dev_name) {
+        if (!LUSTRE_CFG_BUFLEN(lcfg, 0)) {
                 CERROR("No name passed!\n");
                 RETURN(-EINVAL);
         }
-        if (lcfg->lcfg_dev_name[lcfg->lcfg_dev_namelen - 1] != 0) {
-                CERROR("Name not nul terminated!\n");
-                RETURN(-EINVAL);
-        }
-        name = lcfg->lcfg_dev_name;
+        name = lustre_cfg_string(lcfg, 0);
 
-        if (!lcfg->lcfg_inllen2 || !lcfg->lcfg_inlbuf2) {
+        if (!LUSTRE_CFG_BUFLEN(lcfg, 2)) {
                 CERROR("No UUID passed!\n");
                 RETURN(-EINVAL);
         }
-        if (lcfg->lcfg_inlbuf2[lcfg->lcfg_inllen2 - 1] != 0) {
-                CERROR("UUID not nul terminated!\n");
-                RETURN(-EINVAL);
-        }
-        uuid = lcfg->lcfg_inlbuf2;
+        uuid = lustre_cfg_string(lcfg, 2);
 
-        CDEBUG(D_IOCTL, "attach type %s name: %s uuid: %s\n",
-               MKSTR(lcfg->lcfg_inlbuf1),
-               MKSTR(lcfg->lcfg_dev_name), MKSTR(lcfg->lcfg_inlbuf2));
+        CDEBUG(D_CONFIG, "attach type %s name: %s uuid: %s\n",
+               MKSTR(typename), MKSTR(name), MKSTR(uuid));
 
         /* find the type */
         type = class_get_type(typename);
@@ -116,8 +103,9 @@ static int class_attach(struct lustre_cfg *lcfg)
         init_timer(&obd->obd_recovery_timer);
         spin_lock_init(&obd->obd_processing_task_lock);
         init_waitqueue_head(&obd->obd_next_transno_waitq);
-        INIT_LIST_HEAD(&obd->obd_recovery_queue);
-        INIT_LIST_HEAD(&obd->obd_delayed_reply_queue);
+        INIT_LIST_HEAD(&obd->obd_req_replay_queue);
+        INIT_LIST_HEAD(&obd->obd_lock_replay_queue);
+        INIT_LIST_HEAD(&obd->obd_final_req_queue);
 
         spin_lock_init(&obd->obd_uncommitted_replies_lock);
         INIT_LIST_HEAD(&obd->obd_uncommitted_replies);
@@ -158,7 +146,6 @@ static int class_attach(struct lustre_cfg *lcfg)
                 class_release_dev(obd);
         case 1:
                 class_put_type(type);
-                obd->obd_type = NULL;
         }
         return rc;
 }
@@ -274,9 +261,8 @@ static int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
                 CERROR("Device %d not setup\n", obd->obd_minor);
                 RETURN(-ENODEV);
         }
-
-        if (lcfg->lcfg_inlbuf1) {
-                for (flag = lcfg->lcfg_inlbuf1; *flag != 0; flag++)
+        if (LUSTRE_CFG_BUFLEN(lcfg, 1) > 0) {
+                 for (flag = lustre_cfg_string(lcfg, 1); *flag != 0; flag++)
                         switch (*flag) {
                         case 'F':
                                 flags |= OBD_OPT_FORCE;
@@ -308,6 +294,7 @@ static int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
                         CERROR("OBD device %d (%p,%s) has refcount %d\n",
                                obd->obd_minor, obd, obd->obd_name,
                                atomic_read(&obd->obd_refcount));
+                        portals_debug_dumplog();
                         dump_exports(obd);
                         GOTO(out, err = -EBUSY);
                 }
@@ -359,20 +346,17 @@ int class_add_conn(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
         struct obd_import *imp;
         struct obd_uuid uuid;
-        int priority, rc;
+        int rc;
         ENTRY;
 
-        if (lcfg->lcfg_inllen1 <= 0 ||
-            lcfg->lcfg_inllen1 > sizeof(struct obd_uuid)) {
+        if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1 ||
+            LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(struct obd_uuid)) {
                 CERROR("invalid conn_uuid\n");
                 RETURN(-EINVAL);
         }
-        if (lcfg->lcfg_inllen2 != sizeof(int)) {
-                CERROR("invalid priority\n");
-                RETURN(-EINVAL);
-        }
-        if (strcmp(obd->obd_type->typ_name, "mdc") &&
-            strcmp(obd->obd_type->typ_name, "osc")) {
+
+        if (strcmp(obd->obd_type->typ_name, OBD_MDC_DEVICENAME) &&
+            strcmp(obd->obd_type->typ_name, OBD_OSC_DEVICENAME)) {
                 CERROR("can't add connection on non-client dev\n");
                 RETURN(-EINVAL);
         }
@@ -383,12 +367,12 @@ int class_add_conn(struct obd_device *obd, struct lustre_cfg *lcfg)
                 RETURN(-EINVAL);
         }
 
-        obd_str2uuid(&uuid, lcfg->lcfg_inlbuf1);
-        priority = *((int*) lcfg->lcfg_inlbuf2);
-        rc = obd_add_conn(imp, &uuid, priority);
+        obd_str2uuid(&uuid, lustre_cfg_string(lcfg, 1));
+        rc = obd_add_conn(imp, &uuid, lcfg->lcfg_num);
 
         RETURN(rc);
 }
+
 int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
         struct obd_import *imp;
@@ -396,13 +380,14 @@ int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg)
         int rc;
         ENTRY;
 
-        if (lcfg->lcfg_inllen1 <= 0 ||
-            lcfg->lcfg_inllen1 > sizeof(struct obd_uuid)) {
+        if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1 ||
+            LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(struct obd_uuid)) {
                 CERROR("invalid conn_uuid\n");
                 RETURN(-EINVAL);
         }
-        if (strcmp(obd->obd_type->typ_name, "mdc") &&
-            strcmp(obd->obd_type->typ_name, "osc")) {
+
+        if (strcmp(obd->obd_type->typ_name, OBD_MDC_DEVICENAME) &&
+            strcmp(obd->obd_type->typ_name, OBD_OSC_DEVICENAME)) {
                 CERROR("can't add connection on non-client dev\n");
                 RETURN(-EINVAL);
         }
@@ -413,7 +398,7 @@ int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg)
                 RETURN(-EINVAL);
         }
 
-        obd_str2uuid(&uuid, lcfg->lcfg_inlbuf1);
+        obd_str2uuid(&uuid, lustre_cfg_string(lcfg, 1));
         rc = obd_del_conn(imp, &uuid);
 
         RETURN(rc);
@@ -435,7 +420,8 @@ struct lustre_profile *class_get_profile(char * prof)
 
 int class_add_profile(int proflen, char *prof,
                       int lovlen, char *lov,
-                      int lmvlen, char *lmv)
+                      int lmvlen, char *lmv,
+                      int gkclen, char *gkc)
 {
         struct lustre_profile *lprof;
         int err = 0;
@@ -464,9 +450,15 @@ int class_add_profile(int proflen, char *prof,
                         GOTO(out, err = -ENOMEM);
                 memcpy(lprof->lp_lmv, lmv, lmvlen);
         }
-
+        if (gkclen > 0 ) {
+                LASSERT(gkclen == (strlen(gkc) + 1));
+                OBD_ALLOC(lprof->lp_gkc, gkclen);
+                if (lprof->lp_gkc == NULL)
+                        GOTO(out, err = -ENOMEM);
+                memcpy(lprof->lp_gkc, gkc, gkclen);
+        }
+        
         list_add(&lprof->lp_list, &lustre_profile_list);
-
 out:
         RETURN(err);
 }
@@ -482,6 +474,8 @@ void class_del_profile(char *prof)
                 OBD_FREE(lprof->lp_lov, strlen(lprof->lp_lov) + 1);
                 if (lprof->lp_lmv)
                         OBD_FREE(lprof->lp_lmv, strlen(lprof->lp_lmv) + 1);
+                if (lprof->lp_gkc)
+                        OBD_FREE(lprof->lp_gkc, strlen(lprof->lp_gkc) + 1);
                 OBD_FREE(lprof, sizeof *lprof);
         }
 }
@@ -495,7 +489,7 @@ int class_process_config(struct lustre_cfg *lcfg)
 
         LASSERT(lcfg && !IS_ERR(lcfg));
 
-        CDEBUG(D_IOCTL, "processing cmd: %x\n", lcfg->lcfg_command);
+        CDEBUG(D_CONFIG, "processing cmd: %x\n", lcfg->lcfg_command);
 
         /* Commands that don't need a device */
         switch(lcfg->lcfg_command) {
@@ -504,66 +498,77 @@ int class_process_config(struct lustre_cfg *lcfg)
                 GOTO(out, err);
         }
         case LCFG_ADD_UUID: {
-                CDEBUG(D_IOCTL, "adding mapping from uuid %s to nid "LPX64
-                       " (%s), nal %d\n", lcfg->lcfg_inlbuf1, lcfg->lcfg_nid,
+                CDEBUG(D_CONFIG, "adding mapping from uuid %s to nid "LPX64
+                       " (%s), nal %x\n", lustre_cfg_string(lcfg, 1),
+                       lcfg->lcfg_nid,
                        portals_nid2str(lcfg->lcfg_nal, lcfg->lcfg_nid, str),
                        lcfg->lcfg_nal);
 
-                err = class_add_uuid(lcfg->lcfg_inlbuf1, lcfg->lcfg_nid,
-                                     lcfg->lcfg_nal);
-                GOTO(out, err);
+               err = class_add_uuid(lustre_cfg_string(lcfg, 1), lcfg->lcfg_nid,
+                                    lcfg->lcfg_nal);
+               GOTO(out, err);
         }
         case LCFG_DEL_UUID: {
-                CDEBUG(D_IOCTL, "removing mappings for uuid %s\n",
-                       lcfg->lcfg_inlbuf1 == NULL ? "<all uuids>" :
-                       lcfg->lcfg_inlbuf1);
+                CDEBUG(D_CONFIG, "removing mappings for uuid %s\n",
+                       (lcfg->lcfg_bufcount < 2 || LUSTRE_CFG_BUFLEN(lcfg, 1) == 0)
+                       ? "<all uuids>" : lustre_cfg_string(lcfg, 1));
 
-                err = class_del_uuid(lcfg->lcfg_inlbuf1);
+                err = class_del_uuid(lustre_cfg_string(lcfg, 1));
                 GOTO(out, err);
         }
         case LCFG_MOUNTOPT: {
-                CDEBUG(D_IOCTL, "mountopt: profile %s osc %s mdc %s\n",
-                       lcfg->lcfg_inlbuf1, lcfg->lcfg_inlbuf2,
-                       lcfg->lcfg_inlbuf3);
+                CDEBUG(D_CONFIG, "mountopt: profile %s osc %s mdc %s gkc %s \n",
+                       lustre_cfg_string(lcfg, 1),
+                       lustre_cfg_string(lcfg, 2),
+                       lustre_cfg_string(lcfg, 3),
+                       lustre_cfg_string(lcfg, 4));
                 /* set these mount options somewhere, so ll_fill_super
                  * can find them. */
-                err = class_add_profile(lcfg->lcfg_inllen1, lcfg->lcfg_inlbuf1,
-                                        lcfg->lcfg_inllen2, lcfg->lcfg_inlbuf2,
-                                        lcfg->lcfg_inllen3, lcfg->lcfg_inlbuf3);
+                err = class_add_profile(LUSTRE_CFG_BUFLEN(lcfg, 1),
+                                        lustre_cfg_string(lcfg, 1),
+                                        LUSTRE_CFG_BUFLEN(lcfg, 2),
+                                        lustre_cfg_string(lcfg, 2),
+                                        LUSTRE_CFG_BUFLEN(lcfg, 3),
+                                        lustre_cfg_string(lcfg, 3),
+                                        LUSTRE_CFG_BUFLEN(lcfg, 4),
+                                        lustre_cfg_string(lcfg, 4));
                 GOTO(out, err);
         }
         case LCFG_DEL_MOUNTOPT: {
-                CDEBUG(D_IOCTL, "mountopt: profile %s\n", lcfg->lcfg_inlbuf1);
+                CDEBUG(D_CONFIG, "mountopt: profile %s\n",
+                       lustre_cfg_string(lcfg, 1));
                 /* set these mount options somewhere, so ll_fill_super
                  * can find them. */
-                class_del_profile(lcfg->lcfg_inlbuf1);
+                class_del_profile(lustre_cfg_string(lcfg, 1));
                 GOTO(out, err = 0);
         }
         case LCFG_SET_TIMEOUT: {
-                CDEBUG(D_IOCTL, "changing lustre timeout from %d to %d\n",
+                CDEBUG(D_CONFIG, "changing lustre timeout from %d to %d\n",
                        obd_timeout,
                        lcfg->lcfg_num);
                 obd_timeout = lcfg->lcfg_num;
                 GOTO(out, err = 0);
         }
         case LCFG_SET_UPCALL: {
-                CDEBUG(D_IOCTL, "setting lustre ucpall to: %s\n",
-                       lcfg->lcfg_inlbuf1);
-                if (lcfg->lcfg_inllen1 > sizeof obd_lustre_upcall)
+                CDEBUG(D_CONFIG, "setting lustre ucpall to: %s\n",
+                       lustre_cfg_string(lcfg, 1));
+                if (LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof obd_lustre_upcall)
                         GOTO(out, err = -EINVAL);
-                memcpy(obd_lustre_upcall, lcfg->lcfg_inlbuf1,
-                       lcfg->lcfg_inllen1);
+                strncpy(obd_lustre_upcall, lustre_cfg_string(lcfg, 1),
+                        sizeof (obd_lustre_upcall));
                 GOTO(out, err = 0);
         }
         }
-
+        
         /* Commands that require a device */
-        obd = class_name2obd(lcfg->lcfg_dev_name);
+        obd = class_name2obd(lustre_cfg_string(lcfg, 0));
         if (obd == NULL) {
-                if (lcfg->lcfg_dev_name == NULL)
-                        CERROR("this lcfg command requires a device name\n");
+                if (!LUSTRE_CFG_BUFLEN(lcfg, 0))
+                        CERROR("this lcfg command %d requires a device name\n", 
+                               lcfg->lcfg_command);
                 else
-                        CERROR("no device for: %s\n", lcfg->lcfg_dev_name);
+                        CERROR("no device for: %s\n",
+                               lustre_cfg_string(lcfg, 0));
 
                 GOTO(out, err = -EINVAL);
         }
@@ -596,7 +601,7 @@ int class_process_config(struct lustre_cfg *lcfg)
         }
         }
 out:
-        RETURN(err);
+        return err;
 }
 
 static int class_config_parse_handler(struct llog_handle * handle,
@@ -609,56 +614,63 @@ static int class_config_parse_handler(struct llog_handle * handle,
         ENTRY;
 
         if (rec->lrh_type == OBD_CFG_REC) {
-                char *buf;
-                struct lustre_cfg *lcfg;
-                char *old_name = NULL;
-                int old_len = 0;
-                char *old_uuid = NULL;
-                int old_uuid_len = 0;
+                struct lustre_cfg *lcfg, *lcfg_new;
+                struct lustre_cfg_bufs bufs;
                 char *inst_name = NULL;
                 int inst_len = 0;
 
-                rc = lustre_cfg_getdata(&buf, cfg_len, cfg_buf, 1);
+                lcfg = (struct lustre_cfg *)cfg_buf;
+                if (lcfg->lcfg_version == __swab32(LUSTRE_CFG_VERSION))
+                        lustre_swab_lustre_cfg(lcfg);
+
+                rc = lustre_cfg_sanity_check(cfg_buf, cfg_len);
                 if (rc)
                         GOTO(out, rc);
-                lcfg = (struct lustre_cfg* ) buf;
-
-                if (cfg && cfg->cfg_instance && lcfg->lcfg_dev_name) {
-                        inst_len = strlen(lcfg->lcfg_dev_name) +
-                                strlen(cfg->cfg_instance) + 2;
-                        OBD_ALLOC(inst_name, inst_len);
-                        if (inst_name == NULL)
-                                GOTO(out, rc = -ENOMEM);
-                        sprintf(inst_name, "%s-%s", lcfg->lcfg_dev_name,
-                                cfg->cfg_instance);
-                        old_name = lcfg->lcfg_dev_name;
-                        old_len = lcfg->lcfg_dev_namelen;
-                        lcfg->lcfg_dev_name = inst_name;
-                        lcfg->lcfg_dev_namelen = strlen(inst_name) + 1;
-                }
-
-                if (cfg && lcfg->lcfg_command == LCFG_ATTACH) {
-                        old_uuid = lcfg->lcfg_inlbuf2;
-                        old_uuid_len = lcfg->lcfg_inllen2;
 
-                        lcfg->lcfg_inlbuf2 = (char*)&cfg->cfg_uuid.uuid;
-                        lcfg->lcfg_inllen2 = sizeof(cfg->cfg_uuid);
+                lustre_cfg_bufs_init(&bufs, lcfg);
+                if (cfg && cfg->cfg_instance) {
+                        if (LUSTRE_CFG_BUFLEN(lcfg, 0) > 0) {
+                                inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) +
+                                        strlen(cfg->cfg_instance) + 1;
+                                OBD_ALLOC(inst_name, inst_len);
+                                if (inst_name == NULL)
+                                        GOTO(out, rc = -ENOMEM);
+                                sprintf(inst_name, "%s-%s",
+                                        lustre_cfg_string(lcfg, 0),
+                                        cfg->cfg_instance);
+                                lustre_cfg_bufs_set_string(&bufs, 0, inst_name);
+                        }
+                        if (lcfg->lcfg_command == LCFG_SETUP) {
+                                /*add cfg_instance to the end of lcfg buffers*/
+                                lustre_cfg_bufs_set_string(&bufs,
+                                                           bufs.lcfg_bufcount, 
+                                                           cfg->cfg_instance); 
+                        }
                 }
 
-                rc = class_process_config(lcfg);
-
-                if (old_name) {
-                        lcfg->lcfg_dev_name = old_name;
-                        lcfg->lcfg_dev_namelen = old_len;
-                        OBD_FREE(inst_name, inst_len);
+                if (cfg && (lcfg->lcfg_command == LCFG_ATTACH)){
+                        /*Very Dirty Hack fix here, for mds add, 
+                         *the mdc in mds should not 
+                         *change uuid FIXME: Wangdi
+                         */
+                         if (memcmp(lustre_cfg_string(lcfg, 1), OBD_MDC_DEVICENAME, 
+                                    strlen(OBD_MDC_DEVICENAME)) || 
+                             (cfg->cfg_flags & CFG_MODIFY_UUID_FL))
+                                lustre_cfg_bufs_set_string(&bufs, 2,
+                                                   (char *)cfg->cfg_uuid.uuid);
                 }
+                lcfg_new = lustre_cfg_new(lcfg->lcfg_command, &bufs);
 
-                if (old_uuid) {
-                        lcfg->lcfg_inlbuf2 = old_uuid;
-                        lcfg->lcfg_inllen2 = old_uuid_len;
-                }
+                lcfg_new->lcfg_num   = lcfg->lcfg_num;
+                lcfg_new->lcfg_flags = lcfg->lcfg_flags;
+                lcfg_new->lcfg_nid   = lcfg->lcfg_nid;
+                lcfg_new->lcfg_nal   = lcfg->lcfg_nal;
 
-                lustre_cfg_freedata(buf, cfg_len);
+                rc = class_process_config(lcfg_new);
+                lustre_cfg_free(lcfg_new);
+
+                if (inst_name)
+                        OBD_FREE(inst_name, inst_len);
         } else if (rec->lrh_type == PTL_CFG_REC) {
                 struct portals_cfg *pcfg = (struct portals_cfg *)cfg_buf;
                 if (pcfg->pcfg_command == NAL_CMD_REGISTER_MYNID &&
@@ -696,29 +708,28 @@ int class_config_process_llog(struct llog_ctxt *ctxt, char *name,
         RETURN(rc);
 }
 
-static int class_config_dump_handler(struct llog_handle * handle,
-                                     struct llog_rec_hdr *rec, void *data)
+int class_config_dump_handler(struct llog_handle * handle,
+                              struct llog_rec_hdr *rec, void *data)
 {
         int cfg_len = rec->lrh_len;
         char *cfg_buf = (char*) (rec + 1);
         int rc = 0;
         ENTRY;
-
         if (rec->lrh_type == OBD_CFG_REC) {
-                char *buf;
                 struct lustre_cfg *lcfg;
+                int i;
 
-                rc = lustre_cfg_getdata(&buf, cfg_len, cfg_buf, 1);
+                rc = lustre_cfg_sanity_check(cfg_buf, cfg_len);
                 if (rc)
                         GOTO(out, rc);
-                lcfg = (struct lustre_cfg* ) buf;
+                lcfg = (struct lustre_cfg *)cfg_buf;
 
-                CDEBUG(D_INFO, "lcfg command: 0x%x\n", lcfg->lcfg_command);
-                if (lcfg->lcfg_dev_name)
+                CDEBUG(D_INFO, "lcfg command: %x\n", lcfg->lcfg_command);
+                if (LUSTRE_CFG_BUFLEN(lcfg, 0) > 0)
                         CDEBUG(D_INFO, "     devname: %s\n",
-                               lcfg->lcfg_dev_name);
+                               lustre_cfg_string(lcfg, 0));
                 if (lcfg->lcfg_flags)
-                        CDEBUG(D_INFO, "       flags: 0x%x\n", lcfg->lcfg_flags);
+                        CDEBUG(D_INFO, "       flags: %x\n", lcfg->lcfg_flags);
                 if (lcfg->lcfg_nid)
                         CDEBUG(D_INFO, "         nid: "LPX64"\n",
                                lcfg->lcfg_nid);
@@ -726,47 +737,36 @@ static int class_config_dump_handler(struct llog_handle * handle,
                         CDEBUG(D_INFO, "         nal: %x\n", lcfg->lcfg_nal);
                 if (lcfg->lcfg_num)
                         CDEBUG(D_INFO, "         nal: %x\n", lcfg->lcfg_num);
-                if (lcfg->lcfg_inlbuf1)
-                        CDEBUG(D_INFO, "     inlbuf1: %s\n",lcfg->lcfg_inlbuf1);
-                if (lcfg->lcfg_inlbuf2)
-                        CDEBUG(D_INFO, "     inlbuf2: %s\n",lcfg->lcfg_inlbuf2);
-                if (lcfg->lcfg_inlbuf3)
-                        CDEBUG(D_INFO, "     inlbuf3: %s\n",lcfg->lcfg_inlbuf3);
-                if (lcfg->lcfg_inlbuf4)
-                        CDEBUG(D_INFO, "     inlbuf4: %s\n",lcfg->lcfg_inlbuf4);
-                if (lcfg->lcfg_inlbuf5)
-                        CDEBUG(D_INFO, "     inlbuf5: %s\n",lcfg->lcfg_inlbuf5);
-                if (lcfg->lcfg_inlbuf6)
-                        CDEBUG(D_INFO, "     inlbuf6: %s\n",lcfg->lcfg_inlbuf6);
-
-                lustre_cfg_freedata(buf, cfg_len);
+                for (i = 1; i < lcfg->lcfg_bufcount; i++)
+                        if (LUSTRE_CFG_BUFLEN(lcfg, i) > 0)
+                                CDEBUG(D_INFO, "     inlbuf%d: %s\n", i,
+                                       lustre_cfg_string(lcfg, i));
         } else if (rec->lrh_type == PTL_CFG_REC) {
                 struct portals_cfg *pcfg = (struct portals_cfg *)cfg_buf;
-
-                CDEBUG(D_INFO, "pcfg command: 0x%x\n", pcfg->pcfg_command);
+                CDEBUG(D_INFO, "pcfg command: %d\n", pcfg->pcfg_command);
                 if (pcfg->pcfg_nal)
-                        CDEBUG(D_INFO, "         nal: %d\n",
+                        CDEBUG(D_INFO, "         nal: %x\n",
                                pcfg->pcfg_nal);
                 if (pcfg->pcfg_gw_nal)
-                        CDEBUG(D_INFO, "      gw_nal: %d\n",
+                        CDEBUG(D_INFO, "      gw_nal: %x\n",
                                pcfg->pcfg_gw_nal);
                 if (pcfg->pcfg_nid)
                         CDEBUG(D_INFO, "         nid: "LPX64"\n",
                                pcfg->pcfg_nid);
                 if (pcfg->pcfg_nid2)
-                        CDEBUG(D_INFO, "        nid2: "LPX64"\n",
+                        CDEBUG(D_INFO, "         nid: "LPX64"\n",
                                pcfg->pcfg_nid2);
                 if (pcfg->pcfg_nid3)
-                        CDEBUG(D_INFO, "        nid3: "LPX64"\n",
+                        CDEBUG(D_INFO, "         nid: "LPX64"\n",
                                pcfg->pcfg_nid3);
                 if (pcfg->pcfg_misc)
-                        CDEBUG(D_INFO, "        misc: %d\n",
+                        CDEBUG(D_INFO, "         nid: %d\n",
                                pcfg->pcfg_misc);
                 if (pcfg->pcfg_id)
-                        CDEBUG(D_INFO, "          id: 0x%x\n",
+                        CDEBUG(D_INFO, "          id: %x\n",
                                pcfg->pcfg_id);
                 if (pcfg->pcfg_flags)
-                        CDEBUG(D_INFO, "       flags: 0x%x\n",
+                        CDEBUG(D_INFO, "       flags: %x\n",
                                pcfg->pcfg_flags);
         } else {
                 CERROR("unhandled lrh_type: %#x\n", rec->lrh_type);