bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/13] trans: return nodes locked when creating fake nodes in


From: Justus Winter
Subject: Re: [PATCH 07/13] trans: return nodes locked when creating fake nodes in fakeroot
Date: Tue, 10 Dec 2013 10:20:45 +0100
User-agent: alot/0.3.4

Quoting Samuel Thibault (2013-12-10 01:08:21)
> Justus Winter, le Mon 09 Dec 2013 15:16:35 +0100, a écrit :
> > +     {
> > +       pthread_mutex_lock (&(*np)->lock);
> > +       netfs_nref (*np);     /* Return a reference to the caller.  */
> > +     }
> >        pthread_mutex_unlock (&idport_ihash_lock);
> 
> Did you check the lock ordering between these two?

Yes. Previously, new_node added an unlocked node to the hash table and
unlocked the idport_ihash_lock.

The use of locks in fakeroot is partially ordered:

* If you need to pick up the idport_ihash_lock, you need to pick it
  up first.

* If you need two nodes locked, lock the parent node first.

This patch was meant to ensure this for newly created nodes, the
follow up patch takes advantage of this to fix the locking in
netfs_S_dir_lookup.

Justus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]