Re: dio_get_page() lockdep complaints

From: Chris Mason
Date: Thu Apr 19 2007 - 10:39:13 EST


On Thu, Apr 19, 2007 at 01:01:42AM -0700, Andrew Morton wrote:
> On Thu, 19 Apr 2007 09:38:30 +0200 Jens Axboe <jens.axboe@xxxxxxxxxx> wrote:
>
> > Hi,
> >
> > Doing some testing on CFQ, I ran into this 100% reproducible report:
> >
> > =======================================================
> > [ INFO: possible circular locking dependency detected ]
> > 2.6.21-rc7 #5
> > -------------------------------------------------------
> > fio/9741 is trying to acquire lock:
> > (&mm->mmap_sem){----}, at: [<b018cb34>] dio_get_page+0x54/0x161
> >
> > but task is already holding lock:
> > (&inode->i_mutex){--..}, at: [<b038c6e5>] mutex_lock+0x1c/0x1f
> >
> > which lock already depends on the new lock.
> >
>
> This is the correct ranking: i_mutex outside mmap_sem.

[ ... ]

> But here reiserfs is taking i_mutex in its file_operations.release(), which
> can be called under mmap_sem.
>
> Vladimir's recent de14569f94513279e3d44d9571a421e9da1759ae. "resierfs:
> avoid tail packing if an inode was ever mmapped" comes real close to this
> code, but afaict it did not cause this bug.
>
> I can't think of anything which we've done in the 2.6.21 cycle which would have
> caused this to start happening. Odd.

In this case, reiserfs is taking i_mutex to safely discard the
preallocation blocks. The best solution would probably be to just put
in a preallocation mutex other than i_sem (even i_mmap would probably
work).

This shouldn't be a new regression, the file_release prelloc stuff
hasn't changed in ages.

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