Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754048AbYCIREl (ORCPT ); Sun, 9 Mar 2008 13:04:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751708AbYCIREc (ORCPT ); Sun, 9 Mar 2008 13:04:32 -0400 Received: from marge.padd.com ([66.127.62.138]:59025 "EHLO marge.padd.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751371AbYCIREc (ORCPT ); Sun, 9 Mar 2008 13:04:32 -0400 X-Greylist: delayed 629 seconds by postgrey-1.27 at vger.kernel.org; Sun, 09 Mar 2008 13:04:32 EDT Date: Sun, 9 Mar 2008 12:55:17 -0400 From: Pete Wyckoff To: FUJITA Tomonori Cc: Mike Christie , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BUG 3/3] bsg mutex hang with iscsi logout Message-ID: <20080309165517.GC24388@osc.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080309165359.GA24388@osc.edu> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3631 Lines: 77 Here's an interesting hang. Mount a target with iscsi, again one that may be slow in responding. Send it a command via bsg. Kill the target or unplug the network before the response returns. At this point the kernel notices and iscsid goes about trying to reconnect. Hit ctrl-c to try to kill the bsg-using application. Being the last user of the device, it hangs during file close waiting for the outstanding command to complete (even in error), sleeping with bsg_mutex held. sgio D ffff81007c567bc8 0 2916 2846 ffff81007c567b98 0000000000000046 ffff81007c567b78 ffff810040e16cc8 ffff81007f721080 ffff81007f71f830 ffff81007f721298 ffffffff80263514 ffff81007c567b98 0000000000000282 ffff81007c567c28 ffffffff80267238 Call Trace: [] ? __pagevec_free+0x24/0x30 [] ? release_pages+0x198/0x1e0 [] io_schedule+0x28/0x40 [] bsg_release+0x1c0/0x1e0 [] ? autoremove_wake_function+0x0/0x40 [] __fput+0xb3/0x1a0 [] fput+0x16/0x20 [] filp_close+0x4b/0x80 [] put_files_struct+0xc1/0xd0 [] __exit_files+0x45/0x50 [] do_exit+0x1a2/0x7a0 [] do_group_exit+0x37/0xa0 [] get_signal_to_deliver+0x268/0x330 [] ? sysret_signal+0x1c/0x27 [] do_notify_resume+0xd4/0x950 [] ? finish_wait+0x60/0x80 [] ? bsg_get_done_cmd+0x11a/0x140 [] ? bsg_read+0xda/0x180 [] ? vfs_read+0xc4/0x150 [] ? sysret_signal+0x1c/0x27 [] ptregscall_common+0x67/0xb0 Meanwhile, in another shell, use iscsiadm to logout from the target. As scsi removes the device, it tells bsg to unregister the queue that is going away, and to do that, it needs the bsg_mutex. You have to be fairly quick about it to get into this situation. iscsi_scan_4 D ffffffff804ff688 0 2873 2 ffff81007c421cd0 0000000000000046 000001a800000002 fffffffffffffffc ffff81007c1690c0 ffff81007e4c8830 ffff81007c1692d8 0000000000015d6d 0000015400000002 fffffffffffffffc 0000000000015e4c 0000016400000002 Call Trace: [] __mutex_lock_slowpath+0x7f/0xd0 [] mutex_lock+0xe/0x10 [] bsg_unregister_queue+0x31/0xa0 [] __scsi_remove_device+0x40/0xa0 [] scsi_remove_device+0x2b/0x40 [] __scsi_remove_target+0x9c/0xe0 [] ? __remove_child+0x0/0x30 [] __remove_child+0x1e/0x30 [] device_for_each_child+0x33/0x60 [] ? kobject_get+0x1a/0x30 [] scsi_remove_target+0x4e/0x60 [] :scsi_transport_iscsi:__iscsi_unbind_session+0x85/0xa0 [] ? :scsi_transport_iscsi:__iscsi_unbind_session+0x0/0xa0 [] run_workqueue+0x84/0x110 [] worker_thread+0x93/0xd0 [] ? autoremove_wake_function+0x0/0x40 [] ? worker_thread+0x0/0xd0 [] kthread+0x4d/0x80 [] child_rip+0xa/0x12 [] ? kthread+0x0/0x80 [] ? child_rip+0x0/0x12 Same setup as the bug 1/3. -- Pete -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/