From 380f01a18cb9ee12908583b2b30382c6d2e142d2 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sun, 27 Sep 2015 16:45:31 -0400 Subject: [PATCH] staging/lustre: remove the ping evictor This code is never used on the client and can simply be removed. Signed-off-by: Arnd Bergmann Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/include/lustre_net.h | 2 - drivers/staging/lustre/lustre/include/obd.h | 1 - drivers/staging/lustre/lustre/ptlrpc/pinger.c | 136 ------------------ .../lustre/lustre/ptlrpc/ptlrpc_internal.h | 1 - .../staging/lustre/lustre/ptlrpc/service.c | 31 ---- 5 files changed, 171 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 0db7810f7d6f..e929c934cfbf 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -2900,8 +2900,6 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list, enum timeout_event event); struct ptlrpc_request *ptlrpc_prep_ping(struct obd_import *imp); int ptlrpc_obd_ping(struct obd_device *obd); -void ping_evictor_start(void); -void ping_evictor_stop(void); void ptlrpc_pinger_ir_up(void); void ptlrpc_pinger_ir_down(void); /** @} */ diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 0dbac3f53f01..874d1adbf21e 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -841,7 +841,6 @@ struct obd_device { struct obd_export *obd_self_export; /* list of exports in LRU order, for ping evictor, with obd_dev_lock */ struct list_head obd_exports_timed; - time_t obd_eviction_timer; /* for ping evictor */ int obd_max_recoverable_clients; atomic_t obd_connected_clients; diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 6cd4cfa58c27..16dfa8e1ed3f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -534,139 +534,3 @@ void ptlrpc_pinger_wake_up(void) thread_add_flags(&pinger_thread, SVC_EVENT); wake_up(&pinger_thread.t_ctl_waitq); } - -/* Ping evictor thread */ -#define PET_READY 1 -#define PET_TERMINATE 2 - -static int pet_refcount; -static int pet_state; -static wait_queue_head_t pet_waitq; -static LIST_HEAD(pet_list); -static DEFINE_SPINLOCK(pet_lock); - -int ping_evictor_wake(struct obd_export *exp) -{ - struct obd_device *obd; - - spin_lock(&pet_lock); - if (pet_state != PET_READY) { - /* eventually the new obd will call here again. */ - spin_unlock(&pet_lock); - return 1; - } - - obd = class_exp2obd(exp); - if (list_empty(&obd->obd_evict_list)) { - class_incref(obd, "evictor", obd); - list_add(&obd->obd_evict_list, &pet_list); - } - spin_unlock(&pet_lock); - - wake_up(&pet_waitq); - return 0; -} - -static int ping_evictor_main(void *arg) -{ - struct obd_device *obd; - struct obd_export *exp; - struct l_wait_info lwi = { 0 }; - time_t expire_time; - - unshare_fs_struct(); - - CDEBUG(D_HA, "Starting Ping Evictor\n"); - pet_state = PET_READY; - while (1) { - l_wait_event(pet_waitq, (!list_empty(&pet_list)) || - (pet_state == PET_TERMINATE), &lwi); - - /* loop until all obd's will be removed */ - if ((pet_state == PET_TERMINATE) && list_empty(&pet_list)) - break; - - /* we only get here if pet_exp != NULL, and the end of this - * loop is the only place which sets it NULL again, so lock - * is not strictly necessary. */ - spin_lock(&pet_lock); - obd = list_entry(pet_list.next, struct obd_device, - obd_evict_list); - spin_unlock(&pet_lock); - - expire_time = get_seconds() - PING_EVICT_TIMEOUT; - - CDEBUG(D_HA, "evicting all exports of obd %s older than %ld\n", - obd->obd_name, expire_time); - - /* Exports can't be deleted out of the list while we hold - * the obd lock (class_unlink_export), which means we can't - * lose the last ref on the export. If they've already been - * removed from the list, we won't find them here. */ - spin_lock(&obd->obd_dev_lock); - while (!list_empty(&obd->obd_exports_timed)) { - exp = list_entry(obd->obd_exports_timed.next, - struct obd_export, - exp_obd_chain_timed); - if (expire_time > exp->exp_last_request_time) { - class_export_get(exp); - spin_unlock(&obd->obd_dev_lock); - LCONSOLE_WARN("%s: haven't heard from client %s (at %s) in %ld seconds. I think it's dead, and I am evicting it. exp %p, cur %ld expire %ld last %ld\n", - obd->obd_name, - obd_uuid2str(&exp->exp_client_uuid), - obd_export_nid2str(exp), - (long)(get_seconds() - - exp->exp_last_request_time), - exp, (long)get_seconds(), - (long)expire_time, - (long)exp->exp_last_request_time); - CDEBUG(D_HA, "Last request was at %ld\n", - exp->exp_last_request_time); - class_fail_export(exp); - class_export_put(exp); - spin_lock(&obd->obd_dev_lock); - } else { - /* List is sorted, so everyone below is ok */ - break; - } - } - spin_unlock(&obd->obd_dev_lock); - - spin_lock(&pet_lock); - list_del_init(&obd->obd_evict_list); - spin_unlock(&pet_lock); - - class_decref(obd, "evictor", obd); - } - CDEBUG(D_HA, "Exiting Ping Evictor\n"); - - return 0; -} - -void ping_evictor_start(void) -{ - struct task_struct *task; - - if (++pet_refcount > 1) - return; - - init_waitqueue_head(&pet_waitq); - - task = kthread_run(ping_evictor_main, NULL, "ll_evictor"); - if (IS_ERR(task)) { - pet_refcount--; - CERROR("Cannot start ping evictor thread: %ld\n", - PTR_ERR(task)); - } -} -EXPORT_SYMBOL(ping_evictor_start); - -void ping_evictor_stop(void) -{ - if (--pet_refcount > 0) - return; - - pet_state = PET_TERMINATE; - wake_up(&pet_waitq); -} -EXPORT_SYMBOL(ping_evictor_stop); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 4e35b14a1315..059ad96bb0bf 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -250,7 +250,6 @@ void ptlrpc_pinger_sending_on_import(struct obd_import *imp); void ptlrpc_pinger_commit_expected(struct obd_import *imp); void ptlrpc_pinger_wake_up(void); void ptlrpc_ping_import_soon(struct obd_import *imp); -int ping_evictor_wake(struct obd_export *exp); /* sec_null.c */ int sptlrpc_null_init(void); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 28f57d7222d0..27d1030049a3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1069,37 +1069,6 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay) struct obd_export, exp_obd_chain_timed); oldest_time = oldest_exp->exp_last_request_time; spin_unlock(&exp->exp_obd->obd_dev_lock); - - if (exp->exp_obd->obd_recovering) { - /* be nice to everyone during recovery */ - return; - } - - /* Note - racing to start/reset the obd_eviction timer is safe */ - if (exp->exp_obd->obd_eviction_timer == 0) { - /* Check if the oldest entry is expired. */ - if (get_seconds() > (oldest_time + PING_EVICT_TIMEOUT + - extra_delay)) { - /* We need a second timer, in case the net was down and - * it just came back. Since the pinger may skip every - * other PING_INTERVAL (see note in ptlrpc_pinger_main), - * we better wait for 3. */ - exp->exp_obd->obd_eviction_timer = - get_seconds() + 3 * PING_INTERVAL; - CDEBUG(D_HA, "%s: Think about evicting %s from "CFS_TIME_T"\n", - exp->exp_obd->obd_name, - obd_export_nid2str(oldest_exp), oldest_time); - } - } else { - if (get_seconds() > - (exp->exp_obd->obd_eviction_timer + extra_delay)) { - /* The evictor won't evict anyone who we've heard from - * recently, so we don't have to check before we start - * it. */ - if (!ping_evictor_wake(exp)) - exp->exp_obd->obd_eviction_timer = 0; - } - } } /** -- 2.30.2