Print this page
3525 Persistent L2ARC

@@ -1483,14 +1483,20 @@
                         if (vdev_open(vd) != 0)
                                 continue;
 
                         (void) vdev_validate_aux(vd);
 
-                        if (!vdev_is_dead(vd))
-                                l2arc_add_vdev(spa, vd);
+                        if (!vdev_is_dead(vd)) {
+                                boolean_t do_rebuild = B_FALSE;
+
+                                (void) nvlist_lookup_boolean_value(l2cache[i],
+                                    ZPOOL_CONFIG_L2CACHE_PERSISTENT,
+                                    &do_rebuild);
+                                l2arc_add_vdev(spa, vd, do_rebuild);
                 }
         }
+        }
 
         /*
          * Purge vdevs that were dropped
          */
         for (i = 0; i < oldnvdevs; i++) {

@@ -2694,10 +2700,12 @@
                  * Clean up any stale temporary dataset userrefs.
                  */
                 dsl_pool_clean_tmp_userrefs(spa->spa_dsl_pool);
         }
 
+        spa_async_request(spa, SPA_ASYNC_L2CACHE_REBUILD);
+
         return (0);
 }
 
 static int
 spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig)

@@ -5643,10 +5651,16 @@
          */
         if (tasks & SPA_ASYNC_RESILVER)
                 dsl_resilver_restart(spa->spa_dsl_pool, 0);
 
         /*
+         * Kick off L2 cache rebuilding.
+         */
+        if (tasks & SPA_ASYNC_L2CACHE_REBUILD)
+                l2arc_spa_rebuild_start(spa);
+
+        /*
          * Let the world know that we're done.
          */
         mutex_enter(&spa->spa_async_lock);
         spa->spa_async_thread = NULL;
         cv_broadcast(&spa->spa_async_cv);