[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
- [PATCH 01/13] libfshelp: use a hash table in get-identity.c, (continued)
- [PATCH 01/13] libfshelp: use a hash table in get-identity.c, Justus Winter, 2013/12/09
- [PATCH 03/13] trans: fix the use of the hash table in fakeroot.c, Justus Winter, 2013/12/09
- [PATCH 04/13] trans: improve the performance of dir_lookup in fakeroot, Justus Winter, 2013/12/09
- [PATCH 06/13] trans: fix locking issue in fakeroot, Justus Winter, 2013/12/09
- [PATCH 07/13] trans: return nodes locked when creating fake nodes in fakeroot, Justus Winter, 2013/12/09
- [PATCH 08/13] trans: fix reference counting and destruction of fake nodes, Justus Winter, 2013/12/09
- [PATCH 11/13] trans: improve the error handling in fakeauth, Justus Winter, 2013/12/09
- [PATCH 09/13] trans: fix locking in fakeroot's netfs_S_dir_lookup, Justus Winter, 2013/12/09
- [PATCH 12/13] trans: unlock nodes with faked attributes in fakeroot, Justus Winter, 2013/12/09
- [PATCH 05/13] trans: handle invalid responses to dir_lookup requests in fakeroot, Justus Winter, 2013/12/09