Whamcloud - gitweb
LU-1399 config: check lustre_cfg_new() return
[fs/lustre-release.git] / lustre / utils / obd.c
index 235e785..20ec5f4 100644 (file)
@@ -52,6 +52,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <getopt.h>
 #include <glob.h>
 #include <signal.h>
 #include <stdarg.h>
@@ -64,7 +65,7 @@
 
 #include "obdctl.h"
 #include <libcfs/libcfs.h>
-#include <lnet/lnet.h>
+#include <lnet/nidstr.h>
 #include <lustre/lustre_idl.h>
 #include <lustre_cfg.h>
 #include <lustre_ioctl.h>
@@ -3208,9 +3209,9 @@ static int pool_cmd(enum lcfg_command_type cmd,
         if (ostname != NULL)
                 lustre_cfg_bufs_set_string(&bufs, 2, ostname);
 
-        lcfg = lustre_cfg_new(cmd, &bufs);
+       lcfg = lustre_cfg_new(cmd, &bufs);
        if (lcfg == NULL)
-               return rc;
+               return -ENOMEM;
 
         memset(&data, 0, sizeof(data));
         rc = data.ioc_dev = get_mgs_device();
@@ -3227,6 +3228,7 @@ static int pool_cmd(enum lcfg_command_type cmd,
         if (rc) {
                 fprintf(stderr, "error: %s: invalid ioctl\n",
                         jt_cmdname(cmdname));
+               lustre_cfg_free(lcfg);
                 return rc;
         }
         rc = l_ioctl(OBD_DEV_ID, OBD_IOC_POOL, buf);
@@ -3740,8 +3742,10 @@ int jt_nodemap_modify(int argc, char **argv)
        }
 
        if (nodemap_name == NULL || param == NULL || value == NULL) {
-               fprintf(stderr, "usage: nodemap_modify --name <name> "
-                               "--property <range> --value <value>\n");
+               fprintf(stderr, "usage: nodemap_modify --name <nodemap_name> "
+                               "--property <property_name> --value <value>\n");
+               fprintf(stderr, "valid properties: admin trusted "
+                               "squash_uid squash_gid\n");
                return -1;
        }
 
@@ -3908,7 +3912,7 @@ int jt_nodemap_del_idmap(int argc, char **argv)
        rc = nodemap_cmd(cmd, NULL, 0, argv[0], nodemap_name, idmap, NULL);
        if (rc != 0) {
                errno = -rc;
-               fprintf(stderr, "cannot add %smap '%s' to nodemap '%s'"
+               fprintf(stderr, "cannot delete %smap '%s' from nodemap '%s'"
                        ": rc = %d\n", idtype, idmap, nodemap_name, rc);
        }