altq/hfsc: Clear poll-cache if the cached hfsc class is to be destroyed
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 21 Dec 2011 08:01:58 +0000 (16:01 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 21 Dec 2011 08:01:58 +0000 (16:01 +0800)
Reported-by: pavalos@
sys/net/altq/altq_hfsc.c

index 303e539..ef0b475 100644 (file)
@@ -540,6 +540,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
 static int
 hfsc_class_destroy(struct hfsc_class *cl)
 {
+       struct hfsc_if *hif = cl->cl_hif;
        int i;
 
        if (cl == NULL)
@@ -572,13 +573,13 @@ hfsc_class_destroy(struct hfsc_class *cl)
        }
 
        for (i = 0; i < HFSC_MAX_CLASSES; i++) {
-               if (cl->cl_hif->hif_class_tbl[i] == cl) {
-                       cl->cl_hif->hif_class_tbl[i] = NULL;
+               if (hif->hif_class_tbl[i] == cl) {
+                       hif->hif_class_tbl[i] = NULL;
                        break;
                }
        }
 
-       cl->cl_hif->hif_classes--;
+       hif->hif_classes--;
        crit_exit();
 
        actlist_destroy(cl->cl_actc);
@@ -594,10 +595,12 @@ hfsc_class_destroy(struct hfsc_class *cl)
 #endif
        }
 
-       if (cl == cl->cl_hif->hif_rootclass)
-               cl->cl_hif->hif_rootclass = NULL;
-       if (cl == cl->cl_hif->hif_defaultclass)
-               cl->cl_hif->hif_defaultclass = NULL;
+       if (cl == hif->hif_rootclass)
+               hif->hif_rootclass = NULL;
+       if (cl == hif->hif_defaultclass)
+               hif->hif_defaultclass = NULL;
+       if (cl == hif->hif_pollcache)
+               hif->hif_pollcache = NULL;
 
        if (cl->cl_usc != NULL)
                kfree(cl->cl_usc, M_ALTQ);