Adding nodemap_mgs() function allows to know if nodemaps are defined
on an MGS node (pointer to a nodemap config file) or not.
Test-Parameters: trivial
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Id87e34dd8d13cd21c88c87ef9e8e91ff9ff142c8
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54506
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
struct hlist_node *hnode,
void *nodemap_list_head);
struct hlist_node *hnode,
void *nodemap_list_head);
int nodemap_idx_nodemap_add(const struct lu_nodemap *nodemap);
int nodemap_idx_nodemap_update(const struct lu_nodemap *nodemap);
int nodemap_idx_nodemap_del(const struct lu_nodemap *nodemap);
int nodemap_idx_nodemap_add(const struct lu_nodemap *nodemap);
int nodemap_idx_nodemap_update(const struct lu_nodemap *nodemap);
int nodemap_idx_nodemap_del(const struct lu_nodemap *nodemap);
/* MGS index is different than others, others are listeners to MGS idx */
static struct nm_config_file *nodemap_mgs_ncf;
/* MGS index is different than others, others are listeners to MGS idx */
static struct nm_config_file *nodemap_mgs_ncf;
+bool nodemap_mgs(void)
+{
+ return (nodemap_mgs_ncf != NULL);
+}
+
static void nodemap_cluster_key_init(struct nodemap_key *nk, unsigned int nm_id,
enum nodemap_cluster_rec_subid subid)
{
static void nodemap_cluster_key_init(struct nodemap_key *nk, unsigned int nm_id,
enum nodemap_cluster_rec_subid subid)
{
ENTRY;
if (idx == NULL) {
ENTRY;
if (idx == NULL) {
- if (nodemap_mgs_ncf == NULL) {
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
- if (nodemap_mgs_ncf == NULL) {
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
- if (nodemap_mgs_ncf == NULL) {
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
- if (nodemap_mgs_ncf == NULL) {
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
- if (nodemap_mgs_ncf == NULL) {
- CERROR("cannot add nodemap config to non-existing MGS.\n");
+ if (!nodemap_mgs()) {
+ CERROR("cannot del nodemap config from non-existing MGS.\n");
- if (nodemap_mgs_ncf == NULL) {
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
- if (nodemap_mgs_ncf == NULL) {
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
- if (nodemap_mgs_ncf == NULL) {
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
CERROR("cannot add nodemap config to non-existing MGS.\n");
return -EINVAL;
}
- if (nodemap_mgs_ncf != NULL)
GOTO(out, ncf = ERR_PTR(-EEXIST));
OBD_ALLOC_PTR(ncf);
GOTO(out, ncf = ERR_PTR(-EEXIST));
OBD_ALLOC_PTR(ncf);