-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
+// SPDX-License-Identifier: GPL-2.0
+
/*
* Copyright (C) 2013, Trustees of Indiana University
+ *
* Author: Joshua Walgenbach <jjw@iu.edu>
*/
+
#include <linux/module.h>
#include <lustre_net.h>
#include <obd_class.h>
/**
+ * nm_member_del() - Delete an export from a nodemap's member list
+ * @nodemap: nodemap containing list
+ * @exp: export member to delete
+ *
* Delete an export from a nodemap's member list. Called after client
* disconnects, or during system shutdown.
*
- * Requires active_config_lock and nodemap's nm_member_list_lock.
- *
- * \param nodemap nodemap containing list
- * \param exp export member to delete
+ * Note: Requires active_config_lock and nodemap's nm_member_list_lock.
*/
void nm_member_del(struct lu_nodemap *nodemap, struct obd_export *exp)
{
}
/**
- * Delete a member list from a nodemap
+ * nm_member_delete_list() - Delete a member list from a nodemap
+ * @nodemap: nodemap to remove the list from
*
* Requires active config lock.
- *
- * \param nodemap nodemap to remove the list from
*/
void nm_member_delete_list(struct lu_nodemap *nodemap)
{
}
/**
- * Add a member export to a nodemap
+ * nm_member_add() - Add a member export to a nodemap
+ * @nodemap: nodemap to add to
+ * @exp: obd_export to add
*
* Must be called under active_config_lock.
*
- * \param nodemap nodemap to add to
- * \param exp obd_export to add
- * \retval -EEXIST export is already part of a different nodemap
- * \retval -EINVAL export is NULL
+ * Return:
+ * * %0 on sucessful add
+ * * %-EEXIST export is already part of a different nodemap
+ * * %-EINVAL export is NULL
*/
int nm_member_add(struct lu_nodemap *nodemap, struct obd_export *exp)
{
RETURN(0);
}
-/**
+/*
* Revokes the locks on an export if it is attached to an MDT and not in
* recovery. As a performance enhancement, the lock revoking process could
* revoke only the locks that cover files affected by the nodemap change.
struct obd_type *type = exp->exp_obd->obd_type;
if (strcmp(type->typ_name, LUSTRE_MDT_NAME) != 0)
return;
- if (exp->exp_obd->obd_recovering)
+ if (test_bit(OBDF_RECOVERING, exp->exp_obd->obd_flags))
return;
ldlm_revoke_export_locks(exp);
}
/**
+ * nm_member_reclassify_nodemap() - Reclassify members of a nodemap
+ * @nodemap: nodemap with members to reclassify
+ *
* Reclassify the members of a nodemap after range changes or activation.
* This function reclassifies the members of a nodemap based on the member
* export's NID and the nodemap's new NID ranges. Exports that are no longer
*
* Callers should hold the active_config_lock and active_config
* nmc_range_tree_lock.
- *
- * \param nodemap nodemap with members to reclassify
*/
void nm_member_reclassify_nodemap(struct lu_nodemap *nodemap)
{
list_for_each_entry_safe(exp, tmp, &nodemap->nm_member_list,
exp_target_data.ted_nodemap_member) {
- lnet_nid_t nid;
+ struct lnet_nid *nid;
/* if no conn assigned to this exp, reconnect will reclassify */
spin_lock(&exp->exp_lock);
if (exp->exp_connection) {
- nid = exp->exp_connection->c_peer.nid;
+ nid = &exp->exp_connection->c_peer.nid;
} else {
spin_unlock(&exp->exp_lock);
continue;
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.
+ * nm_member_revoke_locks() - Revoke the locks for member exports if nodemap
+ * system is active.
+ * @nodemap: nodemap that has been altered
*
- * \param nodemap nodemap that has been altered
+ * 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.
*/
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;