Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964828AbWI2MMb (ORCPT ); Fri, 29 Sep 2006 08:12:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964818AbWI2MMb (ORCPT ); Fri, 29 Sep 2006 08:12:31 -0400 Received: from amsfep17-int.chello.nl ([213.46.243.15]:55665 "EHLO amsfep13-int.chello.nl") by vger.kernel.org with ESMTP id S932077AbWI2MMa (ORCPT ); Fri, 29 Sep 2006 08:12:30 -0400 Subject: md deadlock (was Re: 2.6.18-mm2) From: Peter Zijlstra To: Michal Piotrowski Cc: Andrew Morton , Ingo Molnar , Neil Brown , linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <6bffcb0e0609280454n34d40c0la8786e1eba6dcdf3@mail.gmail.com> References: <20060928014623.ccc9b885.akpm@osdl.org> <6bffcb0e0609280454n34d40c0la8786e1eba6dcdf3@mail.gmail.com> Content-Type: text/plain Date: Fri, 29 Sep 2006 14:12:03 +0200 Message-Id: <1159531923.28131.80.camel@taijtu> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5906 Lines: 159 On Thu, 2006-09-28 at 13:54 +0200, Michal Piotrowski wrote: > Hi, > > On 28/09/06, Andrew Morton wrote: > > > > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.18/2.6.18-mm2/ > > > > > > ======================================================= > [ INFO: possible circular locking dependency detected ] > 2.6.18-mm2 #1 > ------------------------------------------------------- > nash/1264 is trying to acquire lock: > (&bdev_part_lock_key){--..}, at: [] mutex_lock+0x1c/0x1f > > but task is already holding lock: > (&new->reconfig_mutex){--..}, at: [] > mutex_lock_interruptible+0x1c/0x1f > > which lock already depends on the new lock. > > > the existing dependency chain (in reverse order) is: > > -> #2 (&new->reconfig_mutex){--..}: > [] add_lock_to_list+0x5c/0x7a > [] __lock_acquire+0x9f3/0xaef > [] lock_acquire+0x71/0x91 > [] __mutex_lock_interruptible_slowpath+0xd2/0x326 > [] mutex_lock_interruptible+0x1c/0x1f > [] md_open+0x28/0x5d -> mddev->reconfig_mutex > [] do_open+0x8b/0x377 -> bdev->bd_mutex (whole) > [] blkdev_open+0x1d/0x46 > [] __dentry_open+0x133/0x260 > [] nameidata_to_filp+0x1c/0x2e > [] do_filp_open+0x2e/0x35 > [] do_sys_open+0x58/0xde > [] sys_open+0x16/0x18 > [] syscall_call+0x7/0xb > [] 0xffffffff > > -> #1 (&bdev->bd_mutex){--..}: > [] add_lock_to_list+0x5c/0x7a > [] __lock_acquire+0x9f3/0xaef > [] lock_acquire+0x71/0x91 > [] __mutex_lock_slowpath+0xd2/0x2f1 > [] mutex_lock+0x1c/0x1f > [] do_open+0x5c/0x377 > [] blkdev_get+0x6c/0x77 > [] do_open+0x108/0x377 > [] blkdev_get+0x6c/0x77 > [] open_by_devnum+0x30/0x3c > [] swsusp_check+0x14/0xc5 > [] software_resume+0x7e/0x100 > [] init+0x121/0x29f > [] kernel_thread_helper+0x7/0x10 > [] save_stack_trace+0x17/0x30 > [] save_trace+0x4f/0xfb > [] add_lock_to_list+0x5c/0x7a > [] __lock_acquire+0x9f3/0xaef > [] lock_acquire+0x71/0x91 > [] __mutex_lock_slowpath+0xd2/0x2f1 > [] mutex_lock+0x1c/0x1f > [] do_open+0x5c/0x377 -> bdev->bd_mutex (whole) > [] blkdev_get+0x6c/0x77 > [] do_open+0x108/0x377 -> bdev->bd_mutex (partition) > [] blkdev_get+0x6c/0x77 > [] open_by_devnum+0x30/0x3c > [] swsusp_check+0x14/0xc5 > [] software_resume+0x7e/0x100 > [] init+0x121/0x29f > [] kernel_thread_helper+0x7/0x10 > [] 0xffffffff > > -> #0 (&bdev_part_lock_key){--..}: > [] print_circular_bug_tail+0x30/0x64 > [] __lock_acquire+0x92a/0xaef > [] lock_acquire+0x71/0x91 > [] __mutex_lock_slowpath+0xd2/0x2f1 > [] mutex_lock+0x1c/0x1f > [] bd_claim_by_disk+0x5f/0x18e -> bdev->bd_mutex (partition) > [] bind_rdev_to_array+0x1f0/0x20e > [] autostart_arrays+0x24b/0x322 > [] md_ioctl+0x91/0x13f4 > [] blkdev_driver_ioctl+0x49/0x5b > [] blkdev_ioctl+0x755/0x7a2 > [] block_ioctl+0x16/0x1b > [] do_ioctl+0x22/0x67 > [] vfs_ioctl+0x249/0x25c > [] sys_ioctl+0x47/0x75 > [] syscall_call+0x7/0xb > [] 0xffffffff > > other info that might help us debug this: > > 1 lock held by nash/1264: > #0: (&new->reconfig_mutex){--..}, at: [] > mutex_lock_interruptible+0x1c/0x1f > stack backtrace: > [] dump_trace+0x64/0x1cd > [] show_trace_log_lvl+0x12/0x25 > [] show_trace+0xd/0x10 > [] dump_stack+0x19/0x1b > [] print_circular_bug_tail+0x59/0x64 > [] __lock_acquire+0x92a/0xaef > [] lock_acquire+0x71/0x91 > [] __mutex_lock_slowpath+0xd2/0x2f1 > [] mutex_lock+0x1c/0x1f > [] bd_claim_by_disk+0x5f/0x18e -> bdev->bd_mutex (part) > [] bind_rdev_to_array+0x1f0/0x20e autorun_devices -> mddev->reconfig_mutex > [] autostart_arrays+0x24b/0x322 > [] md_ioctl+0x91/0x13f4 > [] blkdev_driver_ioctl+0x49/0x5b > [] blkdev_ioctl+0x755/0x7a2 > [] block_ioctl+0x16/0x1b > [] do_ioctl+0x22/0x67 > [] vfs_ioctl+0x249/0x25c > [] sys_ioctl+0x47/0x75 > [] syscall_call+0x7/0xb > DWARF2 unwinder stuck at syscall_call+0x7/0xb > > Leftover inexact backtrace: Looks like a real deadlock here. It seems to me #2 is the easiest to break. static int md_open(struct inode *inode, struct file *file) { /* * Succeed if we can lock the mddev, which confirms that * it isn't being stopped right now. */ mddev_t *mddev = inode->i_bdev->bd_disk->private_data; int err; if ((err = mddev_lock(mddev))) goto out; err = 0; mddev_get(mddev); mddev_unlock(mddev); check_disk_change(inode->i_bdev); out: return err; } mddev_get() is a simple atomic_inc(), and I fail to see how waiting for the lock makes any difference. - 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/