Print this page
OS-3342+co

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/zone.c
          +++ new/usr/src/uts/common/os/zone.c
↓ open down ↓ 2244 lines elided ↑ open up ↑
2245 2245              EVCH_CREAT);
2246 2246  
2247 2247          if (res)
2248 2248                  panic("Sysevent_evc_bind failed during zone setup.\n");
2249 2249  
2250 2250  }
2251 2251  
2252 2252  static void
2253 2253  zone_free(zone_t *zone)
2254 2254  {
     2255 +        zone_dl_t *zdl;
     2256 +
2255 2257          ASSERT(zone != global_zone);
2256 2258          ASSERT(zone->zone_ntasks == 0);
2257 2259          ASSERT(zone->zone_nlwps == 0);
2258 2260          ASSERT(zone->zone_nprocs == 0);
2259 2261          ASSERT(zone->zone_cred_ref == 0);
2260 2262          ASSERT(zone->zone_kcred == NULL);
2261 2263          ASSERT(zone_status_get(zone) == ZONE_IS_DEAD ||
2262 2264              zone_status_get(zone) == ZONE_IS_UNINITIALIZED);
2263 2265          ASSERT(list_is_empty(&zone->zone_ref_list));
2264 2266  
↓ open down ↓ 8 lines elided ↑ open up ↑
2273 2275          if (zone_status_get(zone) == ZONE_IS_DEAD) {
2274 2276                  ASSERT(zone->zone_ref == 0);
2275 2277                  mutex_enter(&zone_deathrow_lock);
2276 2278                  list_remove(&zone_deathrow, zone);
2277 2279                  mutex_exit(&zone_deathrow_lock);
2278 2280          }
2279 2281  
2280 2282          list_destroy(&zone->zone_ref_list);
2281 2283          zone_free_zsd(zone);
2282 2284          zone_free_datasets(zone);
     2285 +
     2286 +        /*
     2287 +         * While dlmgmtd should have removed all of these, it could have left
     2288 +         * something behind or crashed. In which case it's not safe for us to
     2289 +         * assume that the list is empty which list_destroy() will ASSERT. We
     2290 +         * clean up for our userland comrades which may have crashed, or worse,
     2291 +         * been disabled by SMF.
     2292 +         */
     2293 +        while ((zdl = list_remove_head(&zone->zone_dl_list)) != NULL) {
     2294 +                if (zdl->zdl_net != NULL)
     2295 +                        nvlist_free(zdl->zdl_net);
     2296 +                kmem_free(zdl, sizeof (zone_dl_t));
     2297 +        }
2283 2298          list_destroy(&zone->zone_dl_list);
2284 2299  
2285 2300          if (zone->zone_rootvp != NULL)
2286 2301                  VN_RELE(zone->zone_rootvp);
2287 2302          if (zone->zone_rootpath)
2288 2303                  kmem_free(zone->zone_rootpath, zone->zone_rootpathlen);
2289 2304          if (zone->zone_name != NULL)
2290 2305                  kmem_free(zone->zone_name, ZONENAME_MAX);
2291 2306          if (zone->zone_slabel != NULL)
2292 2307                  label_rele(zone->zone_slabel);
↓ open down ↓ 4882 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX