Set curvnet context in a callout-trigerred code path.

MFC after:	3 days
This commit is contained in:
Marko Zec 2011-06-07 20:46:03 +00:00
parent ec49fe398a
commit 2fe7ca2ca6
2 changed files with 6 additions and 0 deletions

View File

@ -1860,6 +1860,8 @@ bstp_tick(void *arg)
if (bs->bs_running == 0)
return;
CURVNET_SET(bs->bs_vnet);
/* slow timer to catch missed link events */
if (bstp_timer_expired(&bs->bs_link_timer)) {
LIST_FOREACH(bp, &bs->bs_bplist, bp_next)
@ -1893,6 +1895,8 @@ bstp_tick(void *arg)
bp->bp_txcount--;
}
CURVNET_RESTORE();
callout_reset(&bs->bs_bstpcallout, hz, bstp_tick, bs);
}
@ -2126,6 +2130,7 @@ bstp_attach(struct bstp_state *bs, struct bstp_cb_ops *cb)
bs->bs_protover = BSTP_PROTO_RSTP;
bs->bs_state_cb = cb->bcb_state;
bs->bs_rtage_cb = cb->bcb_rtage;
bs->bs_vnet = curvnet;
getmicrotime(&bs->bs_last_tc_time);

View File

@ -358,6 +358,7 @@ struct bstp_state {
LIST_HEAD(, bstp_port) bs_bplist;
bstp_state_cb_t bs_state_cb;
bstp_rtage_cb_t bs_rtage_cb;
struct vnet *bs_vnet;
};
#define BSTP_LOCK_INIT(_bs) mtx_init(&(_bs)->bs_mtx, "bstp", NULL, MTX_DEF)