Whamcloud - gitweb
Branch HEAD
[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  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright  2008 Sun Microsystems, Inc. All rights reserved
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  */
36
37 #define DEBUG_SUBSYSTEM S_CLASS
38 #ifndef EXPORT_SYMTAB
39 # define EXPORT_SYMTAB
40 #endif
41 #ifndef __KERNEL__
42 # include <liblustre.h>
43 #else
44 # include <asm/atomic.h>
45 #endif
46
47 #include <obd_support.h>
48 #include <obd_class.h>
49 #include <lustre_debug.h>
50 #include <lprocfs_status.h>
51 #include <lustre/lustre_build_version.h>
52 #include <libcfs/list.h>
53 #include "llog_internal.h"
54
55 #ifndef __KERNEL__
56 /* liblustre workaround */
57 atomic_t libcfs_kmemory = {0};
58 #endif
59
60 struct obd_device *obd_devs[MAX_OBD_DEVICES];
61 struct list_head obd_types;
62 spinlock_t obd_dev_lock = SPIN_LOCK_UNLOCKED;
63
64 #ifndef __KERNEL__
65 __u64 obd_max_pages = 0;
66 __u64 obd_max_alloc = 0;
67 __u64 obd_alloc;
68 __u64 obd_pages;
69 #endif
70
71 /* The following are visible and mutable through /proc/sys/lustre/. */
72 unsigned int obd_debug_peer_on_timeout;
73 unsigned int obd_dump_on_timeout;
74 unsigned int obd_dump_on_eviction;
75 unsigned int obd_timeout = OBD_TIMEOUT_DEFAULT;   /* seconds */
76 unsigned int ldlm_timeout = LDLM_TIMEOUT_DEFAULT; /* seconds */
77 unsigned int obd_max_dirty_pages = 256;
78 atomic_t obd_dirty_pages;
79
80 cfs_waitq_t obd_race_waitq;
81 int obd_race_state;
82
83 #ifdef __KERNEL__
84 unsigned long obd_print_fail_loc(void)
85 {
86         CWARN("obd_fail_loc = %lx\n", obd_fail_loc);
87         return obd_fail_loc;
88 }
89
90 /*  opening /dev/obd */
91 static int obd_class_open(unsigned long flags, void *args)
92 {
93         ENTRY;
94
95         PORTAL_MODULE_USE;
96         RETURN(0);
97 }
98
99 /*  closing /dev/obd */
100 static int obd_class_release(unsigned long flags, void *args)
101 {
102         ENTRY;
103
104         PORTAL_MODULE_UNUSE;
105         RETURN(0);
106 }
107 #endif
108
109 static inline void obd_data2conn(struct lustre_handle *conn,
110                                  struct obd_ioctl_data *data)
111 {
112         memset(conn, 0, sizeof *conn);
113         conn->cookie = data->ioc_cookie;
114 }
115
116 static inline void obd_conn2data(struct obd_ioctl_data *data,
117                                  struct lustre_handle *conn)
118 {
119         data->ioc_cookie = conn->cookie;
120 }
121
122 int class_resolve_dev_name(__u32 len, const char *name)
123 {
124         int rc;
125         int dev;
126
127         ENTRY;
128         if (!len || !name) {
129                 CERROR("No name passed,!\n");
130                 GOTO(out, rc = -EINVAL);
131         }
132         if (name[len - 1] != 0) {
133                 CERROR("Name not nul terminated!\n");
134                 GOTO(out, rc = -EINVAL);
135         }
136
137         CDEBUG(D_IOCTL, "device name %s\n", name);
138         dev = class_name2dev(name);
139         if (dev == -1) {
140                 CDEBUG(D_IOCTL, "No device for name %s!\n", name);
141                 GOTO(out, rc = -EINVAL);
142         }
143
144         CDEBUG(D_IOCTL, "device name %s, dev %d\n", name, dev);
145         rc = dev;
146
147 out:
148         RETURN(rc);
149 }
150
151 int class_handle_ioctl(unsigned int cmd, unsigned long arg)
152 {
153         char *buf = NULL;
154         struct obd_ioctl_data *data;
155         struct libcfs_debug_ioctl_data *debug_data;
156         struct obd_device *obd = NULL;
157         int err = 0, len = 0;
158         ENTRY;
159
160         /* only for debugging */
161         if (cmd == LIBCFS_IOC_DEBUG_MASK) {
162                 debug_data = (struct libcfs_debug_ioctl_data*)arg;
163                 libcfs_subsystem_debug = debug_data->subs;
164                 libcfs_debug = debug_data->debug;
165                 return 0;
166         }
167
168         CDEBUG(D_IOCTL, "cmd = %x\n", cmd);
169         if (obd_ioctl_getdata(&buf, &len, (void *)arg)) {
170                 CERROR("OBD ioctl: data error\n");
171                 GOTO(out, err = -EINVAL);
172         }
173         data = (struct obd_ioctl_data *)buf;
174
175         switch (cmd) {
176         case OBD_IOC_PROCESS_CFG: {
177                 struct lustre_cfg *lcfg;
178
179                 if (!data->ioc_plen1 || !data->ioc_pbuf1) {
180                         CERROR("No config buffer passed!\n");
181                         GOTO(out, err = -EINVAL);
182                 }
183                 OBD_ALLOC(lcfg, data->ioc_plen1);
184                 if (lcfg == NULL)
185                         GOTO(out, err = -ENOMEM);
186                 err = copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1);
187                 if (!err)
188                         err = lustre_cfg_sanity_check(lcfg, data->ioc_plen1);
189                 if (!err)
190                         err = class_process_config(lcfg);
191
192                 OBD_FREE(lcfg, data->ioc_plen1);
193                 GOTO(out, err);
194         }
195
196         case OBD_GET_VERSION:
197                 if (!data->ioc_inlbuf1) {
198                         CERROR("No buffer passed in ioctl\n");
199                         GOTO(out, err = -EINVAL);
200                 }
201
202                 if (strlen(BUILD_VERSION) + 1 > data->ioc_inllen1) {
203                         CERROR("ioctl buffer too small to hold version\n");
204                         GOTO(out, err = -EINVAL);
205                 }
206
207                 memcpy(data->ioc_bulk, BUILD_VERSION,
208                        strlen(BUILD_VERSION) + 1);
209
210                 err = obd_ioctl_popdata((void *)arg, data, len);
211                 if (err)
212                         err = -EFAULT;
213                 GOTO(out, err);
214
215         case OBD_IOC_NAME2DEV: {
216                 /* Resolve a device name.  This does not change the
217                  * currently selected device.
218                  */
219                 int dev;
220
221                 dev = class_resolve_dev_name(data->ioc_inllen1,
222                                              data->ioc_inlbuf1);
223                 data->ioc_dev = dev;
224                 if (dev < 0)
225                         GOTO(out, err = -EINVAL);
226
227                 err = obd_ioctl_popdata((void *)arg, data, sizeof(*data));
228                 if (err)
229                         err = -EFAULT;
230                 GOTO(out, err);
231         }
232
233         case OBD_IOC_UUID2DEV: {
234                 /* Resolve a device uuid.  This does not change the
235                  * currently selected device.
236                  */
237                 int dev;
238                 struct obd_uuid uuid;
239
240                 if (!data->ioc_inllen1 || !data->ioc_inlbuf1) {
241                         CERROR("No UUID passed!\n");
242                         GOTO(out, err = -EINVAL);
243                 }
244                 if (data->ioc_inlbuf1[data->ioc_inllen1 - 1] != 0) {
245                         CERROR("UUID not NUL terminated!\n");
246                         GOTO(out, err = -EINVAL);
247                 }
248
249                 CDEBUG(D_IOCTL, "device name %s\n", data->ioc_inlbuf1);
250                 obd_str2uuid(&uuid, data->ioc_inlbuf1);
251                 dev = class_uuid2dev(&uuid);
252                 data->ioc_dev = dev;
253                 if (dev == -1) {
254                         CDEBUG(D_IOCTL, "No device for UUID %s!\n",
255                                data->ioc_inlbuf1);
256                         GOTO(out, err = -EINVAL);
257                 }
258
259                 CDEBUG(D_IOCTL, "device name %s, dev %d\n", data->ioc_inlbuf1,
260                        dev);
261                 err = obd_ioctl_popdata((void *)arg, data, sizeof(*data));
262                 if (err)
263                         err = -EFAULT;
264                 GOTO(out, err);
265         }
266
267         case OBD_IOC_CLOSE_UUID: {
268                 CDEBUG(D_IOCTL, "closing all connections to uuid %s (NOOP)\n",
269                        data->ioc_inlbuf1);
270                 GOTO(out, err = 0);
271         }
272
273         case OBD_IOC_GETDEVICE: {
274                 int     index = data->ioc_count;
275                 char    *status, *str;
276
277                 if (!data->ioc_inlbuf1) {
278                         CERROR("No buffer passed in ioctl\n");
279                         GOTO(out, err = -EINVAL);
280                 }
281                 if (data->ioc_inllen1 < 128) {
282                         CERROR("ioctl buffer too small to hold version\n");
283                         GOTO(out, err = -EINVAL);
284                 }
285
286                 obd = class_num2obd(index);
287                 if (!obd)
288                         GOTO(out, err = -ENOENT);
289
290                 if (obd->obd_stopping)
291                         status = "ST";
292                 else if (obd->obd_set_up)
293                         status = "UP";
294                 else if (obd->obd_attached)
295                         status = "AT";
296                 else
297                         status = "--";
298                 str = (char *)data->ioc_bulk;
299                 snprintf(str, len - sizeof(*data), "%3d %s %s %s %s %d",
300                          (int)index, status, obd->obd_type->typ_name,
301                          obd->obd_name, obd->obd_uuid.uuid,
302                          atomic_read(&obd->obd_refcount));
303                 err = obd_ioctl_popdata((void *)arg, data, len);
304
305                 GOTO(out, err = 0);
306         }
307
308         }
309
310         if (data->ioc_dev >= class_devno_max()) {
311                 CERROR("OBD ioctl: No device\n");
312                 GOTO(out, err = -EINVAL);
313         }
314
315         obd = class_num2obd(data->ioc_dev);
316         if (obd == NULL) {
317                 CERROR("OBD ioctl : No Device %d\n", data->ioc_dev);
318                 GOTO(out, err = -EINVAL);
319         }
320         LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
321
322         if (!obd->obd_set_up || obd->obd_stopping) {
323                 CERROR("OBD ioctl: device not setup %d \n", data->ioc_dev);
324                 GOTO(out, err = -EINVAL);
325         }
326
327         switch(cmd) {
328         case OBD_IOC_NO_TRANSNO: {
329                 if (!obd->obd_attached) {
330                         CERROR("Device %d not attached\n", obd->obd_minor);
331                         GOTO(out, err = -ENODEV);
332                 }
333                 CDEBUG(D_HA, "%s: disabling committed-transno notification\n",
334                        obd->obd_name);
335                 obd->obd_no_transno = 1;
336                 GOTO(out, err = 0);
337         }
338
339         default: {
340                 err = obd_iocontrol(cmd, obd->obd_self_export, len, data, NULL);
341                 if (err)
342                         GOTO(out, err);
343
344                 err = obd_ioctl_popdata((void *)arg, data, len);
345                 if (err)
346                         err = -EFAULT;
347                 GOTO(out, err);
348         }
349         }
350
351  out:
352         if (buf)
353                 obd_ioctl_freedata(buf, len);
354         RETURN(err);
355 } /* class_handle_ioctl */
356
357
358
359 #define OBD_MINOR 241
360 #ifdef __KERNEL__
361 /* to control /dev/obd */
362 static int obd_class_ioctl (struct cfs_psdev_file *pfile, unsigned long cmd,
363                             void *arg)
364 {
365         return class_handle_ioctl(cmd, (unsigned long)arg);
366 }
367
368 /* declare character device */
369 struct cfs_psdev_ops obd_psdev_ops = {
370         /* .p_open    = */ obd_class_open,      /* open */
371         /* .p_close   = */ obd_class_release,   /* release */
372         /* .p_read    = */ NULL,
373         /* .p_write   = */ NULL,
374         /* .p_ioctl   = */ obd_class_ioctl     /* ioctl */
375 };
376
377 extern cfs_psdev_t obd_psdev;
378 #else
379 void *obd_psdev = NULL;
380 #endif
381
382 EXPORT_SYMBOL(obd_devs);
383 EXPORT_SYMBOL(obd_print_fail_loc);
384 EXPORT_SYMBOL(obd_race_waitq);
385 EXPORT_SYMBOL(obd_race_state);
386 EXPORT_SYMBOL(obd_debug_peer_on_timeout);
387 EXPORT_SYMBOL(obd_dump_on_timeout);
388 EXPORT_SYMBOL(obd_dump_on_eviction);
389 EXPORT_SYMBOL(obd_timeout);
390 EXPORT_SYMBOL(ldlm_timeout);
391 EXPORT_SYMBOL(obd_max_dirty_pages);
392 EXPORT_SYMBOL(obd_dirty_pages);
393 EXPORT_SYMBOL(ptlrpc_put_connection_superhack);
394
395 EXPORT_SYMBOL(proc_lustre_root);
396
397 EXPORT_SYMBOL(class_register_type);
398 EXPORT_SYMBOL(class_unregister_type);
399 EXPORT_SYMBOL(class_get_type);
400 EXPORT_SYMBOL(class_put_type);
401 EXPORT_SYMBOL(class_name2dev);
402 EXPORT_SYMBOL(class_name2obd);
403 EXPORT_SYMBOL(class_uuid2dev);
404 EXPORT_SYMBOL(class_uuid2obd);
405 EXPORT_SYMBOL(class_find_client_obd);
406 EXPORT_SYMBOL(class_find_client_notype);
407 EXPORT_SYMBOL(class_devices_in_group);
408 EXPORT_SYMBOL(class_conn2export);
409 EXPORT_SYMBOL(class_exp2obd);
410 EXPORT_SYMBOL(class_conn2obd);
411 EXPORT_SYMBOL(class_exp2cliimp);
412 EXPORT_SYMBOL(class_conn2cliimp);
413 EXPORT_SYMBOL(class_disconnect);
414 EXPORT_SYMBOL(class_num2obd);
415
416 /* uuid.c */
417 EXPORT_SYMBOL(class_uuid_unparse);
418 EXPORT_SYMBOL(lustre_uuid_to_peer);
419
420 EXPORT_SYMBOL(class_handle_hash);
421 EXPORT_SYMBOL(class_handle_unhash);
422 EXPORT_SYMBOL(class_handle_hash_back);
423 EXPORT_SYMBOL(class_handle2object);
424 EXPORT_SYMBOL(class_handle_free_cb);
425
426 /* obd_config.c */
427 EXPORT_SYMBOL(class_incref);
428 EXPORT_SYMBOL(class_decref);
429 EXPORT_SYMBOL(class_get_profile);
430 EXPORT_SYMBOL(class_del_profile);
431 EXPORT_SYMBOL(class_del_profiles);
432 EXPORT_SYMBOL(class_process_config);
433 EXPORT_SYMBOL(class_process_proc_param);
434 EXPORT_SYMBOL(class_config_parse_llog);
435 EXPORT_SYMBOL(class_config_dump_llog);
436 EXPORT_SYMBOL(class_attach);
437 EXPORT_SYMBOL(class_setup);
438 EXPORT_SYMBOL(class_cleanup);
439 EXPORT_SYMBOL(class_detach);
440 EXPORT_SYMBOL(class_manual_cleanup);
441
442 /* mea.c */
443 EXPORT_SYMBOL(mea_name2idx);
444 EXPORT_SYMBOL(raw_name2idx);
445
446 #define OBD_INIT_CHECK
447 #ifdef OBD_INIT_CHECK
448 int obd_init_checks(void)
449 {
450         __u64 u64val, div64val;
451         char buf[64];
452         int len, ret = 0;
453
454         CDEBUG(D_INFO, "LPU64=%s, LPD64=%s, LPX64=%s, LPSZ=%s, LPSSZ=%s\n",
455                LPU64, LPD64, LPX64, LPSZ, LPSSZ);
456
457         CDEBUG(D_INFO, "OBD_OBJECT_EOF = "LPX64"\n", (__u64)OBD_OBJECT_EOF);
458
459         u64val = OBD_OBJECT_EOF;
460         CDEBUG(D_INFO, "u64val OBD_OBJECT_EOF = "LPX64"\n", u64val);
461         if (u64val != OBD_OBJECT_EOF) {
462                 CERROR("__u64 "LPX64"(%d) != 0xffffffffffffffff\n",
463                        u64val, (int)sizeof(u64val));
464                 ret = -EINVAL;
465         }
466         len = snprintf(buf, sizeof(buf), LPX64, u64val);
467         if (len != 18) {
468                 CWARN("LPX64 wrong length! strlen(%s)=%d != 18\n", buf, len);
469                 ret = -EINVAL;
470         }
471
472         div64val = OBD_OBJECT_EOF;
473         CDEBUG(D_INFO, "u64val OBD_OBJECT_EOF = "LPX64"\n", u64val);
474         if (u64val != OBD_OBJECT_EOF) {
475                 CERROR("__u64 "LPX64"(%d) != 0xffffffffffffffff\n",
476                        u64val, (int)sizeof(u64val));
477                 ret = -EOVERFLOW;
478         }
479         if (u64val >> 8 != OBD_OBJECT_EOF >> 8) {
480                 CERROR("__u64 "LPX64"(%d) != 0xffffffffffffffff\n",
481                        u64val, (int)sizeof(u64val));
482                 return -EOVERFLOW;
483         }
484         if (do_div(div64val, 256) != (u64val & 255)) {
485                 CERROR("do_div("LPX64",256) != "LPU64"\n", u64val, u64val &255);
486                 return -EOVERFLOW;
487         }
488         if (u64val >> 8 != div64val) {
489                 CERROR("do_div("LPX64",256) "LPU64" != "LPU64"\n",
490                        u64val, div64val, u64val >> 8);
491                 return -EOVERFLOW;
492         }
493         len = snprintf(buf, sizeof(buf), LPX64, u64val);
494         if (len != 18) {
495                 CWARN("LPX64 wrong length! strlen(%s)=%d != 18\n", buf, len);
496                 ret = -EINVAL;
497         }
498         len = snprintf(buf, sizeof(buf), LPU64, u64val);
499         if (len != 20) {
500                 CWARN("LPU64 wrong length! strlen(%s)=%d != 20\n", buf, len);
501                 ret = -EINVAL;
502         }
503         len = snprintf(buf, sizeof(buf), LPD64, u64val);
504         if (len != 2) {
505                 CWARN("LPD64 wrong length! strlen(%s)=%d != 2\n", buf, len);
506                 ret = -EINVAL;
507         }
508         if ((u64val & ~CFS_PAGE_MASK) >= CFS_PAGE_SIZE) {
509                 CWARN("mask failed: u64val "LPU64" >= "LPU64"\n", u64val,
510                       (__u64)CFS_PAGE_SIZE);
511                 ret = -EINVAL;
512         }
513
514         return ret;
515 }
516 #else
517 #define obd_init_checks() do {} while(0)
518 #endif
519
520 extern spinlock_t obd_types_lock;
521 extern int class_procfs_init(void);
522 extern int class_procfs_clean(void);
523
524 #ifdef __KERNEL__
525 static int __init init_obdclass(void)
526 #else
527 int init_obdclass(void)
528 #endif
529 {
530         int i, err;
531 #ifdef __KERNEL__
532         int lustre_register_fs(void);
533
534         for (i = CAPA_SITE_CLIENT; i < CAPA_SITE_MAX; i++)
535                 CFS_INIT_LIST_HEAD(&capa_list[i]);
536 #endif
537
538         LCONSOLE_INFO("OBD class driver, http://www.lustre.org/\n");
539         LCONSOLE_INFO("        Lustre Version: "LUSTRE_VERSION_STRING"\n");
540         LCONSOLE_INFO("        Build Version: "BUILD_VERSION"\n");
541
542         spin_lock_init(&obd_types_lock);
543         cfs_waitq_init(&obd_race_waitq);
544         obd_zombie_impexp_init();
545 #ifdef LPROCFS
546         obd_memory = lprocfs_alloc_stats(OBD_STATS_NUM,
547                                          LPROCFS_STATS_FLAG_PERCPU);
548         if (obd_memory == NULL) {
549                 CERROR("kmalloc of 'obd_memory' failed\n");
550                 RETURN(-ENOMEM);
551         }
552
553         lprocfs_counter_init(obd_memory, OBD_MEMORY_STAT,
554                              LPROCFS_CNTR_AVGMINMAX,
555                              "memused", "bytes");
556         lprocfs_counter_init(obd_memory, OBD_MEMORY_PAGES_STAT,
557                              LPROCFS_CNTR_AVGMINMAX,
558                              "pagesused", "pages");
559 #endif
560         err = obd_init_checks();
561         if (err == -EOVERFLOW)
562                 return err;
563
564         class_init_uuidlist();
565         err = class_handle_init();
566         if (err)
567                 return err;
568
569         spin_lock_init(&obd_dev_lock);
570         CFS_INIT_LIST_HEAD(&obd_types);
571
572         err = cfs_psdev_register(&obd_psdev);
573         if (err) {
574                 CERROR("cannot register %d err %d\n", OBD_MINOR, err);
575                 return err;
576         }
577
578         /* This struct is already zeroed for us (static global) */
579         for (i = 0; i < class_devno_max(); i++)
580                 obd_devs[i] = NULL;
581
582         /* Default the dirty page cache cap to 1/2 of system memory.
583          * For clients with less memory, a larger fraction is needed
584          * for other purposes (mostly for BGL). */
585         if (num_physpages <= 512 << (20 - CFS_PAGE_SHIFT))
586                 obd_max_dirty_pages = num_physpages / 4;
587         else
588                 obd_max_dirty_pages = num_physpages / 2;
589
590         err = obd_init_caches();
591         if (err)
592                 return err;
593 #ifdef __KERNEL__
594         err = lu_global_init();
595         if (err)
596                 return err;
597         err = class_procfs_init();
598         if (err)
599                 return err;
600         err = lustre_register_fs();
601 #endif
602
603         return err;
604 }
605
606 /* liblustre doesn't call cleanup_obdclass, apparently.  we carry on in this
607  * ifdef to the end of the file to cover module and versioning goo.*/
608 #ifdef __KERNEL__
609 static void cleanup_obdclass(void)
610 {
611         int i;
612         int lustre_unregister_fs(void);
613         __u64 memory_leaked, pages_leaked;
614         __u64 memory_max, pages_max;
615         ENTRY;
616
617         lustre_unregister_fs();
618
619         cfs_psdev_deregister(&obd_psdev);
620         for (i = 0; i < class_devno_max(); i++) {
621                 struct obd_device *obd = class_num2obd(i);
622                 if (obd && obd->obd_set_up &&
623                     OBT(obd) && OBP(obd, detach)) {
624                         /* XXX should this call generic detach otherwise? */
625                         LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
626                         OBP(obd, detach)(obd);
627                 }
628         }
629         lu_global_fini();
630
631         obd_cleanup_caches();
632         obd_sysctl_clean();
633
634         class_procfs_clean();
635
636         class_handle_cleanup();
637         class_exit_uuidlist();
638         obd_zombie_impexp_stop();
639
640         memory_leaked = obd_memory_sum();
641         pages_leaked = obd_pages_sum();
642
643         memory_max = obd_memory_max();
644         pages_max = obd_pages_max();
645
646         lprocfs_free_stats(&obd_memory);
647         CDEBUG((memory_leaked) ? D_ERROR : D_INFO,
648                "obd_memory max: "LPU64", leaked: "LPU64"\n",
649                memory_max, memory_leaked);
650         CDEBUG((pages_leaked) ? D_ERROR : D_INFO,
651                "obd_memory_pages max: "LPU64", leaked: "LPU64"\n",
652                pages_max, pages_leaked);
653
654         EXIT;
655 }
656
657 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
658 MODULE_DESCRIPTION("Lustre Class Driver Build Version: " BUILD_VERSION);
659 MODULE_LICENSE("GPL");
660
661 cfs_module(obdclass, LUSTRE_VERSION_STRING, init_obdclass, cleanup_obdclass);
662 #endif