config_log_put(cld_params);
}
- if (cld_nodemap) {
- mutex_lock(&cld_nodemap->cld_lock);
- cld_nodemap->cld_stopping = 1;
- mutex_unlock(&cld_nodemap->cld_lock);
+ /* don't set cld_stopping on nm lock as other targets may be active */
+ if (cld_nodemap)
config_log_put(cld_nodemap);
- }
/* drop the ref from the find */
config_log_put(cld);
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);
}
struct lu_nodemap *nodemap_classify_nid(lnet_nid_t nid);
void nm_member_reclassify_nodemap(struct lu_nodemap *nodemap);
void nm_member_revoke_locks(struct lu_nodemap *nodemap);
+void nm_member_revoke_locks_always(struct lu_nodemap *nodemap);
void nm_member_revoke_all(void);
int nodemap_add_idmap_helper(struct lu_nodemap *nodemap,
list_add(&exp->exp_target_data.ted_nodemap_member,
&new_nodemap->nm_member_list);
mutex_unlock(&new_nodemap->nm_member_list_lock);
- nm_member_exp_revoke(exp);
+
+ if (nodemap_active)
+ nm_member_exp_revoke(exp);
} else {
nodemap_putref(new_nodemap);
}
}
/**
- * Revoke the locks for member exports. Changing the idmap is
- * akin to deleting the security context. If the locks are not
- * canceled, the client could cache permissions that are no
- * longer correct with the map.
+ * Revoke the locks for member exports if nodemap system is active.
+ *
+ * Changing the idmap is akin to deleting the security context. If the locks
+ * are not canceled, the client could cache permissions that are no longer
+ * correct with the map.
*
* \param nodemap nodemap that has been altered
*/
void nm_member_revoke_locks(struct lu_nodemap *nodemap)
{
+ if (!nodemap_active)
+ return;
+
+ nm_member_revoke_locks_always(nodemap);
+}
+
+void nm_member_revoke_locks_always(struct lu_nodemap *nodemap)
+{
struct obd_export *exp;
struct obd_export *tmp;