Whamcloud - gitweb
src needs to be in the options list if it is going to be available for use.
[fs/lustre-release.git] / lustre / ptlrpc / recov_thread.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2003 Cluster File Systems, Inc.
5  *   Author: Andreas Dilger <adilger@clusterfs.com>
6  *
7  *   This file is part of Lustre, http://www.lustre.org.
8  *
9  *   Lustre is free software; you can redistribute it and/or
10  *   modify it under the terms of version 2 of the GNU General Public
11  *   License as published by the Free Software Foundation.
12  *
13  *   Lustre is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with Lustre; if not, write to the Free Software
20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * OST<->MDS recovery logging thread.
23  *
24  * Invariants in implementation:
25  * - we do not share logs among different OST<->MDS connections, so that
26  *   if an OST or MDS fails it need only look at log(s) relevant to itself
27  */
28
29 #define DEBUG_SUBSYSTEM S_LOG
30
31 #ifndef EXPORT_SYMTAB
32 # define EXPORT_SYMTAB
33 #endif
34
35 #ifdef __KERNEL__
36 #include <linux/fs.h>
37 #else
38 # include <libcfs/list.h>
39 # include <liblustre.h>
40 #endif
41
42 #include <libcfs/kp30.h>
43 #include <linux/obd_class.h>
44 #include <linux/lustre_commit_confd.h>
45 #include <linux/obd_support.h>
46 #include <linux/obd_class.h>
47 #include <linux/lustre_net.h>
48 #include <portals/types.h>
49 #include <libcfs/list.h>
50 #include <linux/lustre_log.h>
51 #include "ptlrpc_internal.h"
52
53 #define LLCD_SIZE 4096
54
55 #ifdef __KERNEL__
56
57 static struct llog_commit_master lustre_lcm;
58 static struct llog_commit_master *lcm = &lustre_lcm;
59
60 /* Allocate new commit structs in case we do not have enough */
61 static int llcd_alloc(void)
62 {
63         struct llog_canceld_ctxt *llcd;
64         int offset = offsetof(struct llog_canceld_ctxt, llcd_cookies);
65
66         OBD_ALLOC(llcd, LLCD_SIZE + offset);
67         if (llcd == NULL)
68                 return -ENOMEM;
69
70         llcd->llcd_lcm = lcm;
71
72         spin_lock(&lcm->lcm_llcd_lock);
73         list_add(&llcd->llcd_list, &lcm->lcm_llcd_free);
74         atomic_inc(&lcm->lcm_llcd_numfree);
75         spin_unlock(&lcm->lcm_llcd_lock);
76
77         return 0;
78 }
79
80 /* Get a free cookie struct from the list */
81 struct llog_canceld_ctxt *llcd_grab(void)
82 {
83         struct llog_canceld_ctxt *llcd;
84
85         spin_lock(&lcm->lcm_llcd_lock);
86         if (list_empty(&lcm->lcm_llcd_free)) {
87                 spin_unlock(&lcm->lcm_llcd_lock);
88                 if (llcd_alloc() < 0) {
89                         CERROR("unable to allocate log commit data!\n");
90                         return NULL;
91                 }
92                 spin_lock(&lcm->lcm_llcd_lock);
93         }
94
95         llcd = list_entry(lcm->lcm_llcd_free.next, typeof(*llcd), llcd_list);
96         list_del(&llcd->llcd_list);
97         atomic_dec(&lcm->lcm_llcd_numfree);
98         spin_unlock(&lcm->lcm_llcd_lock);
99
100         llcd->llcd_tries = 0;
101         llcd->llcd_cookiebytes = 0;
102
103         return llcd;
104 }
105 EXPORT_SYMBOL(llcd_grab);
106
107 static void llcd_put(struct llog_canceld_ctxt *llcd)
108 {
109         int offset = offsetof(struct llog_canceld_ctxt, llcd_cookies);
110
111         if (atomic_read(&lcm->lcm_llcd_numfree) >= lcm->lcm_llcd_maxfree) {
112                 OBD_FREE(llcd, LLCD_SIZE + offset);
113         } else {
114                 spin_lock(&lcm->lcm_llcd_lock);
115                 list_add(&llcd->llcd_list, &lcm->lcm_llcd_free);
116                 atomic_inc(&lcm->lcm_llcd_numfree);
117                 spin_unlock(&lcm->lcm_llcd_lock);
118         }
119 }
120
121 /* Send some cookies to the appropriate target */
122 void llcd_send(struct llog_canceld_ctxt *llcd)
123 {
124         spin_lock(&llcd->llcd_lcm->lcm_llcd_lock);
125         list_add_tail(&llcd->llcd_list, &llcd->llcd_lcm->lcm_llcd_pending);
126         spin_unlock(&llcd->llcd_lcm->lcm_llcd_lock);
127
128         wake_up_nr(&llcd->llcd_lcm->lcm_waitq, 1);
129 }
130 EXPORT_SYMBOL(llcd_send);
131
132 /* deleted objects have a commit callback that cancels the MDS
133  * log record for the deletion.  The commit callback calls this
134  * function
135  */
136 int llog_obd_repl_cancel(struct llog_ctxt *ctxt, int count,
137                          struct llog_cookie *cookies, int flags, void *data)
138 {
139         struct llog_canceld_ctxt *llcd;
140         int rc = 0;
141         ENTRY;
142
143         LASSERT(ctxt);
144         down(&ctxt->loc_sem);
145         if (ctxt->loc_imp == NULL) {
146                 CWARN("no import for ctxt %p\n", ctxt);
147                 GOTO(out, rc = 0);
148         }
149
150         llcd = ctxt->loc_llcd;
151         if (count > 0 && cookies != NULL) {
152                 if (llcd == NULL) {      
153                         llcd = llcd_grab();
154                         if (llcd == NULL) {
155                                 CERROR("couldn't get an llcd - dropped "LPX64":%x+%u\n",
156                                        cookies->lgc_lgl.lgl_oid,
157                                        cookies->lgc_lgl.lgl_ogen, cookies->lgc_index);
158                                 GOTO(out, rc = -ENOMEM);
159                         }
160                         llcd->llcd_ctxt = ctxt;
161                         ctxt->loc_llcd = llcd;
162                 }
163                 memcpy((char *)llcd->llcd_cookies + llcd->llcd_cookiebytes,
164                        cookies, sizeof(*cookies));
165                 llcd->llcd_cookiebytes += sizeof(*cookies);
166         } else {
167                 if (llcd == NULL || !(flags & OBD_LLOG_FL_SENDNOW))
168                         GOTO(out, rc);
169         }
170
171         if ((LLCD_SIZE - llcd->llcd_cookiebytes < sizeof(*cookies) ||
172              flags & OBD_LLOG_FL_SENDNOW)) {
173                 CDEBUG(D_HA, "send llcd %p:%p\n", llcd, llcd->llcd_ctxt);
174                 ctxt->loc_llcd = NULL;
175                 llcd_send(llcd);
176         }
177 out:
178         up(&ctxt->loc_sem);
179         return rc;
180 }
181 EXPORT_SYMBOL(llog_obd_repl_cancel);
182
183 int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp)
184 {
185         int rc = 0;
186         ENTRY;
187
188         if (exp && (ctxt->loc_imp == exp->exp_imp_reverse)) {
189                 down(&ctxt->loc_sem);
190                 if (ctxt->loc_llcd != NULL) {
191                         llcd_put(ctxt->loc_llcd);
192                         ctxt->loc_llcd = NULL;
193                 }
194                 CWARN("reverse import disconnected, put "
195                       "llcd %p:%p\n", ctxt->loc_llcd, ctxt);
196                 ctxt->loc_imp = NULL;
197                 up(&ctxt->loc_sem);
198         } else {
199                 rc = llog_cancel(ctxt, 0, NULL, OBD_LLOG_FL_SENDNOW, NULL);
200         }
201
202         RETURN(rc);
203 }
204 EXPORT_SYMBOL(llog_obd_repl_sync);
205
206 static int log_commit_thread(void *arg)
207 {
208         struct llog_commit_master *lcm = arg;
209         struct llog_commit_daemon *lcd;
210         struct llog_canceld_ctxt *llcd, *n;
211         unsigned long flags;
212         ENTRY;
213
214         OBD_ALLOC(lcd, sizeof(*lcd));
215         if (lcd == NULL)
216                 RETURN(-ENOMEM);
217
218         lock_kernel();
219         ptlrpc_daemonize(); /* thread never needs to do IO */
220
221         SIGNAL_MASK_LOCK(current, flags);
222         sigfillset(&current->blocked);
223         RECALC_SIGPENDING;
224         SIGNAL_MASK_UNLOCK(current, flags);
225
226         spin_lock(&lcm->lcm_thread_lock);
227
228         THREAD_NAME(current->comm, sizeof(current->comm) - 1,
229                     "ll_log_comt_%02d", atomic_read(&lcm->lcm_thread_total));
230         atomic_inc(&lcm->lcm_thread_total);
231         spin_unlock(&lcm->lcm_thread_lock);
232         unlock_kernel();
233
234         INIT_LIST_HEAD(&lcd->lcd_lcm_list);
235         INIT_LIST_HEAD(&lcd->lcd_llcd_list);
236         lcd->lcd_lcm = lcm;
237
238         CDEBUG(D_HA, "%s started\n", current->comm);
239         do {
240                 struct ptlrpc_request *request;
241                 struct obd_import *import = NULL;
242                 struct list_head *sending_list;
243                 int rc = 0;
244
245                 /* If we do not have enough pages available, allocate some */
246                 while (atomic_read(&lcm->lcm_llcd_numfree) <
247                        lcm->lcm_llcd_minfree) {
248                         if (llcd_alloc() < 0)
249                                 break;
250                 }
251
252                 spin_lock(&lcm->lcm_thread_lock);
253                 atomic_inc(&lcm->lcm_thread_numidle);
254                 list_move(&lcd->lcd_lcm_list, &lcm->lcm_thread_idle);
255                 spin_unlock(&lcm->lcm_thread_lock);
256
257                 wait_event_interruptible(lcm->lcm_waitq,
258                                          !list_empty(&lcm->lcm_llcd_pending) ||
259                                          lcm->lcm_flags & LLOG_LCM_FL_EXIT);
260
261                 /* If we are the last available thread, start a new one in case
262                  * we get blocked on an RPC (nobody else will start a new one)*/
263                 spin_lock(&lcm->lcm_thread_lock);
264                 atomic_dec(&lcm->lcm_thread_numidle);
265                 list_move(&lcd->lcd_lcm_list, &lcm->lcm_thread_busy);
266                 spin_unlock(&lcm->lcm_thread_lock);
267
268                 sending_list = &lcm->lcm_llcd_pending;
269         resend:
270                 if (lcm->lcm_flags & LLOG_LCM_FL_EXIT) {
271                         lcm->lcm_llcd_maxfree = 0;
272                         lcm->lcm_llcd_minfree = 0;
273                         lcm->lcm_thread_max = 0;
274
275                         if (list_empty(&lcm->lcm_llcd_pending) ||
276                             lcm->lcm_flags & LLOG_LCM_FL_EXIT_FORCE)
277                                 break;
278                 }
279
280                 if (atomic_read(&lcm->lcm_thread_numidle) <= 1 &&
281                     atomic_read(&lcm->lcm_thread_total) < lcm->lcm_thread_max) {
282                         rc = llog_start_commit_thread();
283                         if (rc < 0)
284                                 CERROR("error starting thread: rc %d\n", rc);
285                 }
286
287                 /* Move all of the pending cancels from the same OST off of
288                  * the list, so we don't get multiple threads blocked and/or
289                  * doing upcalls on the same OST in case of failure. */
290                 spin_lock(&lcm->lcm_llcd_lock);
291                 if (!list_empty(sending_list)) {
292                         list_move_tail(sending_list->next,
293                                        &lcd->lcd_llcd_list);
294                         llcd = list_entry(lcd->lcd_llcd_list.next,
295                                           typeof(*llcd), llcd_list);
296                         LASSERT(llcd->llcd_lcm == lcm);
297                         import = llcd->llcd_ctxt->loc_imp;
298                 }
299                 list_for_each_entry_safe(llcd, n, sending_list, llcd_list) {
300                         LASSERT(llcd->llcd_lcm == lcm);
301                         if (import == llcd->llcd_ctxt->loc_imp)
302                                 list_move_tail(&llcd->llcd_list,
303                                                &lcd->lcd_llcd_list);
304                 }
305                 if (sending_list != &lcm->lcm_llcd_resend) {
306                         list_for_each_entry_safe(llcd, n, &lcm->lcm_llcd_resend,
307                                                  llcd_list) {
308                                 LASSERT(llcd->llcd_lcm == lcm);
309                                 if (import == llcd->llcd_ctxt->loc_imp)
310                                         list_move_tail(&llcd->llcd_list,
311                                                        &lcd->lcd_llcd_list);
312                         }
313                 }
314                 spin_unlock(&lcm->lcm_llcd_lock);
315
316                 /* We are the only one manipulating our local list - no lock */
317                 list_for_each_entry_safe(llcd,n, &lcd->lcd_llcd_list,llcd_list){
318                         char *bufs[1] = {(char *)llcd->llcd_cookies};
319
320                         list_del(&llcd->llcd_list);
321                         if (llcd->llcd_cookiebytes == 0) {
322                                 CDEBUG(D_HA, "put empty llcd %p:%p\n",
323                                        llcd, llcd->llcd_ctxt);
324                                 llcd_put(llcd);
325                                 continue;
326                         }
327
328                         down(&llcd->llcd_ctxt->loc_sem);
329                         if (llcd->llcd_ctxt->loc_imp == NULL) {
330                                 up(&llcd->llcd_ctxt->loc_sem);
331                                 CWARN("import will be destroyed, put "
332                                       "llcd %p:%p\n", llcd, llcd->llcd_ctxt);
333                                 llcd_put(llcd);
334                                 continue;
335                         }
336
337                         up(&llcd->llcd_ctxt->loc_sem);
338                         request = ptlrpc_prep_req(import, LUSTRE_LOG_VERSION,
339                                                   OBD_LOG_CANCEL, 1,
340                                                   &llcd->llcd_cookiebytes,
341                                                   bufs);
342
343                         if (request == NULL) {
344                                 rc = -ENOMEM;
345                                 CERROR("error preparing commit: rc %d\n", rc);
346
347                                 spin_lock(&lcm->lcm_llcd_lock);
348                                 list_splice(&lcd->lcd_llcd_list,
349                                             &lcm->lcm_llcd_resend);
350                                 INIT_LIST_HEAD(&lcd->lcd_llcd_list);
351                                 spin_unlock(&lcm->lcm_llcd_lock);
352                                 break;
353                         }
354
355                         request->rq_replen = lustre_msg_size(0, NULL);
356                         down(&llcd->llcd_ctxt->loc_sem);
357                         if (llcd->llcd_ctxt->loc_imp == NULL) {
358                                 up(&llcd->llcd_ctxt->loc_sem);
359                                 CWARN("import will be destroyed, put "
360                                       "llcd %p:%p\n", llcd, llcd->llcd_ctxt);
361                                 llcd_put(llcd);
362                                 ptlrpc_req_finished(request);
363                                 continue;
364                         }
365                         up(&llcd->llcd_ctxt->loc_sem);
366                         rc = ptlrpc_queue_wait(request);
367                         ptlrpc_req_finished(request);
368
369                         /* If the RPC failed, we put this and the remaining
370                          * messages onto the resend list for another time. */
371                         if (rc == 0) {
372                                 llcd_put(llcd);
373                                 continue;
374                         }
375
376 #if 0                   /* FIXME just put llcd, not put it on resend list */
377                         spin_lock(&lcm->lcm_llcd_lock);
378                         list_splice(&lcd->lcd_llcd_list, &lcm->lcm_llcd_resend);
379                         if (++llcd->llcd_tries < 5) {
380                                 CERROR("commit %p failed on attempt %d: rc %d\n",
381                                        llcd, llcd->llcd_tries, rc);
382
383                                 list_add_tail(&llcd->llcd_list,
384                                               &lcm->lcm_llcd_resend);
385                                 spin_unlock(&lcm->lcm_llcd_lock);
386                         } else {
387                                 spin_unlock(&lcm->lcm_llcd_lock);
388 #endif
389                                 CERROR("commit %p:%p drop %d cookies: rc %d\n",
390                                        llcd, llcd->llcd_ctxt,
391                                        (int)(llcd->llcd_cookiebytes /
392                                              sizeof(*llcd->llcd_cookies)), rc);
393                                 llcd_put(llcd);
394 #if 0
395                         }
396                         break;
397 #endif
398                 }
399
400                 if (rc == 0) {
401                         sending_list = &lcm->lcm_llcd_resend;
402                         if (!list_empty(sending_list))
403                                 goto resend;
404                 }
405         } while(1);
406
407         /* If we are force exiting, just drop all of the cookies. */
408         if (lcm->lcm_flags & LLOG_LCM_FL_EXIT_FORCE) {
409                 spin_lock(&lcm->lcm_llcd_lock);
410                 list_splice(&lcm->lcm_llcd_pending, &lcd->lcd_llcd_list);
411                 list_splice(&lcm->lcm_llcd_resend, &lcd->lcd_llcd_list);
412                 list_splice(&lcm->lcm_llcd_free, &lcd->lcd_llcd_list);
413                 spin_unlock(&lcm->lcm_llcd_lock);
414
415                 list_for_each_entry_safe(llcd, n, &lcd->lcd_llcd_list,llcd_list)
416                         llcd_put(llcd);
417         }
418
419         spin_lock(&lcm->lcm_thread_lock);
420         list_del(&lcd->lcd_lcm_list);
421         spin_unlock(&lcm->lcm_thread_lock);
422         OBD_FREE(lcd, sizeof(*lcd));
423
424         spin_lock(&lcm->lcm_thread_lock);
425         atomic_dec(&lcm->lcm_thread_total);
426         spin_unlock(&lcm->lcm_thread_lock);
427         wake_up(&lcm->lcm_waitq);
428
429         CDEBUG(D_HA, "%s exiting\n", current->comm);
430         return 0;
431 }
432
433 int llog_start_commit_thread(void)
434 {
435         int rc;
436         ENTRY;
437
438         if (atomic_read(&lcm->lcm_thread_total) >= lcm->lcm_thread_max)
439                 RETURN(0);
440
441         rc = kernel_thread(log_commit_thread, lcm, CLONE_VM | CLONE_FILES);
442         if (rc < 0) {
443                 CERROR("error starting thread #%d: %d\n",
444                        atomic_read(&lcm->lcm_thread_total), rc);
445                 RETURN(rc);
446         }
447
448         RETURN(0);
449 }
450 EXPORT_SYMBOL(llog_start_commit_thread);
451
452 static struct llog_process_args {
453         struct semaphore         llpa_sem;
454         struct llog_ctxt        *llpa_ctxt;
455         void                    *llpa_cb;
456         void                    *llpa_arg;
457 } llpa;
458
459 int llog_init_commit_master(void)
460 {
461         INIT_LIST_HEAD(&lcm->lcm_thread_busy);
462         INIT_LIST_HEAD(&lcm->lcm_thread_idle);
463         spin_lock_init(&lcm->lcm_thread_lock);
464         atomic_set(&lcm->lcm_thread_numidle, 0);
465         init_waitqueue_head(&lcm->lcm_waitq);
466         INIT_LIST_HEAD(&lcm->lcm_llcd_pending);
467         INIT_LIST_HEAD(&lcm->lcm_llcd_resend);
468         INIT_LIST_HEAD(&lcm->lcm_llcd_free);
469         spin_lock_init(&lcm->lcm_llcd_lock);
470         atomic_set(&lcm->lcm_llcd_numfree, 0);
471         lcm->lcm_llcd_minfree = 0;
472         lcm->lcm_thread_max = 5;
473         /* FIXME initialize semaphore for llog_process_args */
474         sema_init(&llpa.llpa_sem, 1);
475         return 0;
476 }
477
478 int llog_cleanup_commit_master(int force)
479 {
480         lcm->lcm_flags |= LLOG_LCM_FL_EXIT;
481         if (force)
482                 lcm->lcm_flags |= LLOG_LCM_FL_EXIT_FORCE;
483         wake_up(&lcm->lcm_waitq);
484
485         wait_event_interruptible(lcm->lcm_waitq,
486                                  atomic_read(&lcm->lcm_thread_total) == 0);
487         return 0;
488 }
489 EXPORT_SYMBOL(llog_cleanup_commit_master);
490
491 static int log_process_thread(void *args)
492 {
493         struct llog_process_args *data = args;
494         struct llog_ctxt *ctxt = data->llpa_ctxt;
495         void   *cb = data->llpa_cb;
496         struct llog_logid logid = *(struct llog_logid *)(data->llpa_arg);
497         struct llog_handle *llh = NULL;
498         unsigned long flags;
499         int rc;
500         ENTRY;
501
502         up(&data->llpa_sem);
503         lock_kernel();
504         ptlrpc_daemonize(); /* thread never needs to do IO */
505
506         THREAD_NAME(current->comm, sizeof(current->comm) - 1, "llog_process");
507         SIGNAL_MASK_LOCK(current, flags);
508         sigfillset(&current->blocked);
509         RECALC_SIGPENDING;
510         SIGNAL_MASK_UNLOCK(current, flags);
511         unlock_kernel();
512
513         rc = llog_open(ctxt, &llh, &logid, NULL, 0);
514         if (rc) {
515                 CERROR("llog_create failed %d\n", rc);
516                 RETURN(rc);
517         }
518         rc = llog_init_handle(llh, LLOG_F_IS_CAT, NULL);
519         if (rc) {
520                 CERROR("llog_init_handle failed %d\n", rc);
521                 GOTO(out, rc);
522         }
523
524         if (cb) {
525                 rc = llog_cat_process(llh, (llog_cb_t)cb, NULL);
526                 if (rc != LLOG_PROC_BREAK)
527                         CERROR("llog_cat_process failed %d\n", rc);
528         } else {
529                 CWARN("no callback function for recovery\n");
530         }
531
532         CDEBUG(D_HA, "send llcd %p:%p forcibly after recovery\n",
533                ctxt->loc_llcd, ctxt);
534         llog_sync(ctxt, NULL);
535 out:
536         rc = llog_cat_put(llh);
537         if (rc)
538                 CERROR("llog_cat_put failed %d\n", rc);
539
540         RETURN(rc);
541 }
542
543 static int llog_recovery_generic(struct llog_ctxt *ctxt, void *handle,void *arg)
544 {
545         int rc;
546         ENTRY;
547
548         down(&llpa.llpa_sem);
549         llpa.llpa_ctxt = ctxt;
550         llpa.llpa_cb = handle;
551         llpa.llpa_arg = arg;
552
553         rc = kernel_thread(log_process_thread, &llpa, CLONE_VM | CLONE_FILES);
554         if (rc < 0)
555                 CERROR("error starting log_process_thread: %d\n", rc);
556         else {
557                 CDEBUG(D_HA, "log_process_thread: %d\n", rc);
558                 rc = 0;
559         }
560
561         RETURN(rc);
562 }
563
564 int llog_repl_connect(struct llog_ctxt *ctxt, int count,
565                       struct llog_logid *logid, struct llog_gen *gen,
566                       struct obd_uuid *uuid)
567 {
568         struct llog_canceld_ctxt *llcd;
569         int rc;
570         ENTRY;
571
572         /* send back llcd before recovery from llog */
573         if (ctxt->loc_llcd != NULL) {
574                 CWARN("llcd %p:%p not empty\n", ctxt->loc_llcd, ctxt);
575                 llog_sync(ctxt, NULL);
576         }
577
578         down(&ctxt->loc_sem);
579         ctxt->loc_gen = *gen;
580         llcd = llcd_grab();
581         if (llcd == NULL) {
582                 CERROR("couldn't get an llcd\n");
583                 up(&ctxt->loc_sem);
584                 RETURN(-ENOMEM);
585         }
586         llcd->llcd_ctxt = ctxt;
587         ctxt->loc_llcd = llcd;
588         up(&ctxt->loc_sem);
589
590         rc = llog_recovery_generic(ctxt, ctxt->llog_proc_cb, logid);
591         if (rc != 0)
592                 CERROR("error recovery process: %d\n", rc);
593
594         RETURN(rc);
595 }
596 EXPORT_SYMBOL(llog_repl_connect);
597
598 #else /* !__KERNEL__ */
599
600 int llog_obd_repl_cancel(struct llog_ctxt *ctxt, int count,
601                          struct llog_cookie *cookies, int flags, void *data)
602 {
603         return 0;
604 }
605 #endif