* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
fsdb->fsdb_mdt_count ++;
}
- if (mti->mti_stripe_index >= INDEX_MAP_SIZE * 8) {
- LCONSOLE_ERROR_MSG(0x13f, "Server %s requested index %d, "
- "but the max index is %d.\n",
- mti->mti_svname, mti->mti_stripe_index,
- INDEX_MAP_SIZE * 8);
+ /* the last index(0xffff) is reserved for default value. */
+ if (mti->mti_stripe_index >= INDEX_MAP_SIZE * 8 - 1) {
+ LCONSOLE_ERROR_MSG(0x13f, "Server %s requested index %u, "
+ "but index must be less than %u.\n",
+ mti->mti_svname, mti->mti_stripe_index,
+ INDEX_MAP_SIZE * 8 - 1);
GOTO(out_up, rc = -ERANGE);
- }
+ }
if (test_bit(mti->mti_stripe_index, imap)) {
if ((mti->mti_flags & LDD_F_VIRGIN) &&
}
/* write the lcfg in all logs for the given fs */
-int mgs_write_log_direct_all(const struct lu_env *env, struct mgs_device *mgs,
- struct fs_db *fsdb, struct mgs_target_info *mti,
- struct llog_cfg_rec *lcr, char *devname,
- char *comment, int server_only)
+static int mgs_write_log_direct_all(const struct lu_env *env,
+ struct mgs_device *mgs,
+ struct fs_db *fsdb,
+ struct mgs_target_info *mti,
+ struct llog_cfg_rec *lcr, char *devname,
+ char *comment, int server_only)
{
struct list_head log_list;
struct mgs_direntry *dirent, *n;
if (server_only && strstr(dirent->mde_name, "-client") != NULL)
goto next;
- if (strncmp(fsname, dirent->mde_name, len) != 0)
+ if (strlen(dirent->mde_name) <= len ||
+ strncmp(fsname, dirent->mde_name, len) != 0 ||
+ dirent->mde_name[len] != '-')
goto next;
CDEBUG(D_MGS, "Changing log %s\n", dirent->mde_name);
#07 L add_conn 0:OSC_uml1_ost1_mdsA 1:uml2_UUID
*/
- /* Pull failnid info out of params string */
+ /*
+ * Pull failnid info out of params string, which may contain something
+ * like "<nid1>,<nid2>:<nid3>,<nid4>". class_parse_nid() does not
+ * complain about abnormal inputs like ",:<nid1>", "<nid1>:,<nid2>",
+ * etc. However, convert_hostnames() should have caught those.
+ */
while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) {
while (class_parse_nid(ptr, &nid, &ptr) == 0) {
if (failnodeuuid == NULL) {
"client %s\n", libcfs_nid2str(nid),
failnodeuuid, cliname);
rc = record_add_uuid(env, llh, nid, failnodeuuid);
- }
+ /*
+ * If *ptr is ':', we have added all NIDs for
+ * failnodeuuid.
+ */
+ if (*ptr == ':') {
+ rc = record_add_conn(env, llh, cliname,
+ failnodeuuid);
+ name_destroy(&failnodeuuid);
+ failnodeuuid = NULL;
+ }
+ }
if (failnodeuuid) {
rc = record_add_conn(env, llh, cliname, failnodeuuid);
name_destroy(&failnodeuuid);
failnodeuuid = NULL;
}
- }
+ }
- return rc;
+ return rc;
}
static int mgs_write_log_mdc_to_lmv(const struct lu_env *env,
int mgs_nodemap_cmd(const struct lu_env *env, struct mgs_device *mgs,
enum lcfg_command_type cmd, const char *nodemap_name,
- const char *param)
+ char *param)
{
lnet_nid_t nid[2];
__u32 idmap[2];