Re: [Bluez-devel] Oops involving RFCOMM and sysfs

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dave Young
Date: Monday, January 14, 2008 - 6:57 pm

On Mon, Jan 14, 2008 at 01:52:28PM +0100, Cornelia Huck wrote:

My wrong, it is the problem, thanks.


This one should fix the bug, Gabor, could you test? 
---
The rfcomm tty device will possibly retain even when conn is down,
and sysfs doesn't support zombie device moving, so this patch
move the tty device before conn device is destroyed.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com> 

---
 net/bluetooth/hci_sysfs.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff -upr linux/net/bluetooth/hci_sysfs.c linux.new/net/bluetooth/hci_sysfs.c
--- linux/net/bluetooth/hci_sysfs.c	2008-01-15 09:36:47.000000000 +0800
+++ linux.new/net/bluetooth/hci_sysfs.c	2008-01-15 09:44:47.000000000 +0800
@@ -316,9 +316,24 @@ void hci_conn_add_sysfs(struct hci_conn 
 	schedule_work(&conn->work);
 }
 
+static int __match_tty(struct device *dev, void *data)
+{
+	/* The rfcomm tty device will possibly retain even when conn
+	 * is down, and sysfs doesn't support move zombie device,
+	 * so we should move the device before conn device is destroyed.
+	 * Due to the only child device of hci_conn dev is rfcomm
+	 * tty_dev, here just return 1
+	 */
+	return 1;
+}
+
 static void del_conn(struct work_struct *work)
 {
+	struct device *dev;
 	struct hci_conn *conn = container_of(work, struct hci_conn, work);
+
+	while (dev = device_find_child(&conn->dev, NULL, __match_tty))
+		device_move(dev, NULL);
 	device_del(&conn->dev);
 	put_device(&conn->dev);
 }
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Oops involving RFCOMM and sysfs, Gabor Gombas, (Fri Dec 28, 10:32 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Sat Dec 29, 1:07 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Wed Jan 2, 7:48 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Wed Jan 2, 8:16 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Thu Jan 3, 6:16 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Thu Jan 3, 6:05 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Sat Jan 5, 7:30 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Sat Jan 5, 7:07 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Sat Jan 5, 7:54 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Sat Jan 5, 8:54 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Sun Jan 6, 7:37 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Mon Jan 7, 1:07 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Eric W. Biederman, (Mon Jan 7, 1:21 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Mon Jan 7, 2:17 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Mon Jan 7, 2:18 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Eric W. Biederman, (Mon Jan 7, 3:33 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Mon Jan 7, 7:10 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Mon Jan 7, 7:13 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Mon Jan 7, 8:24 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Mon Jan 7, 2:00 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Tue Jan 8, 2:42 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Tue Jan 8, 6:32 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Tejun Heo, (Wed Jan 9, 2:16 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Cornelia Huck, (Wed Jan 9, 8:57 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Wed Jan 9, 6:11 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Thu Jan 10, 3:15 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Fri Jan 11, 4:09 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Mon Jan 14, 12:05 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Mon Jan 14, 6:57 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Gabor Gombas, (Wed Jan 16, 4:06 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Thu Jan 17, 12:24 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Cornelia Huck, (Thu Jan 17, 4:42 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Thu Jan 17, 8:37 pm)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Cornelia Huck, (Fri Jan 18, 2:19 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Cornelia Huck, (Fri Jan 18, 3:23 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Fri Jan 18, 3:34 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Cornelia Huck, (Fri Jan 18, 4:26 am)
Re: [Bluez-devel] Oops involving RFCOMM and sysfs, Dave Young, (Sun Jan 20, 8:15 pm)