Whamcloud - gitweb
LU-10467 lustre: convert most users of LWI_TIMEOUT_INTERVAL()
[fs/lustre-release.git] / lustre / ptlrpc / pinger.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2011, 2015, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  * Lustre is a trademark of Sun Microsystems, Inc.
31  *
32  * lustre/ptlrpc/pinger.c
33  *
34  * Portal-RPC reconnection and replay operations, for use in recovery.
35  */
36
37 #define DEBUG_SUBSYSTEM S_RPC
38
39 #include <linux/kthread.h>
40 #include <linux/workqueue.h>
41 #include <obd_support.h>
42 #include <obd_class.h>
43 #include "ptlrpc_internal.h"
44
45 static int suppress_pings;
46 module_param(suppress_pings, int, 0644);
47 MODULE_PARM_DESC(suppress_pings, "Suppress pings");
48
49 struct mutex pinger_mutex;
50 static struct list_head pinger_imports =
51                 LIST_HEAD_INIT(pinger_imports);
52 static struct list_head timeout_list =
53                 LIST_HEAD_INIT(timeout_list);
54
55 int ptlrpc_pinger_suppress_pings(void)
56 {
57         return suppress_pings;
58 }
59 EXPORT_SYMBOL(ptlrpc_pinger_suppress_pings);
60
61 struct ptlrpc_request *
62 ptlrpc_prep_ping(struct obd_import *imp)
63 {
64         struct ptlrpc_request *req;
65
66         req = ptlrpc_request_alloc_pack(imp, &RQF_OBD_PING,
67                                         LUSTRE_OBD_VERSION, OBD_PING);
68         if (req) {
69                 ptlrpc_request_set_replen(req);
70                 req->rq_no_resend = req->rq_no_delay = 1;
71         }
72         return req;
73 }
74
75 int ptlrpc_obd_ping(struct obd_device *obd)
76 {
77         int rc;
78         struct ptlrpc_request *req;
79
80         ENTRY;
81
82         req = ptlrpc_prep_ping(obd->u.cli.cl_import);
83         if (!req)
84                 RETURN(-ENOMEM);
85
86         req->rq_send_state = LUSTRE_IMP_FULL;
87
88         rc = ptlrpc_queue_wait(req);
89
90         ptlrpc_req_finished(req);
91
92         RETURN(rc);
93 }
94 EXPORT_SYMBOL(ptlrpc_obd_ping);
95
96 static bool ptlrpc_check_import_is_idle(struct obd_import *imp)
97 {
98         struct ldlm_namespace *ns = imp->imp_obd->obd_namespace;
99         time64_t now;
100
101         if (!imp->imp_idle_timeout)
102                 return false;
103
104         /*
105          * 4 comes from:
106          *  - client_obd_setup() - hashed import
107          *  - ptlrpcd_alloc_work()
108          *  - ptlrpcd_alloc_work()
109          *  - ptlrpc_pinger_add_import
110          */
111         if (atomic_read(&imp->imp_refcount) > 4)
112                 return false;
113
114         /* any lock increases ns_bref being a resource holder */
115         if (ns && atomic_read(&ns->ns_bref) > 0)
116                 return false;
117
118         now = ktime_get_real_seconds();
119         if (now - imp->imp_last_reply_time < imp->imp_idle_timeout)
120                 return false;
121
122         return true;
123 }
124
125 static int ptlrpc_ping(struct obd_import *imp)
126 {
127         struct ptlrpc_request *req;
128
129         ENTRY;
130
131         if (ptlrpc_check_import_is_idle(imp))
132                 RETURN(ptlrpc_disconnect_and_idle_import(imp));
133
134         req = ptlrpc_prep_ping(imp);
135         if (!req) {
136                 CERROR("OOM trying to ping %s->%s\n",
137                        imp->imp_obd->obd_uuid.uuid,
138                        obd2cli_tgt(imp->imp_obd));
139                 RETURN(-ENOMEM);
140         }
141
142         DEBUG_REQ(D_INFO, req, "pinging %s->%s",
143                   imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
144         ptlrpcd_add_req(req);
145
146         RETURN(0);
147 }
148
149 static void ptlrpc_update_next_ping(struct obd_import *imp, int soon)
150 {
151 #ifdef ENABLE_PINGER
152         time64_t time = soon ? PING_INTERVAL_SHORT : PING_INTERVAL;
153
154         if (imp->imp_state == LUSTRE_IMP_DISCON) {
155                 time64_t dtime = max_t(time64_t, CONNECTION_SWITCH_MIN,
156                                        AT_OFF ? 0 :
157                                        at_get(&imp->imp_at.iat_net_latency));
158                 time = min(time, dtime);
159         }
160         imp->imp_next_ping = ktime_get_seconds() + time;
161 #endif /* ENABLE_PINGER */
162 }
163
164 void ptlrpc_ping_import_soon(struct obd_import *imp)
165 {
166         imp->imp_next_ping = ktime_get_seconds();
167 }
168
169 static inline int imp_is_deactive(struct obd_import *imp)
170 {
171         return imp->imp_deactive ||
172                OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_IMP_DEACTIVE);
173 }
174
175 static inline time64_t ptlrpc_next_reconnect(struct obd_import *imp)
176 {
177         if (imp->imp_server_timeout)
178                 return ktime_get_seconds() + (obd_timeout >> 1);
179         else
180                 return ktime_get_seconds() + obd_timeout;
181 }
182
183 static time64_t pinger_check_timeout(time64_t time)
184 {
185         struct timeout_item *item;
186         time64_t timeout = PING_INTERVAL;
187
188         /* This list is sorted in increasing timeout order */
189         mutex_lock(&pinger_mutex);
190         list_for_each_entry(item, &timeout_list, ti_chain) {
191                 time64_t ti_timeout = item->ti_timeout;
192
193                 if (timeout > ti_timeout)
194                         timeout = ti_timeout;
195                 break;
196         }
197         mutex_unlock(&pinger_mutex);
198
199         return time + timeout - ktime_get_seconds();
200 }
201
202 static bool ir_up;
203
204 void ptlrpc_pinger_ir_up(void)
205 {
206         CDEBUG(D_HA, "IR up\n");
207         ir_up = true;
208 }
209 EXPORT_SYMBOL(ptlrpc_pinger_ir_up);
210
211 void ptlrpc_pinger_ir_down(void)
212 {
213         CDEBUG(D_HA, "IR down\n");
214         ir_up = false;
215 }
216 EXPORT_SYMBOL(ptlrpc_pinger_ir_down);
217
218 static void ptlrpc_pinger_process_import(struct obd_import *imp,
219                                          time64_t this_ping)
220 {
221         int level;
222         int force;
223         int force_next;
224         int suppress;
225
226         spin_lock(&imp->imp_lock);
227
228         level = imp->imp_state;
229         force = imp->imp_force_verify;
230         force_next = imp->imp_force_next_verify;
231         /*
232          * This will be used below only if the import is "FULL".
233          */
234         suppress = ir_up && OCD_HAS_FLAG(&imp->imp_connect_data, PINGLESS);
235
236         imp->imp_force_verify = 0;
237
238         if (imp->imp_next_ping - 5 >= this_ping && !force) {
239                 spin_unlock(&imp->imp_lock);
240                 return;
241         }
242
243         imp->imp_force_next_verify = 0;
244
245         CDEBUG(level == LUSTRE_IMP_FULL ? D_INFO : D_HA,
246                "%s->%s: level %s/%u force %u force_next %u deactive %u pingable %u suppress %u\n",
247                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd),
248                ptlrpc_import_state_name(level), level, force, force_next,
249                imp->imp_deactive, imp->imp_pingable, suppress);
250
251         if (level == LUSTRE_IMP_DISCON && !imp_is_deactive(imp)) {
252                 /* wait for a while before trying recovery again */
253                 imp->imp_next_ping = ptlrpc_next_reconnect(imp);
254                 spin_unlock(&imp->imp_lock);
255                 if (!imp->imp_no_pinger_recover ||
256                     imp->imp_connect_error == -EAGAIN)
257                         ptlrpc_initiate_recovery(imp);
258         } else if (level != LUSTRE_IMP_FULL || imp->imp_obd->obd_no_recov ||
259                    imp_is_deactive(imp)) {
260                 CDEBUG(D_HA,
261                        "%s->%s: not pinging (in recovery or recovery disabled: %s)\n",
262                        imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd),
263                        ptlrpc_import_state_name(level));
264                 if (force)
265                         imp->imp_force_verify = 1;
266                 spin_unlock(&imp->imp_lock);
267         } else if ((imp->imp_pingable && !suppress) || force_next || force) {
268                 spin_unlock(&imp->imp_lock);
269                 ptlrpc_ping(imp);
270         } else {
271                 spin_unlock(&imp->imp_lock);
272         }
273 }
274
275 static struct workqueue_struct *pinger_wq;
276 static void ptlrpc_pinger_main(struct work_struct *ws);
277 static DECLARE_DELAYED_WORK(ping_work, ptlrpc_pinger_main);
278
279 static void ptlrpc_pinger_main(struct work_struct *ws)
280 {
281         time64_t this_ping = ktime_get_seconds();
282         time64_t time_to_next_wake;
283         struct timeout_item *item;
284         struct obd_import *imp;
285         struct list_head *iter;
286
287         do {
288                 mutex_lock(&pinger_mutex);
289                 list_for_each_entry(item, &timeout_list, ti_chain)
290                         item->ti_cb(item, item->ti_cb_data);
291
292                 list_for_each(iter, &pinger_imports) {
293                         imp = list_entry(iter, struct obd_import,
294                                          imp_pinger_chain);
295
296                         ptlrpc_pinger_process_import(imp, this_ping);
297                         /* obd_timeout might have changed */
298                         if (imp->imp_pingable && imp->imp_next_ping &&
299                             imp->imp_next_ping > this_ping + PING_INTERVAL)
300                                 ptlrpc_update_next_ping(imp, 0);
301                 }
302                 mutex_unlock(&pinger_mutex);
303                 /* update memory usage info */
304                 obd_update_maxusage();
305
306                 /* Wait until the next ping time, or until we're stopped. */
307                 time_to_next_wake = pinger_check_timeout(this_ping);
308                 /*
309                  * The ping sent by ptlrpc_send_rpc may get sent out
310                  * say .01 second after this.
311                  * ptlrpc_pinger_sending_on_import will then set the
312                  * next ping time to next_ping + .01 sec, which means
313                  * we will SKIP the next ping at next_ping, and the
314                  * ping will get sent 2 timeouts from now!  Beware.
315                  */
316                 CDEBUG(D_INFO, "next wakeup in %lld (%lld)\n",
317                        time_to_next_wake, this_ping + PING_INTERVAL);
318         } while (time_to_next_wake <= 0);
319
320         queue_delayed_work(pinger_wq, &ping_work,
321                            cfs_time_seconds(max(time_to_next_wake, 1LL)));
322 }
323
324 int ptlrpc_start_pinger(void)
325 {
326 #ifdef ENABLE_PINGER
327         if (pinger_wq)
328                 return -EALREADY;
329
330         pinger_wq = alloc_workqueue("ptlrpc_pinger", 0, 1);
331         if (!pinger_wq) {
332                 CERROR("cannot start pinger workqueue\n");
333                 return -ENOMEM;
334         }
335
336         queue_delayed_work(pinger_wq, &ping_work, 0);
337
338         if (suppress_pings)
339                 CWARN("Pings will be suppressed at the request of the administrator. The configuration shall meet the additional requirements described in the manual. (Search for the \"suppress_pings\" kernel module parameter.)\n");
340 #endif
341         return 0;
342 }
343
344 int ptlrpc_pinger_remove_timeouts(void);
345
346 int ptlrpc_stop_pinger(void)
347 {
348 #ifdef ENABLE_PINGER
349         if (!pinger_wq)
350                 return -EALREADY;
351
352         ptlrpc_pinger_remove_timeouts();
353
354         cancel_delayed_work_sync(&ping_work);
355         destroy_workqueue(pinger_wq);
356         pinger_wq = NULL;
357 #endif
358         return 0;
359 }
360
361 void ptlrpc_pinger_sending_on_import(struct obd_import *imp)
362 {
363         ptlrpc_update_next_ping(imp, 0);
364 }
365
366 void ptlrpc_pinger_commit_expected(struct obd_import *imp)
367 {
368         ptlrpc_update_next_ping(imp, 1);
369         assert_spin_locked(&imp->imp_lock);
370         /*
371          * Avoid reading stale imp_connect_data.  When not sure if pings are
372          * expected or not on next connection, we assume they are not and force
373          * one anyway to guarantee the chance of updating
374          * imp_peer_committed_transno.
375          */
376         if (imp->imp_state != LUSTRE_IMP_FULL ||
377             OCD_HAS_FLAG(&imp->imp_connect_data, PINGLESS))
378                 imp->imp_force_next_verify = 1;
379 }
380
381 int ptlrpc_pinger_add_import(struct obd_import *imp)
382 {
383         ENTRY;
384         if (!list_empty(&imp->imp_pinger_chain))
385                 RETURN(-EALREADY);
386
387         mutex_lock(&pinger_mutex);
388         CDEBUG(D_HA, "adding pingable import %s->%s\n",
389                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
390         /* if we add to pinger we want recovery on this import */
391         imp->imp_obd->obd_no_recov = 0;
392         ptlrpc_update_next_ping(imp, 0);
393         /* XXX sort, blah blah */
394         list_add_tail(&imp->imp_pinger_chain, &pinger_imports);
395         class_import_get(imp);
396
397         ptlrpc_pinger_wake_up();
398         mutex_unlock(&pinger_mutex);
399
400         RETURN(0);
401 }
402 EXPORT_SYMBOL(ptlrpc_pinger_add_import);
403
404 int ptlrpc_pinger_del_import(struct obd_import *imp)
405 {
406         ENTRY;
407
408         if (list_empty(&imp->imp_pinger_chain))
409                 RETURN(-ENOENT);
410
411         mutex_lock(&pinger_mutex);
412         list_del_init(&imp->imp_pinger_chain);
413         CDEBUG(D_HA, "removing pingable import %s->%s\n",
414                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
415         /* if we remove from pinger we don't want recovery on this import */
416         imp->imp_obd->obd_no_recov = 1;
417         class_import_put(imp);
418         mutex_unlock(&pinger_mutex);
419         RETURN(0);
420 }
421 EXPORT_SYMBOL(ptlrpc_pinger_del_import);
422
423 /**
424  * Register a timeout callback to the pinger list, and the callback will
425  * be called when timeout happens.
426  */
427 static struct timeout_item *ptlrpc_new_timeout(time64_t time,
428                                                enum timeout_event event,
429                                                timeout_cb_t cb, void *data)
430 {
431         struct timeout_item *ti;
432
433         OBD_ALLOC_PTR(ti);
434         if (!ti)
435                 return NULL;
436
437         INIT_LIST_HEAD(&ti->ti_obd_list);
438         INIT_LIST_HEAD(&ti->ti_chain);
439         ti->ti_timeout = time;
440         ti->ti_event = event;
441         ti->ti_cb = cb;
442         ti->ti_cb_data = data;
443
444         return ti;
445 }
446
447 /**
448  * Register timeout event on the the pinger thread.
449  * Note: the timeout list is an sorted list with increased timeout value.
450  */
451 static struct timeout_item*
452 ptlrpc_pinger_register_timeout(time64_t time, enum timeout_event event,
453                                timeout_cb_t cb, void *data)
454 {
455         struct timeout_item *item, *tmp;
456
457         LASSERT(mutex_is_locked(&pinger_mutex));
458
459         list_for_each_entry(item, &timeout_list, ti_chain)
460                 if (item->ti_event == event)
461                         goto out;
462
463         item = ptlrpc_new_timeout(time, event, cb, data);
464         if (item) {
465                 list_for_each_entry_reverse(tmp, &timeout_list, ti_chain) {
466                         if (tmp->ti_timeout < time) {
467                                 list_add(&item->ti_chain, &tmp->ti_chain);
468                                 goto out;
469                         }
470                 }
471                 list_add(&item->ti_chain, &timeout_list);
472         }
473 out:
474         return item;
475 }
476
477 /* Add a client_obd to the timeout event list, when timeout(@time)
478  * happens, the callback(@cb) will be called.
479  */
480 int ptlrpc_add_timeout_client(time64_t time, enum timeout_event event,
481                               timeout_cb_t cb, void *data,
482                               struct list_head *obd_list)
483 {
484         struct timeout_item *ti;
485
486         mutex_lock(&pinger_mutex);
487         ti = ptlrpc_pinger_register_timeout(time, event, cb, data);
488         if (!ti) {
489                 mutex_unlock(&pinger_mutex);
490                 return -EINVAL;
491         }
492         list_add(obd_list, &ti->ti_obd_list);
493         mutex_unlock(&pinger_mutex);
494         return 0;
495 }
496 EXPORT_SYMBOL(ptlrpc_add_timeout_client);
497
498 int ptlrpc_del_timeout_client(struct list_head *obd_list,
499                               enum timeout_event event)
500 {
501         struct timeout_item *ti = NULL, *item;
502
503         if (list_empty(obd_list))
504                 return 0;
505         mutex_lock(&pinger_mutex);
506         list_del_init(obd_list);
507         /**
508          * If there are no obd attached to the timeout event
509          * list, remove this timeout event from the pinger
510          */
511         list_for_each_entry(item, &timeout_list, ti_chain) {
512                 if (item->ti_event == event) {
513                         ti = item;
514                         break;
515                 }
516         }
517         LASSERTF(ti, "ti is NULL !\n");
518         if (list_empty(&ti->ti_obd_list)) {
519                 list_del(&ti->ti_chain);
520                 OBD_FREE_PTR(ti);
521         }
522         mutex_unlock(&pinger_mutex);
523         return 0;
524 }
525 EXPORT_SYMBOL(ptlrpc_del_timeout_client);
526
527 int ptlrpc_pinger_remove_timeouts(void)
528 {
529         struct timeout_item *item, *tmp;
530
531         mutex_lock(&pinger_mutex);
532         list_for_each_entry_safe(item, tmp, &timeout_list, ti_chain) {
533                 LASSERT(list_empty(&item->ti_obd_list));
534                 list_del(&item->ti_chain);
535                 OBD_FREE_PTR(item);
536         }
537         mutex_unlock(&pinger_mutex);
538         return 0;
539 }
540
541 void ptlrpc_pinger_wake_up(void)
542 {
543 #ifdef ENABLE_PINGER
544         mod_delayed_work(pinger_wq, &ping_work, 0);
545 #endif
546 }
547
548 /* Ping evictor thread */
549 #define PET_READY     1
550 #define PET_TERMINATE 2
551
552 static int pet_refcount;
553 static int pet_state;
554 static wait_queue_head_t pet_waitq;
555 static struct list_head pet_list;
556 static DEFINE_SPINLOCK(pet_lock);
557
558 int ping_evictor_wake(struct obd_export *exp)
559 {
560         struct obd_device *obd;
561
562         spin_lock(&pet_lock);
563         if (pet_state != PET_READY) {
564                 /* eventually the new obd will call here again. */
565                 spin_unlock(&pet_lock);
566                 return 1;
567         }
568
569         obd = class_exp2obd(exp);
570         if (list_empty(&obd->obd_evict_list)) {
571                 class_incref(obd, "evictor", obd);
572                 list_add(&obd->obd_evict_list, &pet_list);
573         }
574         spin_unlock(&pet_lock);
575
576         wake_up(&pet_waitq);
577         return 0;
578 }
579
580 static int ping_evictor_main(void *arg)
581 {
582         struct obd_device *obd;
583         struct obd_export *exp;
584         time64_t expire_time;
585
586         ENTRY;
587         unshare_fs_struct();
588
589         CDEBUG(D_HA, "Starting Ping Evictor\n");
590         pet_state = PET_READY;
591         while (1) {
592                 wait_event_idle(pet_waitq,
593                                 (!list_empty(&pet_list)) ||
594                                 (pet_state == PET_TERMINATE));
595
596                 /* loop until all obd's will be removed */
597                 if ((pet_state == PET_TERMINATE) && list_empty(&pet_list))
598                         break;
599
600                 /*
601                  * we only get here if pet_exp != NULL, and the end of this
602                  * loop is the only place which sets it NULL again, so lock
603                  * is not strictly necessary.
604                  */
605                 spin_lock(&pet_lock);
606                 obd = list_entry(pet_list.next, struct obd_device,
607                                  obd_evict_list);
608                 spin_unlock(&pet_lock);
609
610                 expire_time = ktime_get_real_seconds() - PING_EVICT_TIMEOUT;
611
612                 CDEBUG(D_HA, "evicting all exports of obd %s older than %lld\n",
613                        obd->obd_name, expire_time);
614
615                 /*
616                  * Exports can't be deleted out of the list while we hold
617                  * the obd lock (class_unlink_export), which means we can't
618                  * lose the last ref on the export.  If they've already been
619                  * removed from the list, we won't find them here.
620                  */
621                 spin_lock(&obd->obd_dev_lock);
622                 while (!list_empty(&obd->obd_exports_timed)) {
623                         exp = list_entry(obd->obd_exports_timed.next,
624                                          struct obd_export,
625                                          exp_obd_chain_timed);
626                         if (expire_time > exp->exp_last_request_time) {
627                                 struct obd_uuid *client_uuid;
628
629                                 class_export_get(exp);
630                                 client_uuid = &exp->exp_client_uuid;
631                                 spin_unlock(&obd->obd_dev_lock);
632                                 LCONSOLE_WARN("%s: haven't heard from client %s (at %s) in %lld seconds. I think it's dead, and I am evicting it. exp %p, cur %lld expire %lld last %lld\n",
633                                               obd->obd_name,
634                                               obd_uuid2str(client_uuid),
635                                               obd_export_nid2str(exp),
636                                               ktime_get_real_seconds() -
637                                               exp->exp_last_request_time,
638                                               exp, ktime_get_real_seconds(),
639                                               expire_time,
640                                               exp->exp_last_request_time);
641                                 CDEBUG(D_HA, "Last request was at %lld\n",
642                                        exp->exp_last_request_time);
643                                 class_fail_export(exp);
644                                 class_export_put(exp);
645                                 spin_lock(&obd->obd_dev_lock);
646                         } else {
647                                 /* List is sorted, so everyone below is ok */
648                                 break;
649                         }
650                 }
651                 spin_unlock(&obd->obd_dev_lock);
652
653                 spin_lock(&pet_lock);
654                 list_del_init(&obd->obd_evict_list);
655                 spin_unlock(&pet_lock);
656
657                 class_decref(obd, "evictor", obd);
658         }
659         CDEBUG(D_HA, "Exiting Ping Evictor\n");
660
661         RETURN(0);
662 }
663
664 void ping_evictor_start(void)
665 {
666         struct task_struct *task;
667
668         if (++pet_refcount > 1)
669                 return;
670
671         INIT_LIST_HEAD(&pet_list);
672         init_waitqueue_head(&pet_waitq);
673
674         task = kthread_run(ping_evictor_main, NULL, "ll_evictor");
675         if (IS_ERR(task)) {
676                 pet_refcount--;
677                 CERROR("Cannot start ping evictor thread: %ld\n",
678                         PTR_ERR(task));
679         }
680 }
681 EXPORT_SYMBOL(ping_evictor_start);
682
683 void ping_evictor_stop(void)
684 {
685         if (--pet_refcount > 0)
686                 return;
687
688         pet_state = PET_TERMINATE;
689         wake_up(&pet_waitq);
690 }
691 EXPORT_SYMBOL(ping_evictor_stop);