cxgbe(4): must hold a write-lock on the table while allocating an L2

entry for switching.

MFC after:	3 days
This commit is contained in:
np 2012-12-21 19:28:17 +00:00
parent 10fd5103d0
commit cd0363b24b

View File

@ -149,7 +149,7 @@ t4_l2t_alloc_switching(struct l2t_data *d)
{
struct l2t_entry *e;
rw_rlock(&d->lock);
rw_wlock(&d->lock);
e = t4_alloc_l2e(d);
if (e) {
mtx_lock(&e->lock); /* avoid race with t4_l2t_free */
@ -157,7 +157,7 @@ t4_l2t_alloc_switching(struct l2t_data *d)
atomic_store_rel_int(&e->refcnt, 1);
mtx_unlock(&e->lock);
}
rw_runlock(&d->lock);
rw_wunlock(&d->lock);
return e;
}