}
EXPORT_SYMBOL(obd_export_nid2str);
-int obd_export_evict_by_nid(struct obd_device *obd, const char *nid)
-{
- struct cfs_hash *nid_hash;
- struct obd_export *doomed_exp = NULL;
- int exports_evicted = 0;
-
- lnet_nid_t nid_key = libcfs_str2nid((char *)nid);
-
- spin_lock(&obd->obd_dev_lock);
- /* umount has run already, so evict thread should leave
- * its task to umount thread now */
- if (obd->obd_stopping) {
- spin_unlock(&obd->obd_dev_lock);
- return exports_evicted;
- }
- nid_hash = obd->obd_nid_hash;
- cfs_hash_getref(nid_hash);
- spin_unlock(&obd->obd_dev_lock);
-
- do {
- doomed_exp = cfs_hash_lookup(nid_hash, &nid_key);
- if (!doomed_exp)
- break;
-
- LASSERTF(doomed_exp->exp_connection->c_peer.nid == nid_key,
- "nid %s found, wanted nid %s, requested nid %s\n",
- obd_export_nid2str(doomed_exp),
- libcfs_nid2str(nid_key), nid);
- LASSERTF(doomed_exp != obd->obd_self_export,
- "self-export is hashed by NID?\n");
- exports_evicted++;
- LCONSOLE_WARN("%s: evicting %s (at %s) by administrative request\n",
- obd->obd_name,
- obd_uuid2str(&doomed_exp->exp_client_uuid),
- obd_export_nid2str(doomed_exp));
- class_fail_export(doomed_exp);
- class_export_put(doomed_exp);
- } while (1);
-
- cfs_hash_putref(nid_hash);
-
- if (!exports_evicted)
- CDEBUG(D_HA,
- "%s: can't disconnect NID '%s': no exports found\n",
- obd->obd_name, nid);
- return exports_evicted;
-}
-EXPORT_SYMBOL(obd_export_evict_by_nid);
-
-int obd_export_evict_by_uuid(struct obd_device *obd, const char *uuid)
-{
- struct cfs_hash *uuid_hash;
- struct obd_export *doomed_exp = NULL;
- struct obd_uuid doomed_uuid;
- int exports_evicted = 0;
-
- spin_lock(&obd->obd_dev_lock);
- if (obd->obd_stopping) {
- spin_unlock(&obd->obd_dev_lock);
- return exports_evicted;
- }
- uuid_hash = obd->obd_uuid_hash;
- cfs_hash_getref(uuid_hash);
- spin_unlock(&obd->obd_dev_lock);
-
- obd_str2uuid(&doomed_uuid, uuid);
- if (obd_uuid_equals(&doomed_uuid, &obd->obd_uuid)) {
- CERROR("%s: can't evict myself\n", obd->obd_name);
- cfs_hash_putref(uuid_hash);
- return exports_evicted;
- }
-
- doomed_exp = cfs_hash_lookup(uuid_hash, &doomed_uuid);
-
- if (!doomed_exp) {
- CERROR("%s: can't disconnect %s: no exports found\n",
- obd->obd_name, uuid);
- } else {
- CWARN("%s: evicting %s at administrative request\n",
- obd->obd_name, doomed_exp->exp_client_uuid.uuid);
- class_fail_export(doomed_exp);
- class_export_put(doomed_exp);
- exports_evicted++;
- }
- cfs_hash_putref(uuid_hash);
-
- return exports_evicted;
-}
-EXPORT_SYMBOL(obd_export_evict_by_uuid);
-
#if LUSTRE_TRACKS_LOCK_EXP_REFS
void (*class_export_dump_hook)(struct obd_export *) = NULL;
EXPORT_SYMBOL(class_export_dump_hook);