* Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx> [2010-11-17 21:11:41 -0200]: > * Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx> [2010-11-05 10:37:11 -0400]: > > > Hi Ville, > > > > * Ville Tervo <ville.tervo@xxxxxxxxx> [2010-11-05 15:49:35 +0200]: > > > > > Hi Gustavo, > > > > > > On Tue, Nov 02, 2010 at 04:03:12PM +0100, ext Gustavo F. Padovan wrote: > > > > It also have to change the name of the function to > > > > l2cap_get_sock_by_addr() because we do hold the lock inside it now. > > > > > > > > Signed-off-by: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx> > > > > --- > > > > net/bluetooth/l2cap.c | 17 ++++++----------- > > > > 1 files changed, 6 insertions(+), 11 deletions(-) > > > > > > > > diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c > > > > index 6f931cc..3d48867 100644 > > > > --- a/net/bluetooth/l2cap.c > > > > +++ b/net/bluetooth/l2cap.c > > > > @@ -728,15 +728,18 @@ static inline void l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, stru > > > > } > > > > > > > > /* ---- Socket interface ---- */ > > > > -static struct sock *__l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src) > > > > +static struct sock *l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src) > > > > { > > > > struct sock *sk; > > > > struct hlist_node *node; > > > > + > > > > + write_lock_bh(&l2cap_sk_list.lock); > > > > > > Code is only reading so read_lock_bh would be enough? > > > > Sure, I didn't looked to that, I just keept the same code that we were > > using before. I'll fix it. > > I figured out that we need write_lock_bh() here, because set the psm and > sport is like a new element to the list. l2cap_get_sock_by_addr() > searches for either psm or sport. > > I'm also dropping the option to use RCU on the bt_sk_list(), It does not > fit on our case. We can't have anyone writing the list while we are > reading it. That said, only patch 4 and 5 are still valid (I'll resend them), and 6 is so trivial that I put it upstream already. -- Gustavo F. Padovan http://profusion.mobi -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html