X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnodemap_handler.c;h=59b17349259b351e66e55a0829fe4b015070f74f;hp=a416c902fa513abffc6078ed78358575dc71aa18;hb=be7efb4ce06996444c08914305a73833a7123eeb;hpb=1ce1032a03dd26345e662164b7877079c54468f5 diff --git a/lustre/ptlrpc/nodemap_handler.c b/lustre/ptlrpc/nodemap_handler.c index a416c90..59b1734 100644 --- a/lustre/ptlrpc/nodemap_handler.c +++ b/lustre/ptlrpc/nodemap_handler.c @@ -1399,9 +1399,13 @@ void nodemap_config_dealloc(struct nodemap_config *config) } 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; @@ -1415,6 +1419,7 @@ void nodemap_config_set_active(struct nodemap_config *config) struct nodemap_config *old_config = active_config; struct lu_nodemap *nodemap; struct lu_nodemap *tmp; + bool revoke_locks; LIST_HEAD(nodemap_list_head); ENTRY; @@ -1445,6 +1450,14 @@ void nodemap_config_set_active(struct nodemap_config *config) } } + /* + * 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; @@ -1457,7 +1470,8 @@ void nodemap_config_set_active(struct nodemap_config *config) if (old_config != NULL) nodemap_config_dealloc(old_config); - nm_member_revoke_all(); + if (revoke_locks) + nm_member_revoke_all(); EXIT; } @@ -1519,7 +1533,7 @@ void nm_member_revoke_all(void) /* 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); }