Whamcloud - gitweb
b=23503 Oops at __percpu_counter_add+0x1b
authorDmitry Zogin <dmitry.zoguine@oracle.com>
Fri, 13 Aug 2010 16:52:12 +0000 (12:52 -0400)
committerJohann Lombardi <johann.lombardi@oracle.com>
Fri, 27 Aug 2010 21:58:13 +0000 (23:58 +0200)
 Use bdi_init()/bdi_destroy() to proper initialize backing_dev_info
 structure regardless of HAVE_NEW_BACKING_DEV_INFO.

 i=sheng.yang
 i=johann.lombardi

lustre/autoconf/lustre-core.m4
lustre/llite/llite_lib.c

index edcf126..ede5127 100644 (file)
@@ -1649,6 +1649,16 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# 2.6.27 has bdi_init()/bdi_destroy() functions.
+AC_DEFUN([LC_EXPORT_BDI_INIT],
+[LB_CHECK_SYMBOL_EXPORT([bdi_init],
+[mm/backing-dev.c],[
+        AC_DEFINE(HAVE_BDI_INIT, 1,
+                [bdi_init/bdi_destroy functions are present])
+],[
+])
+])
+
 # 2.6.29 change prepare/commit_write to write_begin/end
 AC_DEFUN([LC_WRITE_BEGIN_END],
 [AC_MSG_CHECKING([if kernel has .write_begin/end])
@@ -1967,6 +1977,7 @@ AC_DEFUN([LC_PROG_LINUX],
           LC_VFS_SYMLINK_5ARGS
           LC_SB_ANY_QUOTA_ACTIVE
           LC_SB_HAS_QUOTA_ACTIVE
+          LC_EXPORT_BDI_INIT
 
           #2.6.29
           LC_WRITE_BEGIN_END
index cdd958f..d37155a 100644 (file)
@@ -1131,20 +1131,16 @@ int ll_fill_super(struct super_block *sb)
         if (err)
                 GOTO(out_free, err);
 
-        memset(&lsi->bdi, 0, sizeof(lsi->bdi));
-#ifdef HAVE_NEW_BACKING_DEV_INFO
-        lsi->bdi.name = "lustre",
-        lsi->bdi.capabilities   = BDI_CAP_MAP_COPY,
+#ifdef HAVE_BDI_INIT
         err = bdi_init(&lsi->bdi);
         if (err)
                 GOTO(out_free, err);
-
+#endif
+#ifdef HAVE_NEW_BACKING_DEV_INFO
+        lsi->bdi.name = "lustre";
+        lsi->bdi.capabilities = BDI_CAP_MAP_COPY;
         err = bdi_register(&lsi->bdi, NULL, "lustre-%d",
                                 atomic_inc_return(&ll_bdi_num));
-        if (err) {
-                bdi_destroy(&lsi->bdi);
-                GOTO(out_free, err);
-        }
         sb->s_bdi = &lsi->bdi;
 #endif
 
@@ -1211,9 +1207,14 @@ void ll_put_super(struct super_block *sb)
                 class_del_profile(profilenm);
 
 #ifdef HAVE_NEW_BACKING_DEV_INFO
-        if (lsi->bdi.wb_cnt > 0)
+        if (lsi->bdi.wb_cnt > 0) {
+#endif
+#ifdef HAVE_BDI_INIT
                 bdi_destroy(&lsi->bdi);
 #endif
+#ifdef HAVE_NEW_BACKING_DEV_INFO
+        }
+#endif
 
         ll_free_sbi(sb);
         lsi->lsi_llsbi = NULL;