Whamcloud - gitweb
LU-824 corrupted ldiskfs after md rebuild (bz24264)
[fs/lustre-release.git] / lustre / ldlm / ldlm_pool.c
index fa55e42..4f5b42d 100644 (file)
@@ -28,6 +28,9 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011 Whamcloud, Inc.
+ *
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -551,7 +554,7 @@ static int ldlm_cli_pool_shrink(struct ldlm_pool *pl,
         cfs_spin_unlock(&ns->ns_lock);
         
         if (nr) {
-                canceled = ldlm_cancel_lru(ns, nr, LDLM_SYNC, 
+                canceled = ldlm_cancel_lru(ns, nr, LDLM_ASYNC,
                                            LDLM_CANCEL_SHRINK);
         }
 #ifdef __KERNEL__
@@ -1151,14 +1154,18 @@ static int ldlm_pools_shrink(ldlm_side_t client, int nr,
         return cached;
 }
 
-static int KERN_SHRINKER(ldlm_pools_srv_shrink)
+static int ldlm_pools_srv_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
 {
-        return ldlm_pools_shrink(LDLM_NAMESPACE_SERVER, nr_to_scan, gfp_mask);
+        return ldlm_pools_shrink(LDLM_NAMESPACE_SERVER,
+                                 shrink_param(sc, nr_to_scan),
+                                 shrink_param(sc, gfp_mask));
 }
 
-static int KERN_SHRINKER(ldlm_pools_cli_shrink)
+static int ldlm_pools_cli_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
 {
-        return ldlm_pools_shrink(LDLM_NAMESPACE_CLIENT, nr_to_scan, gfp_mask);
+        return ldlm_pools_shrink(LDLM_NAMESPACE_CLIENT,
+                                 shrink_param(sc, nr_to_scan),
+                                 shrink_param(sc, gfp_mask));
 }
 
 void ldlm_pools_recalc(ldlm_side_t client)
@@ -1262,9 +1269,9 @@ void ldlm_pools_recalc(ldlm_side_t client)
                 cfs_spin_lock(&ns->ns_lock);
                 /*
                  * skip ns which is being freed, and we don't want to increase
-                 * its refcount again, not even temporarily. bz21519.
+                 * its refcount again, not even temporarily. bz21519 & LU-499.
                  */
-                if (cfs_atomic_read(&ns->ns_bref) == 0) {
+                if (ns->ns_stopping) {
                         skip = 1;
                 } else {
                         skip = 0;
@@ -1355,8 +1362,8 @@ static int ldlm_pools_thread_start(void)
          * CLONE_VM and CLONE_FILES just avoid a needless copy, because we
          * just drop the VM and FILES in cfs_daemonize() right away.
          */
-        rc = cfs_kernel_thread(ldlm_pools_thread_main, ldlm_pools_thread,
-                               CLONE_VM | CLONE_FILES);
+        rc = cfs_create_thread(ldlm_pools_thread_main, ldlm_pools_thread,
+                               CFS_DAEMON_FLAGS);
         if (rc < 0) {
                 CERROR("Can't start pool thread, error %d\n",
                        rc);