Print this page
3525 Persistent L2ARC

@@ -1477,14 +1477,27 @@
                         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 persist = B_FALSE;
+
+                                if (spa->spa_load_state != SPA_LOAD_TRYIMPORT) {
+                                        /*
+                                         * Only allow to do the L2ARC rebuild
+                                         * when not doing a spa try-load.
+                                         */
+                                        (void) nvlist_lookup_boolean_value(
+                                            l2cache[i],
+                                            ZPOOL_CONFIG_L2CACHE_PERSISTENT,
+                                            &persist);
                 }
+                                l2arc_add_vdev(spa, vd, persist);
         }
+                }
+        }
 
         /*
          * Purge vdevs that were dropped
          */
         for (i = 0; i < oldnvdevs; i++) {

@@ -3878,15 +3891,10 @@
         if (spa->spa_spares.sav_config) {
                 nvlist_free(spa->spa_spares.sav_config);
                 spa->spa_spares.sav_config = NULL;
                 spa_load_spares(spa);
         }
-        if (spa->spa_l2cache.sav_config) {
-                nvlist_free(spa->spa_l2cache.sav_config);
-                spa->spa_l2cache.sav_config = NULL;
-                spa_load_l2cache(spa);
-        }
 
         VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
             &nvroot) == 0);
         if (error == 0)
                 error = spa_validate_aux(spa, nvroot, -1ULL,