Whamcloud - gitweb
6b6cbe0ff73ecf4c7ca86c06d648f71dcba088ba
[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         if (atomic_read(&imp->imp_reqs) > 0)
105                 return false;
106
107         /* any lock increases ns_bref being a resource holder */
108         if (ns && atomic_read(&ns->ns_bref) > 0)
109                 return false;
110
111         now = ktime_get_real_seconds();
112         if (now - imp->imp_last_reply_time < imp->imp_idle_timeout)
113                 return false;
114
115         return true;
116 }
117
118 static int ptlrpc_ping(struct obd_import *imp)
119 {
120         struct ptlrpc_request *req;
121
122         ENTRY;
123
124         if (ptlrpc_check_import_is_idle(imp))
125                 RETURN(ptlrpc_disconnect_and_idle_import(imp));
126
127         req = ptlrpc_prep_ping(imp);
128         if (!req) {
129                 CERROR("OOM trying to ping %s->%s\n",
130                        imp->imp_obd->obd_uuid.uuid,
131                        obd2cli_tgt(imp->imp_obd));
132                 RETURN(-ENOMEM);
133         }
134
135         DEBUG_REQ(D_INFO, req, "pinging %s->%s",
136                   imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
137         ptlrpcd_add_req(req);
138
139         RETURN(0);
140 }
141
142 static void ptlrpc_update_next_ping(struct obd_import *imp, int soon)
143 {
144 #ifdef CONFIG_LUSTRE_FS_PINGER
145         time64_t time = soon ? PING_INTERVAL_SHORT : PING_INTERVAL;
146
147         if (imp->imp_state == LUSTRE_IMP_DISCON) {
148                 time64_t dtime = max_t(time64_t, CONNECTION_SWITCH_MIN,
149                                        AT_OFF ? 0 :
150                                        at_get(&imp->imp_at.iat_net_latency));
151                 time = min(time, dtime);
152         }
153         imp->imp_next_ping = ktime_get_seconds() + time;
154 #endif /* CONFIG_LUSTRE_FS_PINGER */
155 }
156
157 void ptlrpc_ping_import_soon(struct obd_import *imp)
158 {
159         imp->imp_next_ping = ktime_get_seconds();
160 }
161
162 static inline int imp_is_deactive(struct obd_import *imp)
163 {
164         return imp->imp_deactive ||
165                OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_IMP_DEACTIVE);
166 }
167
168 static inline time64_t ptlrpc_next_reconnect(struct obd_import *imp)
169 {
170         if (imp->imp_server_timeout)
171                 return ktime_get_seconds() + (obd_timeout >> 1);
172         else
173                 return ktime_get_seconds() + obd_timeout;
174 }
175
176 static time64_t pinger_check_timeout(time64_t time)
177 {
178         struct timeout_item *item;
179         time64_t timeout = PING_INTERVAL;
180
181         /* This list is sorted in increasing timeout order */
182         mutex_lock(&pinger_mutex);
183         list_for_each_entry(item, &timeout_list, ti_chain) {
184                 time64_t ti_timeout = item->ti_timeout;
185
186                 if (timeout > ti_timeout)
187                         timeout = ti_timeout;
188                 break;
189         }
190         mutex_unlock(&pinger_mutex);
191
192         return time + timeout - ktime_get_seconds();
193 }
194
195 static bool ir_up;
196
197 void ptlrpc_pinger_ir_up(void)
198 {
199         CDEBUG(D_HA, "IR up\n");
200         ir_up = true;
201 }
202 EXPORT_SYMBOL(ptlrpc_pinger_ir_up);
203
204 void ptlrpc_pinger_ir_down(void)
205 {
206         CDEBUG(D_HA, "IR down\n");
207         ir_up = false;
208 }
209 EXPORT_SYMBOL(ptlrpc_pinger_ir_down);
210
211 static void ptlrpc_pinger_process_import(struct obd_import *imp,
212                                          time64_t this_ping)
213 {
214         int level;
215         int force;
216         int force_next;
217         int suppress;
218
219         spin_lock(&imp->imp_lock);
220
221         level = imp->imp_state;
222         force = imp->imp_force_verify;
223         force_next = imp->imp_force_next_verify;
224         /*
225          * This will be used below only if the import is "FULL".
226          */
227         suppress = ir_up && OCD_HAS_FLAG(&imp->imp_connect_data, PINGLESS);
228
229         imp->imp_force_verify = 0;
230
231         if (imp->imp_next_ping - 5 >= this_ping && !force) {
232                 spin_unlock(&imp->imp_lock);
233                 return;
234         }
235
236         imp->imp_force_next_verify = 0;
237
238         CDEBUG(level == LUSTRE_IMP_FULL ? D_INFO : D_HA,
239                "%s->%s: level %s/%u force %u force_next %u deactive %u pingable %u suppress %u\n",
240                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd),
241                ptlrpc_import_state_name(level), level, force, force_next,
242                imp->imp_deactive, imp->imp_pingable, suppress);
243
244         if (level == LUSTRE_IMP_DISCON && !imp_is_deactive(imp)) {
245                 /* wait for a while before trying recovery again */
246                 imp->imp_next_ping = ptlrpc_next_reconnect(imp);
247                 spin_unlock(&imp->imp_lock);
248                 if (!imp->imp_no_pinger_recover ||
249                     imp->imp_connect_error == -EAGAIN)
250                         ptlrpc_initiate_recovery(imp);
251         } else if (level != LUSTRE_IMP_FULL || imp->imp_obd->obd_no_recov ||
252                    imp_is_deactive(imp)) {
253                 CDEBUG(D_HA,
254                        "%s->%s: not pinging (in recovery or recovery disabled: %s)\n",
255                        imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd),
256                        ptlrpc_import_state_name(level));
257                 if (force)
258                         imp->imp_force_verify = 1;
259                 spin_unlock(&imp->imp_lock);
260         } else if ((imp->imp_pingable && !suppress) || force_next || force) {
261                 spin_unlock(&imp->imp_lock);
262                 ptlrpc_ping(imp);
263         } else {
264                 spin_unlock(&imp->imp_lock);
265         }
266 }
267
268 static struct workqueue_struct *pinger_wq;
269 static void ptlrpc_pinger_main(struct work_struct *ws);
270 static DECLARE_DELAYED_WORK(ping_work, ptlrpc_pinger_main);
271
272 static void ptlrpc_pinger_main(struct work_struct *ws)
273 {
274         time64_t this_ping = ktime_get_seconds();
275         time64_t time_to_next_wake;
276         struct timeout_item *item;
277         struct obd_import *imp;
278         struct list_head *iter;
279
280         do {
281                 mutex_lock(&pinger_mutex);
282                 list_for_each_entry(item, &timeout_list, ti_chain)
283                         item->ti_cb(item, item->ti_cb_data);
284
285                 list_for_each(iter, &pinger_imports) {
286                         imp = list_entry(iter, struct obd_import,
287                                          imp_pinger_chain);
288
289                         ptlrpc_pinger_process_import(imp, this_ping);
290                         /* obd_timeout might have changed */
291                         if (imp->imp_pingable && imp->imp_next_ping &&
292                             imp->imp_next_ping > this_ping + PING_INTERVAL)
293                                 ptlrpc_update_next_ping(imp, 0);
294                 }
295                 mutex_unlock(&pinger_mutex);
296                 /* update memory usage info */
297                 obd_update_maxusage();
298
299                 /* Wait until the next ping time, or until we're stopped. */
300                 time_to_next_wake = pinger_check_timeout(this_ping);
301                 /*
302                  * The ping sent by ptlrpc_send_rpc may get sent out
303                  * say .01 second after this.
304                  * ptlrpc_pinger_sending_on_import will then set the
305                  * next ping time to next_ping + .01 sec, which means
306                  * we will SKIP the next ping at next_ping, and the
307                  * ping will get sent 2 timeouts from now!  Beware.
308                  */
309                 CDEBUG(D_INFO, "next wakeup in %lld (%lld)\n",
310                        time_to_next_wake, this_ping + PING_INTERVAL);
311         } while (time_to_next_wake <= 0);
312
313         queue_delayed_work(pinger_wq, &ping_work,
314                            cfs_time_seconds(max(time_to_next_wake, 1LL)));
315 }
316
317 int ptlrpc_start_pinger(void)
318 {
319 #ifdef CONFIG_LUSTRE_FS_PINGER
320         if (pinger_wq)
321                 return -EALREADY;
322
323         pinger_wq = cfs_cpt_bind_workqueue("ptlrpc_pinger", cfs_cpt_tab,
324                                            0, CFS_CPT_ANY, 1);
325         if (IS_ERR(pinger_wq)) {
326                 CERROR("cannot start pinger workqueue\n");
327                 return PTR_ERR(pinger_wq);
328         }
329
330         queue_delayed_work(pinger_wq, &ping_work, 0);
331
332         if (suppress_pings)
333                 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");
334 #endif
335         return 0;
336 }
337
338 int ptlrpc_pinger_remove_timeouts(void);
339
340 int ptlrpc_stop_pinger(void)
341 {
342 #ifdef CONFIG_LUSTRE_FS_PINGER
343         if (!pinger_wq)
344                 return -EALREADY;
345
346         ptlrpc_pinger_remove_timeouts();
347
348         cancel_delayed_work_sync(&ping_work);
349         destroy_workqueue(pinger_wq);
350         pinger_wq = NULL;
351 #endif
352         return 0;
353 }
354
355 void ptlrpc_pinger_sending_on_import(struct obd_import *imp)
356 {
357         ptlrpc_update_next_ping(imp, 0);
358 }
359
360 void ptlrpc_pinger_commit_expected(struct obd_import *imp)
361 {
362         ptlrpc_update_next_ping(imp, 1);
363         assert_spin_locked(&imp->imp_lock);
364         /*
365          * Avoid reading stale imp_connect_data.  When not sure if pings are
366          * expected or not on next connection, we assume they are not and force
367          * one anyway to guarantee the chance of updating
368          * imp_peer_committed_transno.
369          */
370         if (imp->imp_state != LUSTRE_IMP_FULL ||
371             OCD_HAS_FLAG(&imp->imp_connect_data, PINGLESS))
372                 imp->imp_force_next_verify = 1;
373 }
374
375 int ptlrpc_pinger_add_import(struct obd_import *imp)
376 {
377         ENTRY;
378         if (!list_empty(&imp->imp_pinger_chain))
379                 RETURN(-EALREADY);
380
381         mutex_lock(&pinger_mutex);
382         CDEBUG(D_HA, "adding pingable import %s->%s\n",
383                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
384         /* if we add to pinger we want recovery on this import */
385         imp->imp_obd->obd_no_recov = 0;
386         ptlrpc_update_next_ping(imp, 0);
387         /* XXX sort, blah blah */
388         list_add_tail(&imp->imp_pinger_chain, &pinger_imports);
389         class_import_get(imp);
390
391         ptlrpc_pinger_wake_up();
392         mutex_unlock(&pinger_mutex);
393
394         RETURN(0);
395 }
396 EXPORT_SYMBOL(ptlrpc_pinger_add_import);
397
398 int ptlrpc_pinger_del_import(struct obd_import *imp)
399 {
400         ENTRY;
401
402         if (list_empty(&imp->imp_pinger_chain))
403                 RETURN(-ENOENT);
404
405         mutex_lock(&pinger_mutex);
406         list_del_init(&imp->imp_pinger_chain);
407         CDEBUG(D_HA, "removing pingable import %s->%s\n",
408                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
409         /* if we remove from pinger we don't want recovery on this import */
410         imp->imp_obd->obd_no_recov = 1;
411         class_import_put(imp);
412         mutex_unlock(&pinger_mutex);
413         RETURN(0);
414 }
415 EXPORT_SYMBOL(ptlrpc_pinger_del_import);
416
417 /**
418  * Register a timeout callback to the pinger list, and the callback will
419  * be called when timeout happens.
420  */
421 static struct timeout_item *ptlrpc_new_timeout(time64_t time,
422                                                enum timeout_event event,
423                                                timeout_cb_t cb, void *data)
424 {
425         struct timeout_item *ti;
426
427         OBD_ALLOC_PTR(ti);
428         if (!ti)
429                 return NULL;
430
431         INIT_LIST_HEAD(&ti->ti_obd_list);
432         INIT_LIST_HEAD(&ti->ti_chain);
433         ti->ti_timeout = time;
434         ti->ti_event = event;
435         ti->ti_cb = cb;
436         ti->ti_cb_data = data;
437
438         return ti;
439 }
440
441 /**
442  * Register timeout event on the the pinger thread.
443  * Note: the timeout list is an sorted list with increased timeout value.
444  */
445 static struct timeout_item*
446 ptlrpc_pinger_register_timeout(time64_t time, enum timeout_event event,
447                                timeout_cb_t cb, void *data)
448 {
449         struct timeout_item *item, *tmp;
450
451         LASSERT(mutex_is_locked(&pinger_mutex));
452
453         list_for_each_entry(item, &timeout_list, ti_chain)
454                 if (item->ti_event == event)
455                         goto out;
456
457         item = ptlrpc_new_timeout(time, event, cb, data);
458         if (item) {
459                 list_for_each_entry_reverse(tmp, &timeout_list, ti_chain) {
460                         if (tmp->ti_timeout < time) {
461                                 list_add(&item->ti_chain, &tmp->ti_chain);
462                                 goto out;
463                         }
464                 }
465                 list_add(&item->ti_chain, &timeout_list);
466         }
467 out:
468         return item;
469 }
470
471 /* Add a client_obd to the timeout event list, when timeout(@time)
472  * happens, the callback(@cb) will be called.
473  */
474 int ptlrpc_add_timeout_client(time64_t time, enum timeout_event event,
475                               timeout_cb_t cb, void *data,
476                               struct list_head *obd_list)
477 {
478         struct timeout_item *ti;
479
480         mutex_lock(&pinger_mutex);
481         ti = ptlrpc_pinger_register_timeout(time, event, cb, data);
482         if (!ti) {
483                 mutex_unlock(&pinger_mutex);
484                 return -EINVAL;
485         }
486         list_add(obd_list, &ti->ti_obd_list);
487         mutex_unlock(&pinger_mutex);
488         return 0;
489 }
490 EXPORT_SYMBOL(ptlrpc_add_timeout_client);
491
492 int ptlrpc_del_timeout_client(struct list_head *obd_list,
493                               enum timeout_event event)
494 {
495         struct timeout_item *ti = NULL, *item;
496
497         if (list_empty(obd_list))
498                 return 0;
499         mutex_lock(&pinger_mutex);
500         list_del_init(obd_list);
501         /**
502          * If there are no obd attached to the timeout event
503          * list, remove this timeout event from the pinger
504          */
505         list_for_each_entry(item, &timeout_list, ti_chain) {
506                 if (item->ti_event == event) {
507                         ti = item;
508                         break;
509                 }
510         }
511         LASSERTF(ti, "ti is NULL !\n");
512         if (list_empty(&ti->ti_obd_list)) {
513                 list_del(&ti->ti_chain);
514                 OBD_FREE_PTR(ti);
515         }
516         mutex_unlock(&pinger_mutex);
517         return 0;
518 }
519 EXPORT_SYMBOL(ptlrpc_del_timeout_client);
520
521 int ptlrpc_pinger_remove_timeouts(void)
522 {
523         struct timeout_item *item, *tmp;
524
525         mutex_lock(&pinger_mutex);
526         list_for_each_entry_safe(item, tmp, &timeout_list, ti_chain) {
527                 LASSERT(list_empty(&item->ti_obd_list));
528                 list_del(&item->ti_chain);
529                 OBD_FREE_PTR(item);
530         }
531         mutex_unlock(&pinger_mutex);
532         return 0;
533 }
534
535 void ptlrpc_pinger_wake_up(void)
536 {
537 #ifdef CONFIG_LUSTRE_FS_PINGER
538         mod_delayed_work(pinger_wq, &ping_work, 0);
539 #endif
540 }
541
542 /* Ping evictor thread */
543 #define PET_READY     1
544 #define PET_TERMINATE 2
545
546 static int pet_refcount;
547 static int pet_state;
548 static wait_queue_head_t pet_waitq;
549 static LIST_HEAD(pet_list);
550 static DEFINE_SPINLOCK(pet_lock);
551
552 int ping_evictor_wake(struct obd_export *exp)
553 {
554         struct obd_device *obd;
555
556         spin_lock(&pet_lock);
557         if (pet_state != PET_READY) {
558                 /* eventually the new obd will call here again. */
559                 spin_unlock(&pet_lock);
560                 return 1;
561         }
562
563         obd = class_exp2obd(exp);
564         if (list_empty(&obd->obd_evict_list)) {
565                 class_incref(obd, "evictor", obd);
566                 list_add(&obd->obd_evict_list, &pet_list);
567         }
568         spin_unlock(&pet_lock);
569
570         wake_up(&pet_waitq);
571         return 0;
572 }
573
574 static int ping_evictor_main(void *arg)
575 {
576         struct obd_device *obd;
577         struct obd_export *exp;
578         time64_t expire_time;
579
580         ENTRY;
581         unshare_fs_struct();
582
583         CDEBUG(D_HA, "Starting Ping Evictor\n");
584         pet_state = PET_READY;
585         while (1) {
586                 wait_event_idle(pet_waitq,
587                                 (!list_empty(&pet_list)) ||
588                                 (pet_state == PET_TERMINATE));
589
590                 /* loop until all obd's will be removed */
591                 if ((pet_state == PET_TERMINATE) && list_empty(&pet_list))
592                         break;
593
594                 /*
595                  * we only get here if pet_exp != NULL, and the end of this
596                  * loop is the only place which sets it NULL again, so lock
597                  * is not strictly necessary.
598                  */
599                 spin_lock(&pet_lock);
600                 obd = list_entry(pet_list.next, struct obd_device,
601                                  obd_evict_list);
602                 spin_unlock(&pet_lock);
603
604                 expire_time = ktime_get_real_seconds() - PING_EVICT_TIMEOUT;
605
606                 CDEBUG(D_HA, "evicting all exports of obd %s older than %lld\n",
607                        obd->obd_name, expire_time);
608
609                 /*
610                  * Exports can't be deleted out of the list while we hold
611                  * the obd lock (class_unlink_export), which means we can't
612                  * lose the last ref on the export.  If they've already been
613                  * removed from the list, we won't find them here.
614                  */
615                 spin_lock(&obd->obd_dev_lock);
616                 while (!list_empty(&obd->obd_exports_timed)) {
617                         exp = list_entry(obd->obd_exports_timed.next,
618                                          struct obd_export,
619                                          exp_obd_chain_timed);
620                         if (expire_time > exp->exp_last_request_time) {
621                                 struct obd_uuid *client_uuid;
622
623                                 class_export_get(exp);
624                                 client_uuid = &exp->exp_client_uuid;
625                                 spin_unlock(&obd->obd_dev_lock);
626                                 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",
627                                               obd->obd_name,
628                                               obd_uuid2str(client_uuid),
629                                               obd_export_nid2str(exp),
630                                               ktime_get_real_seconds() -
631                                               exp->exp_last_request_time,
632                                               exp, ktime_get_real_seconds(),
633                                               expire_time,
634                                               exp->exp_last_request_time);
635                                 CDEBUG(D_HA, "Last request was at %lld\n",
636                                        exp->exp_last_request_time);
637                                 class_fail_export(exp);
638                                 class_export_put(exp);
639                                 spin_lock(&obd->obd_dev_lock);
640                         } else {
641                                 /* List is sorted, so everyone below is ok */
642                                 break;
643                         }
644                 }
645                 spin_unlock(&obd->obd_dev_lock);
646
647                 spin_lock(&pet_lock);
648                 list_del_init(&obd->obd_evict_list);
649                 spin_unlock(&pet_lock);
650
651                 class_decref(obd, "evictor", obd);
652         }
653         CDEBUG(D_HA, "Exiting Ping Evictor\n");
654
655         RETURN(0);
656 }
657
658 void ping_evictor_start(void)
659 {
660         struct task_struct *task;
661
662         if (++pet_refcount > 1)
663                 return;
664
665         init_waitqueue_head(&pet_waitq);
666
667         task = kthread_run(ping_evictor_main, NULL, "ll_evictor");
668         if (IS_ERR(task)) {
669                 pet_refcount--;
670                 CERROR("Cannot start ping evictor thread: %ld\n",
671                         PTR_ERR(task));
672         }
673 }
674 EXPORT_SYMBOL(ping_evictor_start);
675
676 void ping_evictor_stop(void)
677 {
678         if (--pet_refcount > 0)
679                 return;
680
681         pet_state = PET_TERMINATE;
682         wake_up(&pet_waitq);
683 }
684 EXPORT_SYMBOL(ping_evictor_stop);