public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	Neil Brown <neilb@cse.unsw.edu.au>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: md deadlock (was Re: 2.6.18-mm2)
Date: Fri, 29 Sep 2006 14:12:03 +0200	[thread overview]
Message-ID: <1159531923.28131.80.camel@taijtu> (raw)
In-Reply-To: <6bffcb0e0609280454n34d40c0la8786e1eba6dcdf3@mail.gmail.com>

On Thu, 2006-09-28 at 13:54 +0200, Michal Piotrowski wrote:
> Hi,
> 
> On 28/09/06, Andrew Morton <akpm@osdl.org> 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: [<c0310d4a>] mutex_lock+0x1c/0x1f
> 
> but task is already holding lock:
>  (&new->reconfig_mutex){--..}, at: [<c03108ff>]
> 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){--..}:
>        [<c01390b8>] add_lock_to_list+0x5c/0x7a
>        [<c013b1dd>] __lock_acquire+0x9f3/0xaef
>        [<c013b643>] lock_acquire+0x71/0x91
>        [<c031068f>] __mutex_lock_interruptible_slowpath+0xd2/0x326
>        [<c03108ff>] mutex_lock_interruptible+0x1c/0x1f
>        [<c02ba4e3>] md_open+0x28/0x5d			-> mddev->reconfig_mutex
>        [<c0197853>] do_open+0x8b/0x377			-> bdev->bd_mutex (whole)
>        [<c0197cd5>] blkdev_open+0x1d/0x46
>        [<c0172f36>] __dentry_open+0x133/0x260
>        [<c01730d1>] nameidata_to_filp+0x1c/0x2e
>        [<c0173111>] do_filp_open+0x2e/0x35
>        [<c0173170>] do_sys_open+0x58/0xde
>        [<c0173222>] sys_open+0x16/0x18
>        [<c0103297>] syscall_call+0x7/0xb
>        [<ffffffff>] 0xffffffff
> 
> -> #1 (&bdev->bd_mutex){--..}:
>        [<c01390b8>] add_lock_to_list+0x5c/0x7a
>        [<c013b1dd>] __lock_acquire+0x9f3/0xaef
>        [<c013b643>] lock_acquire+0x71/0x91
>        [<c0310b0f>] __mutex_lock_slowpath+0xd2/0x2f1
>        [<c0310d4a>] mutex_lock+0x1c/0x1f
>        [<c0197824>] do_open+0x5c/0x377
>        [<c0197bab>] blkdev_get+0x6c/0x77
>        [<c01978d0>] do_open+0x108/0x377
>        [<c0197bab>] blkdev_get+0x6c/0x77
>        [<c0197eb1>] open_by_devnum+0x30/0x3c
>        [<c0147419>] swsusp_check+0x14/0xc5
>        [<c0145865>] software_resume+0x7e/0x100
>        [<c010049e>] init+0x121/0x29f
>        [<c0103f23>] kernel_thread_helper+0x7/0x10
>        [<c0109523>] save_stack_trace+0x17/0x30
>        [<c0138fb0>] save_trace+0x4f/0xfb
>        [<c01390b8>] add_lock_to_list+0x5c/0x7a
>        [<c013b1dd>] __lock_acquire+0x9f3/0xaef
>        [<c013b643>] lock_acquire+0x71/0x91
>        [<c0310b0f>] __mutex_lock_slowpath+0xd2/0x2f1
>        [<c0310d4a>] mutex_lock+0x1c/0x1f
>        [<c0197824>] do_open+0x5c/0x377			-> bdev->bd_mutex (whole)
>        [<c0197bab>] blkdev_get+0x6c/0x77
>        [<c01978d0>] do_open+0x108/0x377			-> bdev->bd_mutex (partition)
>        [<c0197bab>] blkdev_get+0x6c/0x77
>        [<c0197eb1>] open_by_devnum+0x30/0x3c
>        [<c0147419>] swsusp_check+0x14/0xc5
>        [<c0145865>] software_resume+0x7e/0x100
>        [<c010049e>] init+0x121/0x29f
>        [<c0103f23>] kernel_thread_helper+0x7/0x10
>        [<ffffffff>] 0xffffffff
> 
> -> #0 (&bdev_part_lock_key){--..}:
>        [<c013a7b6>] print_circular_bug_tail+0x30/0x64
>        [<c013b114>] __lock_acquire+0x92a/0xaef
>        [<c013b643>] lock_acquire+0x71/0x91
>        [<c0310b0f>] __mutex_lock_slowpath+0xd2/0x2f1
>        [<c0310d4a>] mutex_lock+0x1c/0x1f
>        [<c0197323>] bd_claim_by_disk+0x5f/0x18e		-> bdev->bd_mutex (partition)
>        [<c02b44ec>] bind_rdev_to_array+0x1f0/0x20e
>        [<c02b6453>] autostart_arrays+0x24b/0x322
>        [<c02b9158>] md_ioctl+0x91/0x13f4
>        [<c01ea5bc>] blkdev_driver_ioctl+0x49/0x5b
>        [<c01ead23>] blkdev_ioctl+0x755/0x7a2
>        [<c0196f9d>] block_ioctl+0x16/0x1b
>        [<c01801d2>] do_ioctl+0x22/0x67
>        [<c0180460>] vfs_ioctl+0x249/0x25c
>        [<c01804ba>] sys_ioctl+0x47/0x75
>        [<c0103297>] syscall_call+0x7/0xb
>        [<ffffffff>] 0xffffffff
> 
> other info that might help us debug this:
> 
> 1 lock held by nash/1264:
>  #0:  (&new->reconfig_mutex){--..}, at: [<c03108ff>]
> mutex_lock_interruptible+0x1c/0x1f
> stack backtrace:
>  [<c0104215>] dump_trace+0x64/0x1cd
>  [<c0104390>] show_trace_log_lvl+0x12/0x25
>  [<c01049e5>] show_trace+0xd/0x10
>  [<c0104aad>] dump_stack+0x19/0x1b
>  [<c013a7df>] print_circular_bug_tail+0x59/0x64
>  [<c013b114>] __lock_acquire+0x92a/0xaef
>  [<c013b643>] lock_acquire+0x71/0x91
>  [<c0310b0f>] __mutex_lock_slowpath+0xd2/0x2f1
>  [<c0310d4a>] mutex_lock+0x1c/0x1f
>  [<c0197323>] bd_claim_by_disk+0x5f/0x18e		-> bdev->bd_mutex (part)
>  [<c02b44ec>] bind_rdev_to_array+0x1f0/0x20e
                autorun_devices				-> mddev->reconfig_mutex
>  [<c02b6453>] autostart_arrays+0x24b/0x322
>  [<c02b9158>] md_ioctl+0x91/0x13f4
>  [<c01ea5bc>] blkdev_driver_ioctl+0x49/0x5b
>  [<c01ead23>] blkdev_ioctl+0x755/0x7a2
>  [<c0196f9d>] block_ioctl+0x16/0x1b
>  [<c01801d2>] do_ioctl+0x22/0x67
>  [<c0180460>] vfs_ioctl+0x249/0x25c
>  [<c01804ba>] sys_ioctl+0x47/0x75
>  [<c0103297>] 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.




  reply	other threads:[~2006-09-29 12:12 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-28  8:46 2.6.18-mm2 Andrew Morton
2006-09-28 11:54 ` 2.6.18-mm2 Michal Piotrowski
2006-09-29 12:12   ` Peter Zijlstra [this message]
2006-09-29 12:52     ` md deadlock (was Re: 2.6.18-mm2) Neil Brown
2006-09-29 14:03       ` Peter Zijlstra
2006-10-02 13:47         ` Peter Zijlstra
2006-10-10  3:53           ` Neil Brown
2006-10-10  6:42             ` Ingo Molnar
2006-09-28 17:50 ` 2.6.18-mm2 Steve Fox
2006-09-28 19:00   ` 2.6.18-mm2 thunder7
2006-09-28 21:01   ` 2.6.18-mm2 Andrew Morton
2006-09-28 22:45     ` 2.6.18-mm2 Stephen Hemminger
2006-10-04 13:42     ` 2.6.18-mm2 boot failure on x86-64 Steve Fox
2006-10-04 15:45       ` Andrew Morton
2006-10-04 15:55         ` Vivek Goyal
2006-10-04 15:56         ` Andi Kleen
2006-10-05  1:57           ` Keith Mannthey
2006-10-04 16:41         ` Steve Fox
2006-10-05  0:06           ` Andrew Morton
2006-10-05  0:51             ` Vivek Goyal
2006-10-05  0:57               ` Andi Kleen
2006-10-05  1:08                 ` Martin Bligh
2006-10-05  2:05                   ` Keith Mannthey
2006-10-05 14:53                   ` Steve Fox
2006-10-05 15:12                     ` Badari Pulavarty
2006-10-05 15:32                       ` Steve Fox
2006-10-05 15:40                         ` Andi Kleen
2006-10-05 17:57                           ` Steve Fox
2006-10-05 18:27                             ` Andi Kleen
2006-10-05 18:51                               ` Steve Fox
2006-10-05 19:05                                 ` Andi Kleen
2006-10-05 20:42                                   ` Steve Fox
2006-10-05 20:50                                     ` Andi Kleen
2006-10-06  2:23                                       ` Steve Fox
2006-10-06 14:33                                         ` Mel Gorman
2006-10-06 15:36                                           ` Vivek Goyal
2006-10-06 17:11                                             ` Mel Gorman
2006-10-06 17:34                                               ` Vivek Goyal
2006-10-06 17:59                                               ` Vivek Goyal
2006-10-06 18:03                                               ` Steve Fox
2006-10-06 20:04                                                 ` Vivek Goyal
2006-10-09  9:53                                                   ` Mel Gorman
2006-10-16 18:16                                                     ` Vivek Goyal
2006-10-16 23:58                                                       ` Andrew Morton
2006-10-17 12:18                                                         ` Adrian Bunk
2006-10-17 17:32                                                           ` Mel Gorman
2006-10-05 18:52                               ` Vivek Goyal
2006-10-05 19:08                                 ` Andi Kleen
2006-10-05 20:25                                   ` Steve Fox
2006-10-05 20:39                                   ` Mel Gorman
2006-10-05 20:51                                     ` Andi Kleen
2006-10-05 23:14                                       ` 2.6.18-mm2 boot failure on x86-64 II Andi Kleen
2006-10-05 23:32                                         ` keith mannthey
2006-10-05 23:35                                           ` Andi Kleen
2006-10-05 23:58                                             ` keith mannthey
2006-10-06  0:02                                               ` Badari Pulavarty
2006-10-06  0:12                                                 ` Andrew Morton
2006-09-28 22:39 ` 2.6.18-mm2 Jim Cromie
2006-09-28 23:08   ` 2.6.18-mm2 Andi Kleen
2006-09-29 20:14     ` 2.6.18-mm2 Ingo Molnar
2006-09-29 20:36       ` 2.6.18-mm2 Andi Kleen
2006-09-29 20:32         ` 2.6.18-mm2 Ingo Molnar
2006-09-29 20:58           ` 2.6.18-mm2 Andi Kleen
2006-09-29 21:14             ` [patch] fix !apic build breakage Ingo Molnar
2006-09-29 21:44               ` Andi Kleen
2006-09-29 21:41                 ` Ingo Molnar
2006-09-29 21:44             ` 2.6.18-mm2 Alan Cox
2006-09-29 21:36         ` 2.6.18-mm2 Dave Jones
2006-09-29 21:46           ` 2.6.18-mm2 Andi Kleen
2006-09-28 22:44 ` 2.6.18-mm2 Matthias Hentges
2006-09-29  3:19 ` 2.6.18-mm2 - oops in cache_alloc_refill() Valdis.Kletnieks
2006-09-29  3:29   ` Andrew Morton
2006-09-29  3:58     ` Valdis.Kletnieks
2006-09-29 15:19     ` Valdis.Kletnieks
2006-09-29 19:45       ` Andrew Morton
2006-09-30  0:01         ` Valdis.Kletnieks
2006-09-30  1:20           ` Andrew Morton
2006-09-30  1:33             ` Jean Tourrilhes
2006-09-30  3:31               ` Valdis.Kletnieks
2006-09-30  7:50                 ` Valdis.Kletnieks
2006-09-30  8:33                   ` Andrew Morton
2006-09-30  1:40             ` Jean Tourrilhes
2006-09-30  3:31               ` Valdis.Kletnieks
2006-09-30  1:57             ` Makefile for linux modules x z
2006-09-30  8:55               ` Sam Ravnborg
2006-09-30  1:59             ` x z
2006-10-02 17:52             ` 2.6.18-mm2 - oops in cache_alloc_refill() Jean Tourrilhes
2006-10-02 19:57               ` Valdis.Kletnieks
2006-10-03 15:58               ` Samuel Tardieu
2006-10-03 16:34                 ` Jean Tourrilhes
2006-10-03 16:45                   ` Samuel Tardieu
2006-10-03 17:07                     ` Jean Tourrilhes
2006-10-05 22:37                   ` Pavel Roskin
2006-10-05 22:42                     ` Jean Tourrilhes
2006-09-29 19:47       ` Christoph Lameter
2006-09-29 13:57 ` 2.6.18-mm2 J.A. Magallón
2006-09-29 14:39   ` 2.6.18-mm2 Matthew Wilcox
2006-09-29 17:15     ` 2.6.18-mm2 Alan Cox
2006-09-29 23:50       ` 2.6.18-mm2 Frederik Deweerdt
2006-09-29 23:43         ` 2.6.18-mm2 Alan Cox
2006-09-30 14:09           ` [-mm patch] aic7xxx: check irq validity (was Re: 2.6.18-mm2) Frederik Deweerdt
2006-09-30 14:19             ` Alan Cox
2006-09-30 13:51               ` Willy Tarreau
2006-09-30 23:58             ` Jeff Garzik
2006-10-01 14:28               ` Matthew Wilcox
2006-10-01 19:05                 ` Arjan van de Ven
2006-10-01 19:19                   ` Jeff Garzik
2006-10-01 19:34                     ` Arjan van de Ven
2006-10-01 19:36                   ` Matthew Wilcox
2006-10-01 19:42                     ` Jeff Garzik
2006-10-02  2:12                     ` Arjan van de Ven
2006-10-02 20:00                       ` [RFC PATCH] pci_request_irq (was [-mm patch] aic7xxx: check irq validity) Frederik Deweerdt
2006-10-02 18:15                         ` Matthew Wilcox
2006-10-02 21:09                           ` Frederik Deweerdt
2006-10-02 20:07                         ` [RFC PATCH] move aic7xxx to pci_request_irq Frederik Deweerdt
2006-10-02 18:27                           ` Matthew Wilcox
2006-10-02 21:02                             ` Frederik Deweerdt
2006-10-03  3:45                           ` Arjan van de Ven
2006-10-02 20:11                         ` [RFC PATCH] move tg3 " Frederik Deweerdt
2006-10-02 18:28                           ` Matthew Wilcox
2006-10-02 21:04                             ` Frederik Deweerdt
2006-10-03  7:18                           ` Arjan van de Ven
2006-10-02 20:12                         ` [RFC PATCH] move drm " Frederik Deweerdt
2006-10-02 18:37                           ` Matthew Wilcox
2006-10-02 21:07                             ` Frederik Deweerdt
2006-10-02 20:36                           ` Alan Cox
2006-10-02 22:26                             ` Frederik Deweerdt
2006-10-02 23:54                           ` Dave Airlie
2006-10-03  7:17                             ` Frederik Deweerdt
2006-10-03  3:58                         ` [RFC PATCH] pci_request_irq (was [-mm patch] aic7xxx: check irq validity) Randy Dunlap
2006-10-01 21:31               ` [-mm patch] aic7xxx: check irq validity (was Re: 2.6.18-mm2) Frederik Deweerdt
2006-09-30 15:26         ` 2.6.18-mm2 James Bottomley
2006-09-30 16:21           ` 2.6.18-mm2 Matthew Wilcox
2006-09-30 17:20             ` 2.6.18-mm2 Mark Rustad
2006-09-30 20:54           ` 2.6.18-mm2 Alan Cox
2006-09-29 23:15     ` 2.6.18-mm2 J.A. Magallón
2006-09-30  7:04 ` 2.6.18-mm2 - possible recursive locking detected Borislav Petkov
2006-09-30  8:28   ` Andrew Morton
2006-09-30 18:19     ` Davide Libenzi
     [not found] ` <20060930133706.GA3291@melchior.yamamaya.is-a-geek.org>
2006-09-30 19:53   ` 2.6.18-mm2 Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1159531923.28131.80.camel@taijtu \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=michal.k.k.piotrowski@gmail.com \
    --cc=mingo@elte.hu \
    --cc=neilb@cse.unsw.edu.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox