Re: 2.6.17-rc5-mm3-lockdep - locking error in quotaon

From: Jan Kara
Date: Mon Jun 05 2006 - 15:33:19 EST


> On Mon, 05 Jun 2006 19:25:39 +0200, Arjan van de Ven said:
>
> > The quota code nests 3 mutexes but releases them in a totally different
> > order; mark this as such in the code.
>
> > ===================================================================
> > --- linux-2.6.17-rc5-mm3.orig/fs/dquot.c
> > +++ linux-2.6.17-rc5-mm3/fs/dquot.c
> > @@ -1475,7 +1475,7 @@ static int vfs_quota_on_inode(struct ino
> > goto out_file_init;
> > }
> > mutex_unlock(&dqopt->dqio_mutex);
> > - mutex_unlock(&inode->i_mutex);
> > + mutex_unlock_non_nested(&inode->i_mutex);
> > set_enable_flags(dqopt, type);
> >
> > add_dquot_ref(sb, type);
>
> Obviously, there be bigger and nastier dragons lurking in the quota code.
>
> This one made it past quotaon, but not as far as the swapon command in the
> Fedora /etc/rc.sysinit. There's a bunch of rm all over the place in that
> section of the script, and I'm not sure at all which one triggered it.
I have not analyzed the backtraces to much in detail but I guess the
following confuses the code (and I agree that it's kind of ugly from
quota code to do that):
i_mutex of inode containing quota file is acquired after all other
quota locks. i_mutex of all other inodes is acquired before quota locks.
Quota code makes sure (by resetting inode operations and setting special
flag on inode) that noone tries to enter quota code while holding
i_mutex on a quota file...
Anyways it's nice checker that it caches this kind of things ;) None
of the previous ones did.

Honza
-
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/