[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 69/98: trans: return nodes locked when creating fake nodes in fak
From: |
Samuel Thibault |
Subject: |
[hurd] 69/98: trans: return nodes locked when creating fake nodes in fakeroot |
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 54ee5b628f8d4a1447670f65cc441fc32a9e96ef
Author: Justus Winter <address@hidden>
Date: Sun Dec 8 18:05:06 2013 +0100
trans: return nodes locked when creating fake nodes in fakeroot
* trans/fakeroot.c (new_node): Acquire the nodes lock before releasing
the idport_ihash_lock. Return nodes locked.
(netfs_S_dir_lookup): Drop lock.
(netfs_attempt_mkfile): Likewise.
(main): Likewise.
---
trans/fakeroot.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index b97b499..1233104 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -61,7 +61,8 @@ struct hurd_ihash idport_ihash
= HURD_IHASH_INITIALIZER (offsetof (struct netnode, idport_locp));
-/* Make a new virtual node. Always consumes the ports. */
+/* Make a new virtual node. Always consumes the ports. If
+ successful, NP will be locked. */
static error_t
new_node (file_t file, mach_port_t idport, int locked, int openmodes,
struct node **np)
@@ -107,7 +108,10 @@ new_node (file_t file, mach_port_t idport, int locked, int
openmodes,
pthread_mutex_lock (&idport_ihash_lock);
err = hurd_ihash_add (&idport_ihash, nn->idport, nn);
if (!err)
- netfs_nref (*np); /* Return a reference to the caller. */
+ {
+ pthread_mutex_lock (&(*np)->lock);
+ netfs_nref (*np); /* Return a reference to the caller. */
+ }
pthread_mutex_unlock (&idport_ihash_lock);
}
if (err)
@@ -330,7 +334,10 @@ netfs_S_dir_lookup (struct protid *diruser,
{
err = new_node (file, idport, 1, flags, &np);
if (!err)
- err = netfs_validate_stat (np, diruser->user);
+ {
+ pthread_mutex_unlock (&np->lock);
+ err = netfs_validate_stat (np, diruser->user);
+ }
}
}
}
@@ -616,6 +623,8 @@ netfs_attempt_mkfile (struct iouser *user, struct node *dir,
real_from_fake_mode (mode), &newfile);
if (err == 0)
err = new_node (newfile, MACH_PORT_NULL, 0, O_RDWR|O_EXEC, np);
+ if (err == 0)
+ pthread_mutex_unlock (&(*np)->lock);
pthread_mutex_unlock (&dir->lock);
return err;
}
@@ -962,6 +971,7 @@ any user to open nodes regardless of permissions as is done
for root." };
netfs_root_node->nn_stat.st_mode &= ~(S_IPTRANS | S_IATRANS);
netfs_root_node->nn_stat.st_mode |= S_IROOT;
netfs_root_node->nn->faked |= FAKE_MODE;
+ pthread_mutex_unlock (&netfs_root_node->lock);
netfs_server_loop (); /* Never returns. */
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 75/98: console-client: remove spurious pthread_spin_unlocks, (continued)
- [hurd] 75/98: console-client: remove spurious pthread_spin_unlocks, Samuel Thibault, 2014/01/13
- [hurd] 62/98: trans: make the fakeroot environment more transparent, Samuel Thibault, 2014/01/13
- [hurd] 14/98: proc: turn count_up and store_pid into normal functions, Samuel Thibault, 2014/01/13
- [hurd] 67/98: trans: handle invalid responses to dir_lookup requests in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 78/98: trans/fakeroot: drop else, Samuel Thibault, 2014/01/13
- [hurd] 13/98: term: fix error handling in hurdio_mdmctl, Samuel Thibault, 2014/01/13
- [hurd] 08/98: proc: fix error handling in S_proc_exception_raise, Samuel Thibault, 2014/01/13
- [hurd] 07/98: proc: fix a use-after-free error, Samuel Thibault, 2014/01/13
- [hurd] 18/98: libdiskfs: remove dead assignment, Samuel Thibault, 2014/01/13
- [hurd] 60/98: trans: fix the creation of files in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 69/98: trans: return nodes locked when creating fake nodes in fakeroot,
Samuel Thibault <=
- [hurd] 20/98: ext2fs: fix error handling, Samuel Thibault, 2014/01/13
- [hurd] 21/98: libshouldbeinlibc: fix dead assignment, Samuel Thibault, 2014/01/13
- [hurd] 93/98: trans/mtab: make the translator multithreaded, Samuel Thibault, 2014/01/13
- [hurd] 05/98: proc: remove declaration of nested functions from proc.h, Samuel Thibault, 2014/01/13
- [hurd] 15/98: mach-defpager: include errno.h, Samuel Thibault, 2014/01/13
- [hurd] 91/98: trans/mtab: remove the loop detection logic, Samuel Thibault, 2014/01/13
- [hurd] 97/98: libnetfs: register passive translator startups, Samuel Thibault, 2014/01/13
- [hurd] 19/98: libdiskfs: fix error handling, Samuel Thibault, 2014/01/13
- [hurd] 11/98: mach-defpager: turn dealloc_direct into a normal function, Samuel Thibault, 2014/01/13
- [hurd] 23/98: mach-defpager: do not remove -Wall from CFLAGS, Samuel Thibault, 2014/01/13