}
EXPORT_SYMBOL(nodemap_config_dealloc);
-static int nm_hash_list_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd,
- struct hlist_node *hnode,
- void *nodemap_list_head)
+/*
+ * callback for cfs_hash_for_each_safe used to convert a nodemap hash to a
+ * nodemap list, generally for locking purposes as a hash cb can't sleep.
+ */
+int nm_hash_list_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd,
+ struct hlist_node *hnode,
+ void *nodemap_list_head)
{
struct lu_nodemap *nodemap;
struct nodemap_config *old_config = active_config;
struct lu_nodemap *nodemap;
struct lu_nodemap *tmp;
+ bool revoke_locks;
LIST_HEAD(nodemap_list_head);
ENTRY;
}
}
+ /*
+ * We only need to revoke locks if old nodemap was active, and new
+ * config is now nodemap inactive. nodemap_config_dealloc will
+ * reclassify exports, triggering a lock revoke if and only if new
+ * nodemap is active.
+ */
+ revoke_locks = !config->nmc_nodemap_is_active && nodemap_active;
+
/* if new config is inactive, deactivate live config before switching */
if (!config->nmc_nodemap_is_active)
nodemap_active = false;
if (old_config != NULL)
nodemap_config_dealloc(old_config);
- nm_member_revoke_all();
+ if (revoke_locks)
+ nm_member_revoke_all();
EXIT;
}
/* revoke_locks sleeps, so can't call in cfs hash cb */
list_for_each_entry_safe(nodemap, tmp, &nodemap_list_head, nm_list)
- nm_member_revoke_locks(nodemap);
+ nm_member_revoke_locks_always(nodemap);
mutex_unlock(&active_config_lock);
}