Whamcloud - gitweb
- update from b1_4_mountconf
[fs/lustre-release.git] / lustre / ptlrpc / llog_server.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001-2003 Cluster File Systems, Inc.
5  *   Author: Andreas Dilger <adilger@clusterfs.com>
6  *
7  *   This file is part of the Lustre file system, http://www.lustre.org
8  *   Lustre is a trademark of Cluster File Systems, Inc.
9  *
10  *   You may have signed or agreed to another license before downloading
11  *   this software.  If so, you are bound by the terms and conditions
12  *   of that agreement, and the following does not apply to you.  See the
13  *   LICENSE file included with this distribution for more information.
14  *
15  *   If you did not agree to a different license, then this copy of Lustre
16  *   is open source software; you can redistribute it and/or modify it
17  *   under the terms of version 2 of the GNU General Public License as
18  *   published by the Free Software Foundation.
19  *
20  *   In either case, Lustre is distributed in the hope that it will be
21  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
22  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  *   license text for more details.
24  *
25  *  remote api for llog - server side
26  *
27  */
28
29 #define DEBUG_SUBSYSTEM S_LOG
30
31 #ifndef EXPORT_SYMTAB
32 #define EXPORT_SYMTAB
33 #endif
34
35 #ifndef __KERNEL__
36 #include <liblustre.h>
37 #endif
38
39 #include <obd_class.h>
40 #include <lustre_log.h>
41 #include <lustre_net.h>
42 #include <libcfs/list.h>
43 #include <lustre_fsfilt.h>
44
45 #if defined(__KERNEL__) && defined(LUSTRE_LOG_SERVER)
46
47 int llog_origin_handle_create(struct ptlrpc_request *req)
48 {
49         struct obd_export *exp = req->rq_export;
50         struct obd_device *obd = exp->exp_obd;
51         struct obd_device *disk_obd;
52         struct llog_handle  *loghandle;
53         struct llogd_body *body;
54         struct lvfs_run_ctxt saved;
55         struct llog_logid *logid = NULL;
56         struct llog_ctxt *ctxt;
57         char * name = NULL;
58         int size = sizeof (*body);
59         int rc, rc2;
60         ENTRY;
61
62         body = lustre_swab_reqbuf(req, 0, sizeof(*body),
63                                  lustre_swab_llogd_body);
64         if (body == NULL) {
65                 CERROR ("Can't unpack llogd_body\n");
66                 GOTO(out, rc =-EFAULT);
67         }
68
69         if (body->lgd_logid.lgl_oid > 0)
70                 logid = &body->lgd_logid;
71
72         if (req->rq_reqmsg->bufcount > 1) {
73                 name = lustre_msg_string(req->rq_reqmsg, 1, 0);
74                 if (name == NULL) {
75                         CERROR("Can't unpack name\n");
76                         GOTO(out, rc = -EFAULT);
77                 }
78                 CDEBUG(D_INFO, "opening log %s\n", name);
79         }
80
81         ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
82         if (ctxt == NULL)
83                 GOTO(out, rc = -EINVAL);
84         disk_obd = ctxt->loc_exp->exp_obd;
85         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
86
87         rc = llog_create(ctxt, &loghandle, logid, name);
88         if (rc)
89                 GOTO(out_pop, rc);
90
91         rc = lustre_pack_reply(req, 1, &size, NULL);
92         if (rc)
93                 GOTO(out_close, rc = -ENOMEM);
94
95         body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
96         body->lgd_logid = loghandle->lgh_id;
97
98 out_close:
99         rc2 = llog_close(loghandle);
100         if (!rc)
101                 rc = rc2;
102 out_pop:
103         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
104 out:
105         RETURN(rc);
106 }
107
108 int llog_origin_handle_destroy(struct ptlrpc_request *req)
109 {
110         struct obd_export *exp = req->rq_export;
111         struct obd_device *obd = exp->exp_obd;
112         struct obd_device *disk_obd;
113         struct llog_handle  *loghandle;
114         struct llogd_body *body;
115         struct lvfs_run_ctxt saved;
116         struct llog_logid *logid = NULL;
117         struct llog_ctxt *ctxt;
118         int size = sizeof (*body);
119         int rc;
120         __u32 flags;
121         ENTRY;
122
123         body = lustre_swab_reqbuf(req, 0, sizeof(*body),
124                                  lustre_swab_llogd_body);
125         if (body == NULL) {
126                 CERROR ("Can't unpack llogd_body\n");
127                 GOTO(out, rc =-EFAULT);
128         }
129
130         if (body->lgd_logid.lgl_oid > 0)
131                 logid = &body->lgd_logid;
132
133         ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
134         if (ctxt == NULL)
135                 GOTO(out, rc = -EINVAL);
136         disk_obd = ctxt->loc_exp->exp_obd;
137         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
138
139         rc = llog_create(ctxt, &loghandle, logid, NULL);
140         if (rc)
141                 GOTO(out_pop, rc);
142
143         rc = lustre_pack_reply(req, 1, &size, NULL);
144         if (rc)
145                 GOTO(out_close, rc = -ENOMEM);
146
147         body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
148         body->lgd_logid = loghandle->lgh_id;
149         flags = body->lgd_llh_flags;
150         rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL);
151         if (rc)
152                 GOTO(out_close, rc);
153         rc = llog_destroy(loghandle);
154         if (rc)
155                 GOTO(out_close, rc);
156         llog_free_handle(loghandle);
157
158 out_close:
159         if (rc)
160                 llog_close(loghandle);
161 out_pop:
162         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
163 out:
164         RETURN(rc);
165 }
166
167 int llog_origin_handle_next_block(struct ptlrpc_request *req)
168 {
169         struct obd_export *exp = req->rq_export;
170         struct obd_device *obd = exp->exp_obd;
171         struct obd_device *disk_obd;
172         struct llog_handle  *loghandle;
173         struct llogd_body *body;
174         struct lvfs_run_ctxt saved;
175         struct llog_ctxt *ctxt;
176         __u32 flags;
177         __u8 *buf;
178         void * ptr;
179         int size[] = {sizeof (*body),
180                       LLOG_CHUNK_SIZE};
181         int rc, rc2;
182         ENTRY;
183
184         body = lustre_swab_reqbuf(req, 0, sizeof(*body),
185                                   lustre_swab_llogd_body);
186         if (body == NULL) {
187                 CERROR ("Can't unpack llogd_body\n");
188                 GOTO(out, rc =-EFAULT);
189         }
190
191         OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
192         if (!buf)
193                 GOTO(out, rc = -ENOMEM);
194
195         ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
196         if (ctxt == NULL)
197                 GOTO(out, rc = -EINVAL);
198         disk_obd = ctxt->loc_exp->exp_obd;
199         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
200
201         rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
202         if (rc)
203                 GOTO(out_pop, rc);
204
205         flags = body->lgd_llh_flags;
206         rc = llog_init_handle(loghandle, flags, NULL);
207         if (rc)
208                 GOTO(out_close, rc);
209
210         memset(buf, 0, LLOG_CHUNK_SIZE);
211         rc = llog_next_block(loghandle, &body->lgd_saved_index,
212                              body->lgd_index,
213                              &body->lgd_cur_offset, buf, LLOG_CHUNK_SIZE);
214         if (rc)
215                 GOTO(out_close, rc);
216
217
218         rc = lustre_pack_reply(req, 2, size, NULL);
219         if (rc)
220                 GOTO(out_close, rc = -ENOMEM);
221
222         ptr = lustre_msg_buf(req->rq_repmsg, 0, sizeof (body));
223         memcpy(ptr, body, sizeof(*body));
224
225         ptr = lustre_msg_buf(req->rq_repmsg, 1, LLOG_CHUNK_SIZE);
226         memcpy(ptr, buf, LLOG_CHUNK_SIZE);
227
228 out_close:
229         rc2 = llog_close(loghandle);
230         if (!rc)
231                 rc = rc2;
232
233 out_pop:
234         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
235         OBD_FREE(buf, LLOG_CHUNK_SIZE);
236 out:
237         RETURN(rc);
238 }
239
240 int llog_origin_handle_prev_block(struct ptlrpc_request *req)
241 {
242         struct obd_export *exp = req->rq_export;
243         struct obd_device *obd = exp->exp_obd;
244         struct llog_handle  *loghandle;
245         struct llogd_body *body;
246         struct obd_device *disk_obd;
247         struct lvfs_run_ctxt saved;
248         struct llog_ctxt *ctxt;
249         __u32 flags;
250         __u8 *buf;
251         void * ptr;
252         int size[] = {sizeof (*body),
253                       LLOG_CHUNK_SIZE};
254         int rc, rc2;
255         ENTRY;
256
257         body = lustre_swab_reqbuf(req, 0, sizeof(*body),
258                                   lustre_swab_llogd_body);
259         if (body == NULL) {
260                 CERROR ("Can't unpack llogd_body\n");
261                 GOTO(out, rc =-EFAULT);
262         }
263
264         OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
265         if (!buf)
266                 GOTO(out, rc = -ENOMEM);
267
268         ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
269         LASSERT(ctxt != NULL);
270         disk_obd = ctxt->loc_exp->exp_obd;
271         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
272
273         rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
274         if (rc)
275                 GOTO(out_pop, rc);
276
277         flags = body->lgd_llh_flags;
278         rc = llog_init_handle(loghandle, flags, NULL);
279         if (rc)
280                 GOTO(out_close, rc);
281
282         memset(buf, 0, LLOG_CHUNK_SIZE);
283         rc = llog_prev_block(loghandle, body->lgd_index,
284                              buf, LLOG_CHUNK_SIZE);
285         if (rc)
286                 GOTO(out_close, rc);
287
288
289         rc = lustre_pack_reply(req, 2, size, NULL);
290         if (rc)
291                 GOTO(out_close, rc = -ENOMEM);
292
293         ptr = lustre_msg_buf(req->rq_repmsg, 0, sizeof (body));
294         memcpy(ptr, body, sizeof(*body));
295
296         ptr = lustre_msg_buf(req->rq_repmsg, 1, LLOG_CHUNK_SIZE);
297         memcpy(ptr, buf, LLOG_CHUNK_SIZE);
298
299 out_close:
300         rc2 = llog_close(loghandle);
301         if (!rc)
302                 rc = rc2;
303
304 out_pop:
305         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
306         OBD_FREE(buf, LLOG_CHUNK_SIZE);
307 out:
308         RETURN(rc);
309 }
310
311 int llog_origin_handle_read_header(struct ptlrpc_request *req)
312 {
313         struct obd_export *exp = req->rq_export;
314         struct obd_device *obd = exp->exp_obd;
315         struct obd_device *disk_obd;
316         struct llog_handle  *loghandle;
317         struct llogd_body *body;
318         struct llog_log_hdr *hdr;
319         struct lvfs_run_ctxt saved;
320         struct llog_ctxt *ctxt;
321         __u32 flags;
322         int size[] = {sizeof (*hdr)};
323         int rc, rc2;
324         ENTRY;
325
326         body = lustre_swab_reqbuf(req, 0, sizeof(*body),
327                                   lustre_swab_llogd_body);
328         if (body == NULL) {
329                 CERROR ("Can't unpack llogd_body\n");
330                 GOTO(out, rc =-EFAULT);
331         }
332
333         ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
334         if (ctxt == NULL)
335                 GOTO(out, rc = -EINVAL);
336         disk_obd = ctxt->loc_exp->exp_obd;
337         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
338
339         rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
340         if (rc)
341                 GOTO(out_pop, rc);
342
343         /* init_handle reads the header */
344         flags = body->lgd_llh_flags;
345         rc = llog_init_handle(loghandle, flags, NULL);
346         if (rc)
347                 GOTO(out_close, rc);
348
349         rc = lustre_pack_reply(req, 1, size, NULL);
350         if (rc)
351                 GOTO(out_close, rc = -ENOMEM);
352
353         hdr = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*hdr));
354         memcpy(hdr, loghandle->lgh_hdr, sizeof(*hdr));
355
356 out_close:
357         rc2 = llog_close(loghandle);
358         if (!rc)
359                 rc = rc2;
360
361 out_pop:
362         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
363
364 out:
365         RETURN(rc);
366 }
367
368 int llog_origin_handle_close(struct ptlrpc_request *req)
369 {
370         int rc;
371
372         rc = 0;
373
374         RETURN(rc);
375 }
376
377 int llog_origin_handle_cancel(struct ptlrpc_request *req)
378 {
379         struct obd_device *obd = req->rq_export->exp_obd;
380         struct obd_device *disk_obd;
381         struct llog_cookie *logcookies;
382         struct llog_ctxt *ctxt;
383         int num_cookies, rc = 0, err, i;
384         struct lvfs_run_ctxt saved;
385         struct llog_handle *cathandle;
386         struct inode *inode;
387         void *handle;
388         ENTRY;
389
390         logcookies = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*logcookies));
391         num_cookies = req->rq_reqmsg->buflens[0]/sizeof(*logcookies);
392         if (logcookies == NULL || num_cookies == 0) {
393                 DEBUG_REQ(D_HA, req, "no cookies sent");
394                 RETURN(-EFAULT);
395         }
396
397         ctxt = llog_get_context(obd, logcookies->lgc_subsys);
398         if (ctxt == NULL) {
399                 CWARN("llog subsys not setup or already cleanup\n");
400                 RETURN(-ENOENT);
401         }
402
403         disk_obd = ctxt->loc_exp->exp_obd;
404         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
405         for (i = 0; i < num_cookies; i++, logcookies++) {
406                 cathandle = ctxt->loc_handle;
407                 LASSERT(cathandle != NULL);
408                 inode = cathandle->lgh_file->f_dentry->d_inode;
409
410                 handle = fsfilt_start_log(disk_obd, inode,
411                                           FSFILT_OP_CANCEL_UNLINK, NULL, 1);
412                 if (IS_ERR(handle)) {
413                         CERROR("fsfilt_start failed: %ld\n", PTR_ERR(handle));
414                         GOTO(pop_ctxt, rc = PTR_ERR(handle));
415                 }
416
417                 rc = llog_cat_cancel_records(cathandle, 1, logcookies);
418
419                 err = fsfilt_commit(disk_obd, inode, handle, 0);
420                 if (err) {
421                         CERROR("error committing transaction: %d\n", err);
422                         if (!rc)
423                                 rc = err;
424                         GOTO(pop_ctxt, rc);
425                 }
426         }
427 pop_ctxt:
428         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
429         if (rc)
430                 CERROR("cancel %d llog-records failed: %d\n", num_cookies, rc);
431         else
432                 CDEBUG(D_HA, "cancel %d llog-records\n", num_cookies);
433
434         RETURN(rc);
435 }
436 EXPORT_SYMBOL(llog_origin_handle_cancel);
437
438 static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len,
439                                char *client)
440 {
441         struct mds_obd *mds = &obd->u.mds;
442         struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
443         struct lvfs_run_ctxt saved;
444         struct llog_handle *handle = NULL;
445         char name[4][64];
446         int rc, i, l, remains = buf_len;
447         char *out = buf;
448
449         if (ctxt == NULL || mds == NULL)
450                 RETURN(-EOPNOTSUPP);
451
452         push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
453
454         sprintf(name[0], "%s", mds->mds_profile);
455         sprintf(name[1], "%s-clean", mds->mds_profile);
456         sprintf(name[2], "%s", client);
457         sprintf(name[3], "%s-clean", client);
458
459         for (i = 0; i < 4; i++) {
460                 int index, uncanceled = 0;
461                 rc = llog_create(ctxt, &handle, NULL, name[i]);
462                 if (rc)
463                         GOTO(out_pop, rc);
464                 rc = llog_init_handle(handle, 0, NULL);
465                 if (rc) {
466                         llog_close(handle);
467                         GOTO(out_pop, rc = -ENOENT);
468                 }
469
470                 for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index ++) {
471                         if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap))
472                                 uncanceled++;
473                 }
474
475                 l = snprintf(out, remains, "[Log Name]: %s\nLog Size: %llu\n"
476                              "Last Index: %d\nUncanceled Records: %d\n\n",
477                              name[i],
478                              handle->lgh_file->f_dentry->d_inode->i_size,
479                              handle->lgh_last_idx, uncanceled);
480                 out += l;
481                 remains -= l;
482
483                 llog_close(handle);
484                 if (remains <= 0)
485                         break;
486         }
487 out_pop:
488         pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
489         RETURN(rc);
490 }
491
492 struct cb_data {
493         struct llog_ctxt *ctxt;
494         char *out;
495         int  remains;
496         int  init;
497 };
498
499 static int llog_catinfo_cb(struct llog_handle *cat,
500                            struct llog_rec_hdr *rec, void *data)
501 {
502         static char *out = NULL;
503         static int remains = 0;
504         struct llog_ctxt *ctxt;
505         struct llog_handle *handle;
506         struct llog_logid *logid;
507         struct llog_logid_rec *lir;
508         int l, rc, index, count = 0;
509         struct cb_data *cbd = (struct cb_data*)data;
510
511         if (cbd->init) {
512                 out = cbd->out;
513                 remains = cbd->remains;
514                 cbd->init = 0;
515         }
516         ctxt = cbd->ctxt;
517
518         if (!(cat->lgh_hdr->llh_flags & LLOG_F_IS_CAT))
519                 RETURN(-EINVAL);
520
521         lir = (struct llog_logid_rec *)rec;
522         logid = &lir->lid_id;
523         rc = llog_create(ctxt, &handle, logid, NULL);
524         if (rc)
525                 RETURN(-EINVAL);
526         rc = llog_init_handle(handle, 0, NULL);
527         if (rc)
528                 GOTO(out_close, rc);
529
530         for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index++) {
531                 if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap))
532                         count++;
533         }
534
535         l = snprintf(out, remains, "\t[Log ID]: #"LPX64"#"LPX64"#%08x\n"
536                      "\tLog Size: %llu\n\tLast Index: %d\n"
537                      "\tUncanceled Records: %d\n",
538                      logid->lgl_oid, logid->lgl_ogr, logid->lgl_ogen,
539                      handle->lgh_file->f_dentry->d_inode->i_size,
540                      handle->lgh_last_idx, count);
541         out += l;
542         remains -= l;
543         cbd->out = out;
544         cbd->remains = remains;
545         if (remains <= 0) {
546                 CWARN("Not enough memory\n");
547                 rc = -ENOMEM;
548         }
549
550 out_close:
551         llog_close(handle);
552         RETURN(rc);
553 }
554
555 static int llog_catinfo_deletions(struct obd_device *obd, char *buf,
556                                   int buf_len)
557 {
558         struct mds_obd *mds = &obd->u.mds;
559         struct llog_handle *handle;
560         struct lvfs_run_ctxt saved;
561         int size, i, count;
562         struct llog_catid *idarray;
563         struct llog_logid *id;
564         char name[32] = CATLIST;
565         int rc;
566         struct cb_data data;
567         struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
568
569         if (ctxt == NULL || mds == NULL)
570                 RETURN(-EOPNOTSUPP);
571
572         count = mds->mds_lov_desc.ld_tgt_count;
573         size = sizeof(*idarray) * count;
574
575         OBD_ALLOC(idarray, size);
576         if (!idarray)
577                 RETURN(-ENOMEM);
578
579         rc = llog_get_cat_list(obd, obd, name, count, idarray);
580         if (rc)
581                 GOTO(out_free, rc);
582
583         push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
584
585         data.ctxt = ctxt;
586         data.out = buf;
587         data.remains = buf_len;
588         for (i = 0; i < count; i++) {
589                 int l, index, uncanceled = 0;
590
591                 id = &idarray[i].lci_logid;
592                 rc = llog_create(ctxt, &handle, id, NULL);
593                 if (rc)
594                         GOTO(out_pop, rc);
595                 rc = llog_init_handle(handle, 0, NULL);
596                 if (rc) {
597                         llog_close(handle);
598                         GOTO(out_pop, rc = -ENOENT);
599                 }
600                 for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index++) {
601                         if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap))
602                                 uncanceled++;
603                 }
604                 l = snprintf(data.out, data.remains,
605                              "\n[Catlog ID]: #"LPX64"#"LPX64"#%08x  "
606                              "[Log Count]: %d\n",
607                              id->lgl_oid, id->lgl_ogr, id->lgl_ogen,
608                              uncanceled);
609
610                 data.out += l;
611                 data.remains -= l;
612                 data.init = 1;
613
614                 llog_process(handle, llog_catinfo_cb, &data, NULL);
615                 llog_close(handle);
616
617                 if (data.remains <= 0)
618                         break;
619         }
620 out_pop:
621         pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
622 out_free:
623         OBD_FREE(idarray, size);
624         RETURN(rc);
625 }
626
627 int llog_catinfo(struct ptlrpc_request *req)
628 {
629         struct obd_export *exp = req->rq_export;
630         struct obd_device *obd = exp->exp_obd;
631         char *keyword;
632         char *buf, *reply;
633         int rc, buf_len = LLOG_CHUNK_SIZE;
634
635         OBD_ALLOC(buf, buf_len);
636         if (buf == NULL)
637                 return -ENOMEM;
638         memset(buf, 0, buf_len);
639
640         keyword = lustre_msg_string(req->rq_reqmsg, 0, 0);
641
642         if (strcmp(keyword, "config") == 0) {
643                 char *client = lustre_msg_string(req->rq_reqmsg, 1, 0);
644                 rc = llog_catinfo_config(obd, buf, buf_len, client);
645         } else if (strcmp(keyword, "deletions") == 0) {
646                 rc = llog_catinfo_deletions(obd, buf, buf_len);
647         } else {
648                 rc = -EOPNOTSUPP;
649         }
650
651         rc = lustre_pack_reply(req, 1, &buf_len, NULL);
652         if (rc)
653                 GOTO(out_free, rc = -ENOMEM);
654
655         reply = lustre_msg_buf(req->rq_repmsg, 0, buf_len);
656         if (strlen(buf) == 0)
657                 sprintf(buf, "%s", "No log informations\n");
658         memcpy(reply, buf, buf_len);
659
660 out_free:
661         OBD_FREE(buf, buf_len);
662         return rc;
663 }
664
665 #else /* !__KERNEL__ */
666 int llog_origin_handle_create(struct ptlrpc_request *req)
667 {
668         LBUG();
669         return 0;
670 }
671
672 int llog_origin_handle_destroy(struct ptlrpc_request *req)
673 {
674         LBUG();
675         return 0;
676 }
677
678 int llog_origin_handle_next_block(struct ptlrpc_request *req)
679 {
680         LBUG();
681         return 0;
682 }
683 int llog_origin_handle_prev_block(struct ptlrpc_request *req)
684 {
685         LBUG();
686         return 0;
687 }
688 int llog_origin_handle_read_header(struct ptlrpc_request *req)
689 {
690         LBUG();
691         return 0;
692 }
693 int llog_origin_handle_close(struct ptlrpc_request *req)
694 {
695         LBUG();
696         return 0;
697 }
698 int llog_origin_handle_cancel(struct ptlrpc_request *req)
699 {
700         LBUG();
701         return 0;
702 }
703 #endif