Răsfoiți Sursa

Bluetooth: Add debug logs to help track locking issues

This patch adds some extra debug logs to L2CAP related code. These are
mainly to help track locking issues but will probably be useful for
debugging other types of issues as well.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Johan Hedberg 11 ani în urmă
părinte
comite
49d1174130
2 a modificat fișierele cu 11 adăugiri și 2 ștergeri
  1. 2 1
      net/bluetooth/l2cap_core.c
  2. 9 1
      net/bluetooth/l2cap_sock.c

+ 2 - 1
net/bluetooth/l2cap_core.c

@@ -570,7 +570,8 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
 
 
 	__clear_chan_timer(chan);
 	__clear_chan_timer(chan);
 
 
-	BT_DBG("chan %p, conn %p, err %d", chan, conn, err);
+	BT_DBG("chan %p, conn %p, err %d, state %s", chan, conn, err,
+	       state_to_string(chan->state));
 
 
 	chan->ops->teardown(chan, err);
 	chan->ops->teardown(chan, err);
 
 

+ 9 - 1
net/bluetooth/l2cap_sock.c

@@ -1102,6 +1102,8 @@ static int l2cap_sock_shutdown(struct socket *sock, int how)
 	chan = l2cap_pi(sk)->chan;
 	chan = l2cap_pi(sk)->chan;
 	conn = chan->conn;
 	conn = chan->conn;
 
 
+	BT_DBG("chan %p state %s", chan, state_to_string(chan->state));
+
 	if (conn)
 	if (conn)
 		mutex_lock(&conn->chan_lock);
 		mutex_lock(&conn->chan_lock);
 
 
@@ -1159,12 +1161,16 @@ static void l2cap_sock_cleanup_listen(struct sock *parent)
 {
 {
 	struct sock *sk;
 	struct sock *sk;
 
 
-	BT_DBG("parent %p", parent);
+	BT_DBG("parent %p state %s", parent,
+	       state_to_string(parent->sk_state));
 
 
 	/* Close not yet accepted channels */
 	/* Close not yet accepted channels */
 	while ((sk = bt_accept_dequeue(parent, NULL))) {
 	while ((sk = bt_accept_dequeue(parent, NULL))) {
 		struct l2cap_chan *chan = l2cap_pi(sk)->chan;
 		struct l2cap_chan *chan = l2cap_pi(sk)->chan;
 
 
+		BT_DBG("child chan %p state %s", chan,
+		       state_to_string(chan->state));
+
 		l2cap_chan_lock(chan);
 		l2cap_chan_lock(chan);
 		__clear_chan_timer(chan);
 		__clear_chan_timer(chan);
 		l2cap_chan_close(chan, ECONNRESET);
 		l2cap_chan_close(chan, ECONNRESET);
@@ -1252,6 +1258,8 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)
 	struct sock *sk = chan->data;
 	struct sock *sk = chan->data;
 	struct sock *parent;
 	struct sock *parent;
 
 
+	BT_DBG("chan %p state %s", chan, state_to_string(chan->state));
+
 	/* This callback can be called both for server (BT_LISTEN)
 	/* This callback can be called both for server (BT_LISTEN)
 	 * sockets as well as "normal" ones. To avoid lockdep warnings
 	 * sockets as well as "normal" ones. To avoid lockdep warnings
 	 * with child socket locking (through l2cap_sock_cleanup_listen)
 	 * with child socket locking (through l2cap_sock_cleanup_listen)