From fb209cbddd5fdd8e0916f5c2650cc778a5ce09e0 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sun, 27 Sep 2015 16:45:35 -0400 Subject: [PATCH] staging/lustre: remove class_disconnect_export_list More code that makes no sense on the client and that can be removed without replacement. Signed-off-by: Arnd Bergmann Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/obd_class.h | 3 - .../staging/lustre/lustre/obdclass/genops.c | 115 ------------------ .../lustre/lustre/obdclass/obd_config.c | 12 -- 3 files changed, 130 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 7308cda6f5e6..0bbe9f9b935e 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -286,10 +286,7 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, int class_disconnect(struct obd_export *exp); void class_fail_export(struct obd_export *exp); int class_connected_export(struct obd_export *exp); -void class_disconnect_exports(struct obd_device *obddev); int class_manual_cleanup(struct obd_device *obd); -void class_disconnect_stale_exports(struct obd_device *, - int (*test_export)(struct obd_export *)); static inline enum obd_option exp_flags_from_obd(struct obd_device *obd) { return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) | diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 594955d359ec..da01ea5a35b2 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -1235,121 +1235,6 @@ int class_connected_export(struct obd_export *exp) } EXPORT_SYMBOL(class_connected_export); -static void class_disconnect_export_list(struct list_head *list, - enum obd_option flags) -{ - int rc; - struct obd_export *exp; - - /* It's possible that an export may disconnect itself, but - * nothing else will be added to this list. */ - while (!list_empty(list)) { - exp = list_entry(list->next, struct obd_export, - exp_obd_chain); - /* need for safe call CDEBUG after obd_disconnect */ - class_export_get(exp); - - spin_lock(&exp->exp_lock); - exp->exp_flags = flags; - spin_unlock(&exp->exp_lock); - - if (obd_uuid_equals(&exp->exp_client_uuid, - &exp->exp_obd->obd_uuid)) { - CDEBUG(D_HA, - "exp %p export uuid == obd uuid, don't discon\n", - exp); - /* Need to delete this now so we don't end up pointing - * to work_list later when this export is cleaned up. */ - list_del_init(&exp->exp_obd_chain); - class_export_put(exp); - continue; - } - - class_export_get(exp); - CDEBUG(D_HA, "%s: disconnecting export at %s (%p), last request at " CFS_TIME_T "\n", - exp->exp_obd->obd_name, obd_export_nid2str(exp), - exp, exp->exp_last_request_time); - /* release one export reference anyway */ - rc = obd_disconnect(exp); - - CDEBUG(D_HA, "disconnected export at %s (%p): rc %d\n", - obd_export_nid2str(exp), exp, rc); - class_export_put(exp); - } -} - -void class_disconnect_exports(struct obd_device *obd) -{ - struct list_head work_list; - - /* Move all of the exports from obd_exports to a work list, en masse. */ - INIT_LIST_HEAD(&work_list); - spin_lock(&obd->obd_dev_lock); - list_splice_init(&obd->obd_exports, &work_list); - list_splice_init(&obd->obd_delayed_exports, &work_list); - spin_unlock(&obd->obd_dev_lock); - - if (!list_empty(&work_list)) { - CDEBUG(D_HA, "OBD device %d (%p) has exports, disconnecting them\n", - obd->obd_minor, obd); - class_disconnect_export_list(&work_list, - exp_flags_from_obd(obd)); - } else - CDEBUG(D_HA, "OBD device %d (%p) has no exports\n", - obd->obd_minor, obd); -} -EXPORT_SYMBOL(class_disconnect_exports); - -/* Remove exports that have not completed recovery. - */ -void class_disconnect_stale_exports(struct obd_device *obd, - int (*test_export)(struct obd_export *)) -{ - struct list_head work_list; - struct obd_export *exp, *n; - int evicted = 0; - - INIT_LIST_HEAD(&work_list); - spin_lock(&obd->obd_dev_lock); - list_for_each_entry_safe(exp, n, &obd->obd_exports, - exp_obd_chain) { - /* don't count self-export as client */ - if (obd_uuid_equals(&exp->exp_client_uuid, - &exp->exp_obd->obd_uuid)) - continue; - - /* don't evict clients which have no slot in last_rcvd - * (e.g. lightweight connection) */ - if (exp->exp_target_data.ted_lr_idx == -1) - continue; - - spin_lock(&exp->exp_lock); - if (exp->exp_failed || test_export(exp)) { - spin_unlock(&exp->exp_lock); - continue; - } - exp->exp_failed = 1; - spin_unlock(&exp->exp_lock); - - list_move(&exp->exp_obd_chain, &work_list); - evicted++; - CDEBUG(D_HA, "%s: disconnect stale client %s@%s\n", - obd->obd_name, exp->exp_client_uuid.uuid, - !exp->exp_connection ? "" : - libcfs_nid2str(exp->exp_connection->c_peer.nid)); - print_export_data(exp, "EVICTING", 0); - } - spin_unlock(&obd->obd_dev_lock); - - if (evicted) - LCONSOLE_WARN("%s: disconnecting %d stale clients\n", - obd->obd_name, evicted); - - class_disconnect_export_list(&work_list, exp_flags_from_obd(obd) | - OBD_OPT_ABORT_RECOV); -} -EXPORT_SYMBOL(class_disconnect_stale_exports); - void class_fail_export(struct obd_export *exp) { int rc, already_failed; diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 3bbc80623b3a..a96d2f3a00e0 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -643,18 +643,6 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) LASSERT(obd->obd_self_export); - /* The three references that should be remaining are the - * obd_self_export and the attach and setup references. */ - if (atomic_read(&obd->obd_refcount) > 3) { - /* refcount - 3 might be the number of real exports - (excluding self export). But class_incref is called - by other things as well, so don't count on it. */ - CDEBUG(D_IOCTL, "%s: forcing exports to disconnect: %d\n", - obd->obd_name, atomic_read(&obd->obd_refcount) - 3); - dump_exports(obd, 0); - class_disconnect_exports(obd); - } - /* Precleanup, we must make sure all exports get destroyed. */ err = obd_precleanup(obd, OBD_CLEANUP_EXPORTS); if (err) -- 2.30.2