Re: [PATCH 3/3] Bluetooth: Fix waiting for clearing of BT_SK_SUSPEND flag

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

 



Hi Marcel,

On Fri, Sep 13, 2013, Marcel Holtmann wrote:
> > In the case of blocking sockets we should not proceed with sendmsg() if
> > the socket has the BT_SK_SUSPEND flag set. So far the code was only
> > ensuring that POLLOUT doesn't get set for non-blocking sockets using
> > poll() but there was no code in place to ensure that blocking sockets do
> > the right thing when writing to them.
> > 
> > This patch adds a new bt_sock_wait_unsuspend helper function to sleep in
> > the sendmsg call if the BT_SK_SUSPEND flag is set, and wake up as soon
> > as it is unset. It also updates the L2CAP and RFCOMM sendmsg callbacks
> > to take advantage of this new helper function.
> > 
> > Signed-off-by: Johan Hedberg <johan.hedberg@xxxxxxxxx>
> > ---
> > include/net/bluetooth/bluetooth.h |  1 +
> > net/bluetooth/af_bluetooth.c      | 38 ++++++++++++++++++++++++++++++++++++++
> > net/bluetooth/l2cap_sock.c        |  6 ++++++
> > net/bluetooth/rfcomm/sock.c       |  7 +++++--
> > 4 files changed, 50 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> > index 10d43d8..3299d42 100644
> > --- a/include/net/bluetooth/bluetooth.h
> > +++ b/include/net/bluetooth/bluetooth.h
> > @@ -249,6 +249,7 @@ int  bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
> > uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
> > int  bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
> > int  bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
> > +int  bt_sock_wait_unsuspend(struct sock *sk, unsigned long flags);
> 
> I am not a huge fan of the term unsuspend. Maybe wait_ready is better here.

I'll change it to wait_ready in the next version. I used unsuspend
simply because it waits for the clearing of a flag called SUSPEND.

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