lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 7 Jun 2011 17:35:27 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Wu Fengguang <fengguang.wu@...el.com>
Cc:	Jan Kara <jack@...e.cz>, Christoph Hellwig <hch@....de>,
	Hugh Dickins <hughd@...gle.com>,
	Dave Chinner <david@...morbit.com>,
	Christoph Hellwig <hch@...radead.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/15] writeback: split inode_wb_list_lock into
 bdi_writeback.list_lock

On Wed, 8 Jun 2011 08:20:57 +0800
Wu Fengguang <fengguang.wu@...el.com> wrote:

> On Wed, Jun 08, 2011 at 07:03:19AM +0800, Andrew Morton wrote:
> > On Wed, 08 Jun 2011 05:32:43 +0800
> > Wu Fengguang <fengguang.wu@...el.com> wrote:
> > 
> > >  static void bdev_inode_switch_bdi(struct inode *inode,
> > >  			struct backing_dev_info *dst)
> > >  {
> > > -	spin_lock(&inode_wb_list_lock);
> > > +	struct backing_dev_info *old = inode->i_data.backing_dev_info;
> > > +
> > > +	if (unlikely(dst == old))		/* deadlock avoidance */
> > > +		return;
> > 
> > Why does this occur?
> 
> That's a fix from Hugh Dickins:

yes, I remember it.  And I remember rubberiness about this at the time ;)

>         Yesterday's mmotm hangs at startup, and with lockdep it reports:
>         BUG: spinlock recursion on CPU#1, blkid/284 - with bdi_lock_two()
>         called from bdev_inode_switch_bdi() in the backtrace.  It appears
>         that this function is sometimes called with new the same as old.
> 
> The problem becomes clear when looking at bdi_lock_two(), which will
> immediately deadlock itself if called with (wb1 == wb2):
> 
>   void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2)
>   {
>           if (wb1 < wb2) {
>                   spin_lock(&wb1->list_lock);                                                                         
>                   spin_lock_nested(&wb2->list_lock, 1);
>           } else {
>                   spin_lock(&wb2->list_lock);
>                   spin_lock_nested(&wb1->list_lock, 1);
>           }
>   }

But why are we asking bdev_inode_switch_bdi() to switch an inode to a
bdi where it already resides?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ