Re: [RFCv6 02/14] Bluetooth: Revert to mutexes from RCU list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Ulisses Furquim <ulisses@xxxxxxxxxxxxxx> [2012-02-20 15:57:52 -0300]:

> Hi Gustavo,
> 
> On Mon, Feb 20, 2012 at 3:33 PM, Gustavo Padovan <padovan@xxxxxxxxxxxxxx> wrote:
> >
> > Hi Andrei,
> >
> > * Emeltchenko Andrei <Andrei.Emeltchenko.news@xxxxxxxxx> [2012-02-20 16:21:13 +0200]:
> >
> > > From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
> > >
> > > Usage of RCU list looks not reasonalbe for a number of reasons:
> > > our code sleep and we have to use socket spinlocks, some parts
> > > of code are updaters thus we need to use mutexes anyway.
> > >
> > > Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
> > > ---
> > >  net/bluetooth/l2cap_core.c |  165 ++++++++++++++++++++++++++------------------
> > >  net/bluetooth/l2cap_sock.c |   10 +++
> > >  2 files changed, 108 insertions(+), 67 deletions(-)add an extra blank line here please.
> 
> <snip>
> 
> > > +unlock:
> > > +     mutex_unlock(&conn->chan_lock);
> > > +
> > > +     return err;
> > >  }
> > >
> > >  static inline void set_default_fcs(struct l2cap_chan *chan)
> > > @@ -2793,6 +2804,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
> > >               return -ENOENT;
> > >
> > >       sk = chan->sk;
> > > +     lock_sock(sk);
> > >
> > >       if (chan->state != BT_CONFIG && chan->state != BT_CONNECT2) {
> > >               struct l2cap_cmd_rej_cid rej;
> > > @@ -2905,6 +2917,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
> > >               return 0;
> > >
> > >       sk = chan->sk;
> > > +     lock_sock(sk);
> > >
> > >       switch (result) {
> > >       case L2CAP_CONF_SUCCESS:
> > > @@ -3006,11 +3019,16 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd
> > >
> > >       BT_DBG("scid 0x%4.4x dcid 0x%4.4x", scid, dcid);
> > >
> > > -     chan = l2cap_get_chan_by_scid(conn, dcid);
> > > -     if (!chan)
> > > +     mutex_lock(&conn->chan_lock);
> > > +
> > > +     chan = __l2cap_get_chan_by_scid(conn, dcid);
> > > +     if (!chan) {
> > > +             mutex_unlock(&conn->chan_lock);
> > >               return 0;
> >
> > Seems to me we can use l2cap_get_chan_by_scid() here.
> 
> It's better if we don't as we'll call l2cap_chan_del() which might
> remove chan from conn->chan_l that's protected by conn->chan_lock.
> Let's leave it as he sent.

Yes, I didn't realized the l2cap_chan_del() part. So after fix the new line
fix:

Acked-by: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx>

	Gustavo
--
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


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux