lkml.org 
[lkml]   [2006]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to explain to lock validator: locking inodes in inode order
On 7/17/06, Arjan van de Ven <arjan@infradead.org> wrote:
> On Mon, 2006-07-17 at 19:24 -0700, Joshua Hudson wrote:
> > Code does this:
> >
> > /* Lock two items. See locking.txt */
> > static inline void kb0_lock2m(struct kb0_idata *m1, struct kb0_idata *m2)
> > {
> > if (m1->vi.i_ino > m2->vi.i_ino)
> > mutex_lock(&m2->k_mutex);
> > mutex_lock(&m1->k_mutex);
> > if (m1->vi.i_ino < m2->vi.i_ino)
> > mutex_lock(&m2->k_mutex);
> > }
> >
> > Not sure how to explain to the lock validator that this code can never deadlock.
>
> you're sure it can;t?
Yes. It never takes a lock on any higher inode without holding the lock on a
lower inode first. I have a full proof across the VFS+FS [see below].

>
> all places in the kernel that take this mutex in that order only do it
> in i_ino order, including all directory operations like cross directory
> rename?

I had to disable the kernel's locking of multiple objects in namei.c using a
new FS_ flag because it would actually deadlock for this filesystem.

> (which fs is this btw?)
Custom filesystem (kb0), not in any tree but mine. I am in progress
with syncing it up
to the latest kernel.

If anybody really wants it, it is 70-odd K of bzip2-compressed code of
filesystem + utilities. It's not ready for non-acedemic use though.
-
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/

\
 
 \ /
  Last update: 2006-07-18 06:23    [W:0.102 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site