Whamcloud - gitweb
Only overwrite the magics, not the entire page to avoid excess CPU usage.
[fs/lustre-release.git] / lustre / obdclass / class_obd.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  *
9  * These are the only exported functions, they provide some generic
10  * infrastructure for managing object devices
11  *
12  * Object Devices Class Driver
13  */
14
15 #define EXPORT_SYMTAB
16 #include <linux/config.h> /* for CONFIG_PROC_FS */
17 #include <linux/module.h>
18 #include <linux/errno.h>
19 #include <linux/kernel.h>
20 #include <linux/major.h>
21 #include <linux/sched.h>
22 #include <linux/lp.h>
23 #include <linux/slab.h>
24 #include <linux/ioport.h>
25 #include <linux/fcntl.h>
26 #include <linux/delay.h>
27 #include <linux/skbuff.h>
28 #include <linux/proc_fs.h>
29 #include <linux/fs.h>
30 #include <linux/poll.h>
31 #include <linux/init.h>
32 #include <linux/list.h>
33 #include <asm/io.h>
34 #include <asm/system.h>
35 #include <asm/poll.h>
36 #include <asm/uaccess.h>
37 #include <linux/miscdevice.h>
38
39 #define DEBUG_SUBSYSTEM S_CLASS
40
41 #include <linux/obd_support.h>
42 #include <linux/obd_class.h>
43 #include <linux/lustre_debug.h>
44 #include <linux/smp_lock.h>
45
46 struct semaphore obd_conf_sem;   /* serialize configuration commands */
47 struct obd_device obd_dev[MAX_OBD_DEVICES];
48 struct list_head obd_types;
49 unsigned long obd_memory = 0;
50
51 /* The following are visible and mutable through /proc/sys/lustre/. */
52 unsigned long obd_fail_loc = 0;
53 unsigned long obd_timeout = 100;
54 char obd_recovery_upcall[128] = "/usr/lib/lustre/ha_assist";
55
56 extern struct obd_type *class_nm_to_type(char *nm);
57
58 /*  opening /dev/obd */
59 static int obd_class_open(struct inode * inode, struct file * file)
60 {
61         ENTRY;
62
63         file->private_data = NULL;
64         MOD_INC_USE_COUNT;
65         RETURN(0);
66 }
67
68 /*  closing /dev/obd */
69 static int obd_class_release(struct inode * inode, struct file * file)
70 {
71         ENTRY;
72
73         if (file->private_data)
74                 file->private_data = NULL;
75
76         MOD_DEC_USE_COUNT;
77         RETURN(0);
78 }
79
80
81 inline void obd_data2conn(struct lustre_handle *conn, struct obd_ioctl_data *data)
82 {
83         conn->addr = data->ioc_addr;
84         conn->cookie = data->ioc_cookie;
85 }
86
87
88 inline void obd_conn2data(struct obd_ioctl_data *data, struct lustre_handle *conn)
89 {
90         data->ioc_addr = conn->addr;
91         data->ioc_cookie = conn->cookie;
92 }
93
94
95 /* to control /dev/obd */
96 static int obd_class_ioctl (struct inode * inode, struct file * filp,
97                             unsigned int cmd, unsigned long arg)
98 {
99         char *buf = NULL;
100         int len = 0;
101         struct obd_ioctl_data *data;
102         struct obd_device *obd = filp->private_data;
103         
104         struct lustre_handle conn;
105         int rw = OBD_BRW_READ;
106         int err = 0;
107         int serialised = 0;
108         ENTRY;
109
110         switch (cmd)
111         {
112         case OBD_IOC_BRW_WRITE:
113         case OBD_IOC_BRW_READ:
114         case OBD_IOC_GETATTR:
115                 break;
116         default:
117                 down(&obd_conf_sem);
118                 serialised = 1;
119                 break;
120         }
121         
122         if (!obd && cmd != OBD_IOC_DEVICE && cmd != TCGETS &&
123             cmd != OBD_IOC_LIST &&
124             cmd != OBD_IOC_NAME2DEV && cmd != OBD_IOC_NEWDEV) {
125                 CERROR("OBD ioctl: No device\n");
126                 GOTO(out, err=-EINVAL);
127         }
128         if (obd_ioctl_getdata(&buf, &len, (void *)arg)) {
129                 CERROR("OBD ioctl: data error\n");
130                 GOTO(out, err=-EINVAL);
131         }
132         data = (struct obd_ioctl_data *)buf;
133
134         switch (cmd) {
135         case TCGETS:
136                 GOTO(out, err=-EINVAL);
137         case OBD_IOC_DEVICE: {
138                 CDEBUG(D_IOCTL, "\n");
139                 if (data->ioc_dev >= MAX_OBD_DEVICES || data->ioc_dev < 0) {
140                         CERROR("OBD ioctl: DEVICE insufficient devices\n");
141                         GOTO(out, err=-EINVAL);
142                 }
143                 CDEBUG(D_IOCTL, "device %d\n", data->ioc_dev);
144
145                 filp->private_data = &obd_dev[data->ioc_dev];
146                 GOTO(out, err=0);
147         }
148
149         case OBD_IOC_LIST: {
150                 int i;
151                 char *buf2 = data->ioc_bulk;
152                 int remains = data->ioc_inllen1;
153
154                 if (!data->ioc_inlbuf1) {
155                         CERROR("No buffer passed!\n");
156                         GOTO(out, err=-EINVAL);
157                 }
158
159
160                 for (i = 0 ; i < MAX_OBD_DEVICES ; i++) {
161                         int l;
162                         char *status;
163                         struct obd_device *obd = &obd_dev[i];
164                         if (!obd->obd_type)
165                                 continue;
166                         if (obd->obd_flags & OBD_SET_UP)
167                                 status = "*";
168                         else
169                                 status = " ";
170                         l = snprintf(buf2, remains, "%2d %s %s %s %s\n",
171                                      i, status, obd->obd_type->typ_name,
172                                      obd->obd_name, obd->obd_uuid);
173                         buf2 +=l;
174                         remains -=l;
175                         if (remains <= 0) {
176                                 CERROR("not enough space for device listing\n");
177                                 break;
178                         }
179                 }
180
181                 err = copy_to_user((int *)arg, data, len);
182                 GOTO(out, err);
183         }
184
185
186         case OBD_IOC_NAME2DEV: {
187                 /* Resolve a device name.  This does not change the
188                  * currently selected device.
189                  */
190                 int dev;
191
192                 if (!data->ioc_inllen1 || !data->ioc_inlbuf1 ) {
193                         CERROR("No name passed,!\n");
194                         GOTO(out, err=-EINVAL);
195                 }
196                 if (data->ioc_inlbuf1[data->ioc_inllen1-1] !=0) {
197                         CERROR("Name not nul terminated!\n");
198                         GOTO(out, err=-EINVAL);
199                 }
200
201                 CDEBUG(D_IOCTL, "device name %s\n", data->ioc_inlbuf1);
202                 dev = class_name2dev(data->ioc_inlbuf1);
203                 data->ioc_dev = dev;
204                 if (dev == -1) {
205                         CDEBUG(D_IOCTL, "No device for name %s!\n",
206                                data->ioc_inlbuf1);
207                         GOTO(out, err=-EINVAL);
208                 }
209
210                 CDEBUG(D_IOCTL, "device name %s, dev %d\n", data->ioc_inlbuf1,
211                        dev);
212                 err = copy_to_user((int *)arg, data, sizeof(*data));
213                 GOTO(out, err);
214         }
215
216         case OBD_IOC_UUID2DEV: {
217                 /* Resolve a device uuid.  This does not change the
218                  * currently selected device.
219                  */
220                 int dev;
221
222                 if (!data->ioc_inllen1 || !data->ioc_inlbuf1) {
223                         CERROR("No UUID passed!\n");
224                         GOTO(out, err=-EINVAL);
225                 }
226                 if (data->ioc_inlbuf1[data->ioc_inllen1-1] !=0) {
227                         CERROR("Name not nul terminated!\n");
228                         GOTO(out, err=-EINVAL);
229                 }
230
231                 CDEBUG(D_IOCTL, "device name %s\n", data->ioc_inlbuf1);
232                 dev = class_uuid2dev(data->ioc_inlbuf1);
233                 data->ioc_dev = dev;
234                 if (dev == -1) {
235                         CDEBUG(D_IOCTL, "No device for name %s!\n",
236                                data->ioc_inlbuf1);
237                         GOTO(out, err=-EINVAL);
238                 }
239
240                 CDEBUG(D_IOCTL, "device name %s, dev %d\n", data->ioc_inlbuf1,
241                        dev);
242                 err = copy_to_user((int *)arg, data, sizeof(*data));
243                 GOTO(out, err);
244         }
245
246         case OBD_IOC_NEWDEV: {
247                 int dev = -1;
248                 int i;
249
250                 filp->private_data = NULL;
251                 for (i = 0 ; i < MAX_OBD_DEVICES ; i++) {
252                         struct obd_device *obd = &obd_dev[i];
253                         if (!obd->obd_type) {
254                                 filp->private_data = obd;
255                                 dev = i;
256                                 break;
257                         }
258                 }
259
260
261                 data->ioc_dev = dev;
262                 if (dev == -1)
263                         GOTO(out, err=-EINVAL);
264
265                 err = copy_to_user((int *)arg, data, sizeof(*data));
266                 GOTO(out, err);
267         }
268
269         case OBD_IOC_ATTACH: {
270                 struct obd_type *type;
271
272                 /* have we attached a type to this device */
273                 if (obd->obd_flags & OBD_ATTACHED) {
274                         CERROR("OBD: Device %d already typed as %s.\n",
275                                obd->obd_minor, MKSTR(obd->obd_type->typ_name));
276                         GOTO(out, err=-EBUSY);
277                 }
278
279                 if (!data->ioc_inllen1 || !data->ioc_inlbuf1) {
280                         CERROR("No type passed!\n");
281                         GOTO(out, err=-EINVAL);
282                 }
283                 if (data->ioc_inlbuf1[data->ioc_inllen1-1] !=0) {
284                         CERROR("Type not nul terminated!\n");
285                         GOTO(out, err=-EINVAL);
286                 }
287
288                 CDEBUG(D_IOCTL, "attach type %s name: %s uuid: %s\n",
289                        MKSTR(data->ioc_inlbuf1),
290                        MKSTR(data->ioc_inlbuf2), MKSTR(data->ioc_inlbuf3));
291
292                 /* find the type */
293                 type = class_nm_to_type(data->ioc_inlbuf1);
294                 if (!type) {
295                         CERROR("OBD: unknown type dev %d\n", obd->obd_minor);
296                         GOTO(out, err=-EINVAL);
297                 }
298
299                 obd->obd_type = type;
300                 INIT_LIST_HEAD(&obd->obd_exports);
301
302                 /* do the attach */
303                 if (OBP(obd, attach))
304                         err = OBP(obd,attach)(obd, sizeof(*data), data);
305                 if (err) {
306                         obd->obd_type = NULL;
307                 } else {
308                         obd->obd_flags |= OBD_ATTACHED;
309                         type->typ_refcnt++;
310                         CDEBUG(D_IOCTL, "OBD: dev %d attached type %s\n",
311                                obd->obd_minor, data->ioc_inlbuf1);
312                         if (data->ioc_inlbuf2) {
313                                 int len = strlen(data->ioc_inlbuf2) + 1;
314                                 OBD_ALLOC(obd->obd_name, len);
315                                 if (!obd->obd_name) {
316                                         CERROR("no memory\n");
317                                         LBUG();
318                                 }
319                                 memcpy(obd->obd_name, data->ioc_inlbuf2, len);
320                                 obd->obd_proc_entry =
321                                         proc_lustre_register_obd_device(obd);
322                         } else {
323                                 CERROR("WARNING: unnamed obd device\n");
324                                 obd->obd_proc_entry = NULL;
325                         }
326
327                         if (data->ioc_inlbuf3) {
328                                 int len = strlen(data->ioc_inlbuf3);
329                                 if (len > 37) {
330                                         CERROR("uuid should be shorter than 37 bytes\n");
331                                         if (obd->obd_name)
332                                                 OBD_FREE(obd->obd_name,
333                                                          strlen(obd->obd_name) + 1);
334                                         GOTO(out, err=-EINVAL);
335                                 }
336                                 memcpy(obd->obd_uuid, data->ioc_inlbuf3,
337                                        sizeof(obd->obd_uuid));
338                         }
339
340                         MOD_INC_USE_COUNT;
341                 }
342
343                 GOTO(out, err);
344         }
345
346         case OBD_IOC_DETACH: {
347                 ENTRY;
348                 if (obd->obd_flags & OBD_SET_UP) {
349                         CERROR("OBD device %d still set up\n", obd->obd_minor);
350                         GOTO(out, err=-EBUSY);
351                 }
352                 if (! (obd->obd_flags & OBD_ATTACHED) ) {
353                         CERROR("OBD device %d not attached\n", obd->obd_minor);
354                         GOTO(out, err=-ENODEV);
355                 }
356                 if ( !list_empty(&obd->obd_exports) ) {
357                         CERROR("OBD device %d has exports\n",
358                                obd->obd_minor);
359                         GOTO(out, err=-EBUSY);
360                 }
361
362                 if (obd->obd_name) {
363                         OBD_FREE(obd->obd_name, strlen(obd->obd_name)+1);
364                         obd->obd_name = NULL;
365                 }
366
367                 if (obd->obd_proc_entry)
368                         proc_lustre_release_obd_device(obd);
369
370                 obd->obd_flags &= ~OBD_ATTACHED;
371                 obd->obd_type->typ_refcnt--;
372                 obd->obd_type = NULL;
373                 MOD_DEC_USE_COUNT;
374                 GOTO(out, err=0);
375         }
376
377         case OBD_IOC_SETUP: {
378                 /* have we attached a type to this device? */
379                 if (!(obd->obd_flags & OBD_ATTACHED)) {
380                         CERROR("Device %d not attached\n", obd->obd_minor);
381                         GOTO(out, err=-ENODEV);
382                 }
383
384                 /* has this been done already? */
385                 if ( obd->obd_flags & OBD_SET_UP ) {
386                         CERROR("Device %d already setup (type %s)\n",
387                                obd->obd_minor, obd->obd_type->typ_name);
388                         GOTO(out, err=-EBUSY);
389                 }
390
391                 if ( OBT(obd) && OBP(obd, setup) )
392                         err = obd_setup(obd, sizeof(*data), data);
393
394                 if (!err) {
395                         obd->obd_type->typ_refcnt++;
396                         obd->obd_flags |= OBD_SET_UP;
397                 }
398
399                 GOTO(out, err);
400         }
401         case OBD_IOC_CLEANUP: {
402                 /* have we attached a type to this device? */
403                 if (!(obd->obd_flags & OBD_ATTACHED)) {
404                         CERROR("Device %d not attached\n", obd->obd_minor);
405                         GOTO(out, err=-ENODEV);
406                 }
407
408                 if ( OBT(obd) && OBP(obd, cleanup) )
409                         err = obd_cleanup(obd);
410
411                 if (!err) {
412                         obd->obd_flags &= ~OBD_SET_UP;
413                         obd->obd_type->typ_refcnt--;
414                 }
415                 GOTO(out, err);
416         }
417
418         case OBD_IOC_CONNECT: {
419                 char * cluuid = "OBD_CLASS_UUID";
420                 obd_data2conn(&conn, data);
421
422                 err = obd_connect(&conn, obd, cluuid);
423
424                 CDEBUG(D_IOCTL, "assigned export %Lx\n", conn.addr);
425                 obd_conn2data(data, &conn);
426                 if (err)
427                         GOTO(out, err);
428
429                 err = copy_to_user((int *)arg, data, sizeof(*data));
430                 GOTO(out, err);
431         }
432
433         case OBD_IOC_DISCONNECT: {
434                 obd_data2conn(&conn, data);
435                 err = obd_disconnect(&conn);
436                 GOTO(out, err);
437         }
438
439         case OBD_IOC_DEC_USE_COUNT: {
440                 MOD_DEC_USE_COUNT;
441                 GOTO(out, err=0);
442         }
443
444         case OBD_IOC_CREATE: {
445                 struct lov_stripe_md *ea;
446                 obd_data2conn(&conn, data);
447
448
449                 err = obd_create(&conn, &data->ioc_obdo1, &ea);
450                 if (err)
451                         GOTO(out, err);
452
453                 err = copy_to_user((int *)arg, data, sizeof(*data));
454                 GOTO(out, err);
455         }
456
457         case OBD_IOC_GETATTR: {
458
459                 obd_data2conn(&conn, data);
460                 err = obd_getattr(&conn, &data->ioc_obdo1, NULL);
461                 if (err)
462                         GOTO(out, err);
463
464                 err = copy_to_user((int *)arg, data, sizeof(*data));
465                 GOTO(out, err);
466         }
467
468         case OBD_IOC_SETATTR: {
469                 obd_data2conn(&conn, data);
470                 err = obd_setattr(&conn, &data->ioc_obdo1, NULL);
471                 if (err)
472                         GOTO(out, err);
473
474                 err = copy_to_user((int *)arg, data, sizeof(*data));
475                 GOTO(out, err);
476         }
477
478         case OBD_IOC_DESTROY: {
479                 //void *ea;
480                 obd_data2conn(&conn, data);
481
482                 err = obd_destroy(&conn, &data->ioc_obdo1, NULL);
483                 if (err)
484                         GOTO(out, err);
485
486                 err = copy_to_user((int *)arg, data, sizeof(*data));
487                 GOTO(out, err);
488         }
489
490         case OBD_IOC_BRW_WRITE:
491                 rw = OBD_BRW_WRITE;
492         case OBD_IOC_BRW_READ: {
493                 struct lov_stripe_md smd;
494                 struct io_cb_data *cbd = ll_init_cb();
495                 obd_count       pages = 0;
496                 struct brw_page *pga, *pgp;
497                 __u64 id = data->ioc_obdo1.o_id;
498                 int gfp_mask = (id & 1) ? GFP_HIGHUSER : GFP_KERNEL;
499                 int verify = (id != 0);
500                 unsigned long off;
501                 int j;
502
503                 if (!cbd)
504                         GOTO(out, err = -ENOMEM);
505
506                 obd_data2conn(&conn, data);
507
508                 pages = data->ioc_count / PAGE_SIZE;
509
510                 CDEBUG(D_INODE, "BRW %s with %d pages\n",
511                        rw == OBD_BRW_READ ? "read" : "write", pages);
512                 OBD_ALLOC(pga, pages * sizeof(*pga));
513                 if (!pga) {
514                         CERROR("no memory for %d BRW per-page data\n", pages);
515                         GOTO(brw_free, err = -ENOMEM);
516                 }
517
518                 memset(&smd, 0, sizeof(smd));
519                 smd.lmd_object_id = id;
520
521                 off = data->ioc_offset;
522
523                 for (j = 0, pgp = pga; j < pages; j++, off += PAGE_SIZE, pgp++){
524                         pgp->pg = alloc_pages(gfp_mask, 0);
525                         if (!pgp->pg) {
526                                 CERROR("no memory for brw pages\n");
527                                 GOTO(brw_cleanup, err = -ENOMEM);
528                         }
529                         pgp->count = PAGE_SIZE;
530                         pgp->off = off;
531                         pgp->flag = 0;
532
533                         if (verify) {
534                                 void *addr = kmap(pgp->pg);
535
536                                 if (rw == OBD_BRW_WRITE)
537                                         page_debug_setup(addr, pgp->count,
538                                                          pgp->off, id);
539                                 else
540                                         page_debug_setup(addr, pgp->count,
541                                                          0xdeadbeef00c0ffee,
542                                                          0xdeadbeef00c0ffee);
543                                 kunmap(pgp->pg);
544                         }
545                 }
546
547                 err = obd_brw(rw, &conn, &smd, j, pga, ll_sync_io_cb, cbd);
548                 EXIT;
549         brw_cleanup:
550                 for (j = 0, pgp = pga; j < pages; j++, pgp++) {
551                         if (pgp->pg != NULL) {
552                                 if (verify) {
553                                         void *addr = kmap(pgp->pg);
554                                         int err2;
555
556                                         err2 = page_debug_check("test_brw",
557                                                                 addr,
558                                                                 PAGE_SIZE,
559                                                                 pgp->off,id);
560                                         if (!err)
561                                                 err = err2;
562                                         kunmap(pgp->pg);
563                                 }
564                                 __free_pages(pgp->pg, 0);
565                         }
566                 }
567         brw_free:
568                 OBD_FREE(pga, pages * sizeof(*pga));
569                 GOTO(out, err);
570         }
571         default:
572                 obd_data2conn(&conn, data);
573
574                 err = obd_iocontrol(cmd, &conn, len, data, NULL);
575                 if (err)
576                         GOTO(out, err);
577
578                 err = copy_to_user((int *)arg, data, len);
579                 GOTO(out, err);
580         }
581
582  out:
583         if (buf)
584                 OBD_FREE(buf, len);
585         if (serialised)
586                 up(&obd_conf_sem);
587         RETURN(err);
588 } /* obd_class_ioctl */
589
590
591
592 /* declare character device */
593 static struct file_operations obd_psdev_fops = {
594         ioctl: obd_class_ioctl,       /* ioctl */
595         open: obd_class_open,        /* open */
596         release: obd_class_release,     /* release */
597 };
598
599 /* modules setup */
600 #define OBD_MINOR 241
601 static struct miscdevice obd_psdev = {
602         OBD_MINOR,
603         "obd_psdev",
604         &obd_psdev_fops
605 };
606
607 void (*class_signal_connection_failure)(struct ptlrpc_connection *);
608 int (*mds_destroy_export)(struct obd_export *exp);
609 int (*ldlm_destroy_export)(struct obd_export *exp);
610
611 EXPORT_SYMBOL(obd_dev);
612 EXPORT_SYMBOL(obdo_cachep);
613 EXPORT_SYMBOL(obd_memory);
614 EXPORT_SYMBOL(obd_fail_loc);
615 EXPORT_SYMBOL(obd_timeout);
616 EXPORT_SYMBOL(obd_recovery_upcall);
617
618 EXPORT_SYMBOL(class_register_type);
619 EXPORT_SYMBOL(class_unregister_type);
620 EXPORT_SYMBOL(class_name2dev);
621 EXPORT_SYMBOL(class_uuid2dev);
622 EXPORT_SYMBOL(class_uuid2obd);
623 EXPORT_SYMBOL(class_new_export);
624 EXPORT_SYMBOL(class_destroy_export);
625 EXPORT_SYMBOL(class_connect);
626 EXPORT_SYMBOL(class_conn2export);
627 EXPORT_SYMBOL(class_rconn2export);
628 EXPORT_SYMBOL(class_conn2obd);
629 EXPORT_SYMBOL(class_disconnect);
630 EXPORT_SYMBOL(class_disconnect_all);
631 EXPORT_SYMBOL(class_uuid_parse);
632 EXPORT_SYMBOL(class_uuid_unparse);
633 //EXPORT_SYMBOL(class_multi_setup);
634 //EXPORT_SYMBOL(class_multi_cleanup);
635
636 EXPORT_SYMBOL(class_signal_connection_failure);
637 EXPORT_SYMBOL(mds_destroy_export);
638 EXPORT_SYMBOL(ldlm_destroy_export);
639
640 static int __init init_obdclass(void)
641 {
642         int err;
643         int i;
644
645         printk(KERN_INFO "OBD class driver  v0.9, info@clusterfs.com\n");
646
647         sema_init(&obd_conf_sem, 1);
648         INIT_LIST_HEAD(&obd_types);
649
650         if ((err = misc_register(&obd_psdev))) {
651                 CERROR("cannot register %d err %d\n", OBD_MINOR, err);
652                 return err;
653         }
654
655         for (i = 0; i < MAX_OBD_DEVICES; i++) {
656                 memset(&(obd_dev[i]), 0, sizeof(obd_dev[i]));
657                 obd_dev[i].obd_minor = i;
658                 INIT_LIST_HEAD(&obd_dev[i].obd_exports);
659         }
660
661         err = obd_init_caches();
662         if (err)
663                 return err;
664         obd_sysctl_init();
665         return 0;
666 }
667
668 static void __exit cleanup_obdclass(void)
669 {
670         int i;
671         ENTRY;
672
673         misc_deregister(&obd_psdev);
674         for (i = 0; i < MAX_OBD_DEVICES; i++) {
675                 struct obd_device *obd = &obd_dev[i];
676                 if (obd->obd_type && (obd->obd_flags & OBD_SET_UP) &&
677                     OBT(obd) && OBP(obd, detach)) {
678                         /* XXX should this call generic detach otherwise? */
679                         OBP(obd, detach)(obd);
680                 }
681         }
682
683         obd_cleanup_caches();
684         obd_sysctl_clean();
685         CERROR("obd memory leaked: %ld bytes\n", obd_memory);
686         EXIT;
687 }
688
689 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
690 MODULE_DESCRIPTION("Lustre Class Driver v1.0");
691 MODULE_LICENSE("GPL");
692
693 module_init(init_obdclass);
694 module_exit(cleanup_obdclass);