Whamcloud - gitweb
53335f72d6b0022b122508a191e9f5287d1d8d12
[fs/lustre-release.git] / lustre / ptlrpc / pinger.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Portal-RPC reconnection and replay operations, for use in recovery.
5  *
6  *  Copyright (c) 2003 Cluster File Systems, Inc.
7  *   Authors: Phil Schwan <phil@clusterfs.com>
8  *            Mike Shaver <shaver@clusterfs.com>
9  *
10  *   This file is part of the Lustre file system, http://www.lustre.org
11  *   Lustre is a trademark of Cluster File Systems, Inc.
12  *
13  *   You may have signed or agreed to another license before downloading
14  *   this software.  If so, you are bound by the terms and conditions
15  *   of that agreement, and the following does not apply to you.  See the
16  *   LICENSE file included with this distribution for more information.
17  *
18  *   If you did not agree to a different license, then this copy of Lustre
19  *   is open source software; you can redistribute it and/or modify it
20  *   under the terms of version 2 of the GNU General Public License as
21  *   published by the Free Software Foundation.
22  *
23  *   In either case, Lustre is distributed in the hope that it will be
24  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
25  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  *   license text for more details.
27  */
28
29 #ifndef __KERNEL__
30 #include <liblustre.h>
31 #else
32 #define DEBUG_SUBSYSTEM S_RPC
33 #endif
34
35 #include <obd_support.h>
36 #include <obd_class.h>
37 #include "ptlrpc_internal.h"
38
39 struct semaphore pinger_sem;
40 static struct list_head pinger_imports = CFS_LIST_HEAD_INIT(pinger_imports);
41
42 int ptlrpc_ping(struct obd_import *imp)
43 {
44         struct ptlrpc_request *req;
45         int rc = 0;
46         ENTRY;
47
48         req = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION, OBD_PING, 0, NULL, NULL);
49         if (req) {
50                 DEBUG_REQ(D_INFO, req, "pinging %s->%s",
51                           imp->imp_obd->obd_uuid.uuid,
52                           obd2cli_tgt(imp->imp_obd));
53                 req->rq_no_resend = req->rq_no_delay = 1;
54                 req->rq_replen = lustre_msg_size(0, NULL);
55                 ptlrpcd_add_req(req);
56         } else {
57                 CERROR("OOM trying to ping %s->%s\n",
58                        imp->imp_obd->obd_uuid.uuid,
59                        obd2cli_tgt(imp->imp_obd));
60                 rc = -ENOMEM;
61         }
62
63         RETURN(rc);
64 }
65
66 static void ptlrpc_update_next_ping(struct obd_import *imp)
67 {
68         imp->imp_next_ping = cfs_time_shift(
69                                 (imp->imp_state == LUSTRE_IMP_DISCON ?
70                                  RECONNECT_INTERVAL : PING_INTERVAL));
71 }
72
73 void ptlrpc_ping_import_soon(struct obd_import *imp)
74 {
75         imp->imp_next_ping = cfs_time_current();
76 }
77
78 #ifdef __KERNEL__
79 static int ptlrpc_pinger_main(void *arg)
80 {
81         struct ptlrpc_svc_data *data = (struct ptlrpc_svc_data *)arg;
82         struct ptlrpc_thread *thread = data->thread;
83         ENTRY;
84
85         cfs_daemonize(data->name);
86
87         /* Record that the thread is running */
88         thread->t_flags = SVC_RUNNING;
89         cfs_waitq_signal(&thread->t_ctl_waitq);
90
91         /* And now, loop forever, pinging as needed. */
92         while (1) {
93                 cfs_time_t this_ping = cfs_time_current();
94                 struct l_wait_info lwi;
95                 cfs_duration_t time_to_next_ping;
96                 struct list_head *iter;
97
98                 mutex_down(&pinger_sem);
99                 list_for_each(iter, &pinger_imports) {
100                         struct obd_import *imp =
101                                 list_entry(iter, struct obd_import,
102                                            imp_pinger_chain);
103                         int force, level;
104                         unsigned long flags;
105
106                         spin_lock_irqsave(&imp->imp_lock, flags);
107                         level = imp->imp_state;
108                         force = imp->imp_force_verify;
109                         imp->imp_force_verify = 0;
110                         spin_unlock_irqrestore(&imp->imp_lock, flags);
111
112                         CDEBUG_EX(level == LUSTRE_IMP_FULL ? D_INFO : D_HA,
113                                "level %s/%u force %u deactive %u pingable %u\n",
114                                ptlrpc_import_state_name(level), level,
115                                force, imp->imp_deactive, imp->imp_pingable);
116
117                         if (force ||
118                             /* if the next ping is within, say, 5 jiffies from
119                                now, go ahead and ping. See note below. */
120                             cfs_time_aftereq(this_ping, 
121                                              imp->imp_next_ping - 5 * CFS_TICK)) {
122                                 if (level == LUSTRE_IMP_DISCON &&
123                                     !imp->imp_deactive) {
124                                         /* wait at least a timeout before
125                                            trying recovery again. */
126                                         imp->imp_next_ping = cfs_time_shift(obd_timeout);
127                                         ptlrpc_initiate_recovery(imp);
128                                 } else if (level != LUSTRE_IMP_FULL ||
129                                          imp->imp_obd->obd_no_recov ||
130                                          imp->imp_deactive) {
131                                         CDEBUG(D_HA, "not pinging %s "
132                                                "(in recovery: %s or recovery "
133                                                "disabled: %u/%u)\n",
134                                                obd2cli_tgt(imp->imp_obd),
135                                                ptlrpc_import_state_name(level),
136                                                imp->imp_deactive,
137                                                imp->imp_obd->obd_no_recov);
138                                 } else if (imp->imp_pingable || force) {
139                                         ptlrpc_ping(imp);
140                                 }
141                         } else {
142                                 if (!imp->imp_pingable)
143                                         continue;
144                                 CDEBUG(D_INFO,
145                                        "don't need to ping %s ("CFS_TIME_T
146                                        " > "CFS_TIME_T")\n",
147                                        obd2cli_tgt(imp->imp_obd),
148                                        imp->imp_next_ping, this_ping);
149                         }
150
151                         /* obd_timeout might have changed */
152                         if (cfs_time_after(imp->imp_next_ping,
153                                            cfs_time_add(this_ping, 
154                                                         cfs_time_seconds(PING_INTERVAL))))
155                                 ptlrpc_update_next_ping(imp);
156                 }
157                 mutex_up(&pinger_sem);
158
159                 /* Wait until the next ping time, or until we're stopped. */
160                 time_to_next_ping = cfs_time_sub(cfs_time_add(this_ping, 
161                                                               cfs_time_seconds(PING_INTERVAL)), 
162                                                  cfs_time_current());
163
164                 /* The ping sent by ptlrpc_send_rpc may get sent out
165                    say .01 second after this.
166                    ptlrpc_pinger_eending_on_import will then set the
167                    next ping time to next_ping + .01 sec, which means
168                    we will SKIP the next ping at next_ping, and the
169                    ping will get sent 2 timeouts from now!  Beware. */
170                 CDEBUG(D_INFO, "next ping in "CFS_DURATION_T" ("CFS_TIME_T")\n", 
171                                time_to_next_ping, 
172                                cfs_time_add(this_ping, cfs_time_seconds(PING_INTERVAL)));
173                 if (time_to_next_ping > 0) {
174                         lwi = LWI_TIMEOUT(max_t(cfs_duration_t, time_to_next_ping, cfs_time_seconds(1)),
175                                           NULL, NULL);
176                         l_wait_event(thread->t_ctl_waitq,
177                                      thread->t_flags & (SVC_STOPPING|SVC_EVENT),
178                                      &lwi);
179                         if (thread->t_flags & SVC_STOPPING) {
180                                 thread->t_flags &= ~SVC_STOPPING;
181                                 EXIT;
182                                 break;
183                         } else if (thread->t_flags & SVC_EVENT) {
184                                 /* woken after adding import to reset timer */
185                                 thread->t_flags &= ~SVC_EVENT;
186                         }
187                 }
188         }
189
190         thread->t_flags = SVC_STOPPED;
191         cfs_waitq_signal(&thread->t_ctl_waitq);
192
193         CDEBUG(D_NET, "pinger thread exiting, process %d\n", cfs_curproc_pid());
194         return 0;
195 }
196
197 static struct ptlrpc_thread *pinger_thread = NULL;
198
199 int ptlrpc_start_pinger(void)
200 {
201         struct l_wait_info lwi = { 0 };
202         struct ptlrpc_svc_data d;
203         int rc;
204 #ifndef ENABLE_PINGER
205         return 0;
206 #endif
207         ENTRY;
208
209         if (pinger_thread != NULL)
210                 RETURN(-EALREADY);
211
212         OBD_ALLOC(pinger_thread, sizeof(*pinger_thread));
213         if (pinger_thread == NULL)
214                 RETURN(-ENOMEM);
215         cfs_waitq_init(&pinger_thread->t_ctl_waitq);
216
217         d.name = "ll_ping";
218         d.thread = pinger_thread;
219
220         /* CLONE_VM and CLONE_FILES just avoid a needless copy, because we
221          * just drop the VM and FILES in ptlrpc_daemonize() right away. */
222         rc = cfs_kernel_thread(ptlrpc_pinger_main, &d, CLONE_VM | CLONE_FILES);
223         if (rc < 0) {
224                 CERROR("cannot start thread: %d\n", rc);
225                 OBD_FREE(pinger_thread, sizeof(*pinger_thread));
226                 pinger_thread = NULL;
227                 RETURN(rc);
228         }
229         l_wait_event(pinger_thread->t_ctl_waitq,
230                      pinger_thread->t_flags & SVC_RUNNING, &lwi);
231
232         RETURN(0);
233 }
234
235 int ptlrpc_stop_pinger(void)
236 {
237         struct l_wait_info lwi = { 0 };
238         int rc = 0;
239 #ifndef ENABLE_PINGER
240         return 0;
241 #endif
242         ENTRY;
243
244         if (pinger_thread == NULL)
245                 RETURN(-EALREADY);
246         mutex_down(&pinger_sem);
247         pinger_thread->t_flags = SVC_STOPPING;
248         cfs_waitq_signal(&pinger_thread->t_ctl_waitq);
249         mutex_up(&pinger_sem);
250
251         l_wait_event(pinger_thread->t_ctl_waitq,
252                      (pinger_thread->t_flags & SVC_STOPPED), &lwi);
253
254         OBD_FREE(pinger_thread, sizeof(*pinger_thread));
255         pinger_thread = NULL;
256         RETURN(rc);
257 }
258
259 void ptlrpc_pinger_sending_on_import(struct obd_import *imp)
260 {
261         ptlrpc_update_next_ping(imp);
262 }
263
264 int ptlrpc_pinger_add_import(struct obd_import *imp)
265 {
266         ENTRY;
267         if (!list_empty(&imp->imp_pinger_chain))
268                 RETURN(-EALREADY);
269
270         mutex_down(&pinger_sem);
271         CDEBUG(D_HA, "adding pingable import %s->%s\n",
272                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
273         ptlrpc_update_next_ping(imp);
274         /* XXX sort, blah blah */
275         list_add_tail(&imp->imp_pinger_chain, &pinger_imports);
276         class_import_get(imp);
277
278         ptlrpc_pinger_wake_up();
279         mutex_up(&pinger_sem);
280
281         RETURN(0);
282 }
283
284 int ptlrpc_pinger_del_import(struct obd_import *imp)
285 {
286         ENTRY;
287         if (list_empty(&imp->imp_pinger_chain))
288                 RETURN(-ENOENT);
289
290         mutex_down(&pinger_sem);
291         list_del_init(&imp->imp_pinger_chain);
292         CDEBUG(D_HA, "removing pingable import %s->%s\n",
293                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
294         class_import_put(imp);
295         mutex_up(&pinger_sem);
296         RETURN(0);
297 }
298
299 void ptlrpc_pinger_wake_up()
300 {
301 #ifdef ENABLE_PINGER
302         pinger_thread->t_flags |= SVC_EVENT;
303         cfs_waitq_signal(&pinger_thread->t_ctl_waitq);
304 #endif
305 }
306
307 /* Ping evictor thread */
308 #define PET_READY     1
309 #define PET_TERMINATE 2
310
311 static int               pet_refcount = 0;
312 static int               pet_state;
313 static wait_queue_head_t pet_waitq;
314 static struct obd_export *pet_exp = NULL;
315 static spinlock_t        pet_lock = SPIN_LOCK_UNLOCKED;
316
317 int ping_evictor_wake(struct obd_export *exp)
318 {
319         spin_lock(&pet_lock);
320         if (pet_exp) {
321                 /* eventually the new obd will call here again. */
322                 spin_unlock(&pet_lock);
323                 return 1;
324         }
325
326         /* We have to make sure the obd isn't destroyed between now and when
327          * the ping evictor runs.  We'll take a reference here, and drop it
328          * when we finish in the evictor.  We don't really care about this
329          * export in particular; we just need one to keep the obd alive. */
330         pet_exp = class_export_get(exp);
331         spin_unlock(&pet_lock);
332
333         wake_up(&pet_waitq);
334         return 0;
335 }
336
337 static int ping_evictor_main(void *arg)
338 {
339         struct obd_device *obd;
340         struct obd_export *exp;
341         struct l_wait_info lwi = { 0 };
342         time_t expire_time;
343         ENTRY;
344
345         ptlrpc_daemonize("ll_evictor");
346
347         CDEBUG(D_HA, "Starting Ping Evictor\n");
348         pet_exp = NULL;
349         pet_state = PET_READY;
350         while (1) {
351                 l_wait_event(pet_waitq, pet_exp ||
352                              (pet_state == PET_TERMINATE), &lwi);
353                 if (pet_state == PET_TERMINATE)
354                         break;
355
356                 /* we only get here if pet_exp != NULL, and the end of this
357                  * loop is the only place which sets it NULL again, so lock
358                  * is not strictly necessary. */
359                 spin_lock(&pet_lock);
360                 obd = pet_exp->exp_obd;
361                 spin_unlock(&pet_lock);
362
363                 expire_time = CURRENT_SECONDS - (3 * obd_timeout / 2);
364
365                 CDEBUG(D_HA, "evicting all exports of obd %s older than %ld\n",
366                        obd->obd_name, expire_time);
367
368                 /* Exports can't be deleted out of the list while we hold
369                  * the obd lock (class_unlink_export), which means we can't
370                  * lose the last ref on the export.  If they've already been
371                  * removed from the list, we won't find them here. */
372                 spin_lock(&obd->obd_dev_lock);
373                 while (!list_empty(&obd->obd_exports_timed)) {
374                         exp = list_entry(obd->obd_exports_timed.next,
375                                          struct obd_export,exp_obd_chain_timed);
376
377                         if (expire_time > exp->exp_last_request_time) {
378                                 class_export_get(exp);
379                                 spin_unlock(&obd->obd_dev_lock);
380                                 LCONSOLE_WARN("%s: haven't heard from %s in %ld"
381                                               " seconds. Last request was at %ld. "
382                                               "I think it's dead, and I am evicting "
383                                               "it.\n", obd->obd_name,
384                                               obd_export_nid2str(exp),
385                                               (long)(CURRENT_SECONDS -
386                                                      exp->exp_last_request_time),
387                                               exp->exp_last_request_time);
388
389
390                                 class_fail_export(exp);
391                                 class_export_put(exp);
392
393                                 spin_lock(&obd->obd_dev_lock);
394                         } else {
395                                 /* List is sorted, so everyone below is ok */
396                                 break;
397                         }
398                 }
399                 spin_unlock(&obd->obd_dev_lock);
400
401                 class_export_put(pet_exp);
402
403                 spin_lock(&pet_lock);
404                 pet_exp = NULL;
405                 spin_unlock(&pet_lock);
406         }
407         CDEBUG(D_HA, "Exiting Ping Evictor\n");
408
409         RETURN(0);
410 }
411
412 void ping_evictor_start(void)
413 {
414         int rc;
415
416         if (++pet_refcount > 1)
417                 return;
418
419         init_waitqueue_head(&pet_waitq);
420
421         rc = cfs_kernel_thread(ping_evictor_main, NULL, CLONE_VM | CLONE_FILES);
422         if (rc < 0) {
423                 pet_refcount--;
424                 CERROR("Cannot start ping evictor thread: %d\n", rc);
425         }
426 }
427 EXPORT_SYMBOL(ping_evictor_start);
428
429 void ping_evictor_stop(void)
430 {
431         if (--pet_refcount > 0)
432                 return;
433
434         pet_state = PET_TERMINATE;
435         wake_up(&pet_waitq);
436 }
437 EXPORT_SYMBOL(ping_evictor_stop);
438 #else /* !__KERNEL__ */
439
440 /* XXX
441  * the current implementation of pinger in liblustre is not optimized
442  */
443
444 #ifdef ENABLE_PINGER
445 static struct pinger_data {
446         int             pd_recursion;
447         cfs_time_t      pd_this_ping;   /* jiffies */
448         cfs_time_t      pd_next_ping;   /* jiffies */
449         struct ptlrpc_request_set *pd_set;
450 } pinger_args;
451
452 static int pinger_check_rpcs(void *arg)
453 {
454         cfs_time_t curtime = cfs_time_current();
455         struct ptlrpc_request *req;
456         struct ptlrpc_request_set *set;
457         struct list_head *iter;
458         struct pinger_data *pd = &pinger_args;
459         int rc;
460
461         /* prevent recursion */
462         if (pd->pd_recursion++) {
463                 CDEBUG(D_HA, "pinger: recursion! quit\n");
464                 LASSERT(pd->pd_set);
465                 pd->pd_recursion--;
466                 return 0;
467         }
468
469         /* have we reached ping point? */
470         if (!pd->pd_set && time_before(curtime, pd->pd_next_ping)) {
471                 pd->pd_recursion--;
472                 return 0;
473         }
474
475         /* if we have rpc_set already, continue processing it */
476         if (pd->pd_set) {
477                 LASSERT(pd->pd_this_ping);
478                 set = pd->pd_set;
479                 goto do_check_set;
480         }
481
482         pd->pd_this_ping = curtime;
483         pd->pd_set = ptlrpc_prep_set();
484         if (pd->pd_set == NULL)
485                 goto out;
486         set = pd->pd_set;
487
488         /* add rpcs into set */
489         mutex_down(&pinger_sem);
490         list_for_each(iter, &pinger_imports) {
491                 struct obd_import *imp =
492                         list_entry(iter, struct obd_import, imp_pinger_chain);
493                 int generation, level;
494                 unsigned long flags;
495
496                 if (cfs_time_aftereq(pd->pd_this_ping, 
497                                      imp->imp_next_ping - 5 * CFS_TICK)) {
498                         /* Add a ping. */
499                         spin_lock_irqsave(&imp->imp_lock, flags);
500                         generation = imp->imp_generation;
501                         level = imp->imp_state;
502                         spin_unlock_irqrestore(&imp->imp_lock, flags);
503
504                         if (level != LUSTRE_IMP_FULL) {
505                                 CDEBUG(D_HA,
506                                        "not pinging %s (in recovery)\n",
507                                        obd2cli_tgt(imp->imp_obd));
508                                 continue;
509                         }
510
511                         req = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION, OBD_PING,
512                                               0, NULL, NULL);
513                         if (!req) {
514                                 CERROR("out of memory\n");
515                                 break;
516                         }
517                         req->rq_no_resend = 1;
518                         req->rq_replen = lustre_msg_size(0, NULL);
519                         req->rq_send_state = LUSTRE_IMP_FULL;
520                         req->rq_phase = RQ_PHASE_RPC;
521                         req->rq_import_generation = generation;
522                         ptlrpc_set_add_req(set, req);
523                 } else {
524                         CDEBUG(D_HA, "don't need to ping %s ("CFS_TIME_T" > "
525                                CFS_TIME_T")\n", obd2cli_tgt(imp->imp_obd),
526                                imp->imp_next_ping, pd->pd_this_ping);
527                 }
528         }
529         pd->pd_this_ping = curtime;
530         mutex_up(&pinger_sem);
531
532         /* Might be empty, that's OK. */
533         if (set->set_remaining == 0)
534                 CDEBUG(D_HA, "nothing to ping\n");
535
536         list_for_each(iter, &set->set_requests) {
537                 struct ptlrpc_request *req =
538                         list_entry(iter, struct ptlrpc_request,
539                                    rq_set_chain);
540                 DEBUG_REQ(D_HA, req, "pinging %s->%s",
541                           req->rq_import->imp_obd->obd_uuid.uuid,
542                           obd2cli_tgt(req->rq_import->imp_obd));
543                 (void)ptl_send_rpc(req, 0);
544         }
545
546 do_check_set:
547         rc = ptlrpc_check_set(set);
548
549         /* not finished, and we are not expired, simply return */
550         if (!rc && cfs_time_before(curtime, 
551                                    cfs_time_add(pd->pd_this_ping, 
552                                                 cfs_time_seconds(PING_INTERVAL)))) {
553                 CDEBUG(D_HA, "not finished, but also not expired\n");
554                 pd->pd_recursion--;
555                 return 0;
556         }
557
558         /* Expire all the requests that didn't come back. */
559         mutex_down(&pinger_sem);
560         list_for_each(iter, &set->set_requests) {
561                 req = list_entry(iter, struct ptlrpc_request,
562                                  rq_set_chain);
563
564                 if (req->rq_replied)
565                         continue;
566
567                 req->rq_phase = RQ_PHASE_COMPLETE;
568                 set->set_remaining--;
569                 /* If it was disconnected, don't sweat it. */
570                 if (list_empty(&req->rq_import->imp_pinger_chain)) {
571                         ptlrpc_unregister_reply(req);
572                         continue;
573                 }
574
575                 CDEBUG(D_HA, "pinger initiate expire_one_request\n");
576                 ptlrpc_expire_one_request(req);
577         }
578         mutex_up(&pinger_sem);
579
580         ptlrpc_set_destroy(set);
581         pd->pd_set = NULL;
582
583 out:
584         pd->pd_next_ping = cfs_time_add(pd->pd_this_ping,
585                                         cfs_time_seconds(PING_INTERVAL));
586         pd->pd_this_ping = 0; /* XXX for debug */
587
588         CDEBUG(D_HA, "finished a round ping\n");
589         pd->pd_recursion--;
590         return 0;
591 }
592
593 static void *pinger_callback = NULL;
594 #endif /* ENABLE_PINGER */
595
596 int ptlrpc_start_pinger(void)
597 {
598 #ifdef ENABLE_PINGER
599         memset(&pinger_args, 0, sizeof(pinger_args));
600         pinger_callback = liblustre_register_wait_callback(&pinger_check_rpcs,
601                                                            &pinger_args);
602 #endif
603         return 0;
604 }
605
606 int ptlrpc_stop_pinger(void)
607 {
608 #ifdef ENABLE_PINGER
609         if (pinger_callback)
610                 liblustre_deregister_wait_callback(pinger_callback);
611 #endif
612         return 0;
613 }
614
615 void ptlrpc_pinger_sending_on_import(struct obd_import *imp)
616 {
617 #ifdef ENABLE_PINGER
618         mutex_down(&pinger_sem);
619         ptlrpc_update_next_ping(imp);
620         if (pinger_args.pd_set == NULL &&
621             time_before(imp->imp_next_ping, pinger_args.pd_next_ping)) {
622                 CDEBUG(D_HA, "set next ping to "CFS_TIME_T"(cur "CFS_TIME_T")\n",
623                         imp->imp_next_ping, cfs_time_current());
624                 pinger_args.pd_next_ping = imp->imp_next_ping;
625         }
626         mutex_up(&pinger_sem);
627 #endif
628 }
629
630 int ptlrpc_pinger_add_import(struct obd_import *imp)
631 {
632         ENTRY;
633         if (!list_empty(&imp->imp_pinger_chain))
634                 RETURN(-EALREADY);
635
636         CDEBUG(D_HA, "adding pingable import %s->%s\n",
637                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
638         ptlrpc_pinger_sending_on_import(imp);
639
640         mutex_down(&pinger_sem);
641         list_add_tail(&imp->imp_pinger_chain, &pinger_imports);
642         class_import_get(imp);
643         mutex_up(&pinger_sem);
644
645         RETURN(0);
646 }
647
648 int ptlrpc_pinger_del_import(struct obd_import *imp)
649 {
650         ENTRY;
651         if (list_empty(&imp->imp_pinger_chain))
652                 RETURN(-ENOENT);
653
654         mutex_down(&pinger_sem);
655         list_del_init(&imp->imp_pinger_chain);
656         CDEBUG(D_HA, "removing pingable import %s->%s\n",
657                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
658         class_import_put(imp);
659         mutex_up(&pinger_sem);
660         RETURN(0);
661 }
662
663 void ptlrpc_pinger_wake_up()
664 {
665 #ifdef ENABLE_PINGER
666         /* XXX force pinger to run, if needed */
667 #endif
668 }
669 #endif /* !__KERNEL__ */