[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 65/98: trans: fix the use of the hash table in fakeroot.c
From: |
Samuel Thibault |
Subject: |
[hurd] 65/98: trans: fix the use of the hash table in fakeroot.c |
Date: |
Tue, 14 Jan 2014 02:00:03 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit cf1cc29af12447c347a5574b4dc1568c7db61c0b
Author: Justus Winter <address@hidden>
Date: Thu Dec 5 19:22:03 2013 +0100
trans: fix the use of the hash table in fakeroot.c
Previously a pointer to the node was stored in the hash table. This
writes the locp pointer into the node object overwriting the next
pointer there. Store the pointer to the netnode instead.
* trans/fakeroot.c (struct netnode): Add field np.
(new_node): Initialize field np.
(new_node): Store nn instead of np into the hash table.
(netfs_S_dir_lookup): Adjust accordingly.
---
trans/fakeroot.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 1342844..1ab3216 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -41,6 +41,7 @@ static auth_t fakeroot_auth_port;
struct netnode
{
+ struct node *np; /* our node */
hurd_ihash_locp_t idport_locp;/* easy removal pointer in idport ihash */
mach_port_t idport; /* port from io_identity */
int openmodes; /* O_READ | O_WRITE | O_EXEC */
@@ -93,7 +94,7 @@ new_node (file_t file, mach_port_t idport, int locked, int
openmodes,
return err;
}
}
- *np = netfs_make_node (nn);
+ *np = nn->np = netfs_make_node (nn);
if (*np == 0)
{
if (locked)
@@ -104,7 +105,7 @@ new_node (file_t file, mach_port_t idport, int locked, int
openmodes,
{
if (!locked)
pthread_mutex_lock (&idport_ihash_lock);
- err = hurd_ihash_add (&idport_ihash, nn->idport, *np);
+ err = hurd_ihash_add (&idport_ihash, nn->idport, nn);
if (!err)
netfs_nref (*np); /* Return a reference to the caller. */
pthread_mutex_unlock (&idport_ihash_lock);
@@ -122,6 +123,7 @@ new_node (file_t file, mach_port_t idport, int locked, int
openmodes,
void
netfs_node_norefs (struct node *np)
{
+ assert (np->nn->np == np);
if (np->nn->faked != 0
&& netfs_validate_stat (np, 0) == 0 && np->nn_stat.st_nlink > 0)
{
@@ -295,9 +297,11 @@ netfs_S_dir_lookup (struct protid *diruser,
else
{
pthread_mutex_lock (&idport_ihash_lock);
- np = hurd_ihash_find (&idport_ihash, idport);
- if (np != 0)
+ struct netnode *nn = hurd_ihash_find (&idport_ihash, idport);
+ if (nn != NULL)
{
+ assert (nn->np->nn == nn);
+ np = nn->np;
/* We already know about this node. */
mach_port_deallocate (mach_task_self (), idport);
pthread_mutex_lock (&np->lock);
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 51/98: libtrivfs: improve the trivfs_demuxer function, (continued)
- [hurd] 51/98: libtrivfs: improve the trivfs_demuxer function, Samuel Thibault, 2014/01/13
- [hurd] 24/98: Clean up the included header files, Samuel Thibault, 2014/01/13
- [hurd] 54/98: pfinet: improve the pfinet_demuxer function, Samuel Thibault, 2014/01/13
- [hurd] 52/98: exec: improve the exec_demuxer function, Samuel Thibault, 2014/01/13
- [hurd] 34/98: mach-defpager: drop all register qualifiers, Samuel Thibault, 2014/01/13
- [hurd] 49/98: libdiskfs: improve the diskfs_demuxer function, Samuel Thibault, 2014/01/13
- [hurd] 56/98: auth: improve the auth_demuxer function, Samuel Thibault, 2014/01/13
- [hurd] 12/98: mach-defpager: remove unused variables, Samuel Thibault, 2014/01/13
- [hurd] 45/98: proc: store the privileged host port in _hurd_host_priv, Samuel Thibault, 2014/01/13
- [hurd] 36/98: libports: fix right leaks when adjusting priorities, Samuel Thibault, 2014/01/13
- [hurd] 65/98: trans: fix the use of the hash table in fakeroot.c,
Samuel Thibault <=
- [hurd] 37/98: libshouldbeinlibc: fix minor port leak in maptime_map, Samuel Thibault, 2014/01/13
- [hurd] 38/98: init: fix port leak, Samuel Thibault, 2014/01/13
- [hurd] 68/98: trans: fix locking issue in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 55/98: pflocal: improve the demuxer functions, Samuel Thibault, 2014/01/13
- [hurd] 57/98: utils: improve the auth_demuxer function in fakeauth.c, Samuel Thibault, 2014/01/13
- [hurd] 66/98: trans: improve the performance of dir_lookup in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 41/98: libports: improve error handling in ports_reallocate_from_external, Samuel Thibault, 2014/01/13
- [hurd] 40/98: libports: improve error handling in ports_reallocate_port, Samuel Thibault, 2014/01/13
- [hurd] 58/98: trans: remove unused declaration from fakeroot.c, Samuel Thibault, 2014/01/13
- [hurd] 72/98: trans: fix reference counting bug in fakeroot, Samuel Thibault, 2014/01/13