[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 91/98: trans/mtab: remove the loop detection logic
From: |
Samuel Thibault |
Subject: |
[hurd] 91/98: trans/mtab: remove the loop detection logic |
Date: |
Tue, 14 Jan 2014 02:00:05 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit dda3d358224c334c8fa4902b3e20c75caf8bddbc
Author: Justus Winter <address@hidden>
Date: Thu Nov 14 15:47:00 2013 +0100
trans/mtab: remove the loop detection logic
Previously the mtab detector tried to detect whether it talks to
itself by comparing the control port of the translator it currently
visits with its own. This was done to prevent deadlocks. However, this
did not detect non-trivial loops, i.e. two mtab translators would
still dead-lock each other.
Now that it is safe to actually file_name_lookup the root node of a
mtab translator without triggering the generation of content, this
logic can just be omitted.
* trans/mtab.c (mtab_populate): Remove the loop detection logic.
---
trans/mtab.c | 43 +++++++++++--------------------------------
1 file changed, 11 insertions(+), 32 deletions(-)
diff --git a/trans/mtab.c b/trans/mtab.c
index 9b867b7..0bcd52b 100644
--- a/trans/mtab.c
+++ b/trans/mtab.c
@@ -282,7 +282,6 @@ mtab_populate (struct mtab *mtab, const char *path, int
insecure)
/* These resources are freed in the epilogue. */
file_t node = MACH_PORT_NULL;
- fsys_t fsys = MACH_PORT_NULL;
char *argz = NULL;
size_t argz_len = 0;
char **argv = NULL;
@@ -295,16 +294,16 @@ mtab_populate (struct mtab *mtab, const char *path, int
insecure)
char *children = NULL;
size_t children_len = 0;
- /* Get the underlying node. */
- node = file_name_lookup (path, O_NOTRANS, 0666);
- if (node == MACH_PORT_NULL)
- {
- err = errno;
- goto errout;
- }
-
if (! insecure)
{
+ /* Get the underlying node. */
+ node = file_name_lookup (path, O_NOTRANS, 0666);
+ if (node == MACH_PORT_NULL)
+ {
+ err = errno;
+ goto errout;
+ }
+
/* Check who owns the node the translator is bound to. */
io_statbuf_t st;
err = io_stat (node, &st);
@@ -316,28 +315,11 @@ mtab_populate (struct mtab *mtab, const char *path, int
insecure)
err = EPERM;
goto errout;
}
- }
- err = file_get_translator_cntl (node, &fsys);
- if (err == EPERM)
- /* If we do not have permission to do that, it cannot be a node
- bound to our control port, so ignore this error. */
- err = 0;
-
- if (err == ENXIO && strcmp (path, "/") == 0)
- /* The root translator fails differently, but this can't be bound
- to our control port either, so ignore this error. */
- err = 0;
-
- if (err)
- return err;
-
- if (control && control->pi.port_right == fsys)
- /* This node is bound to our control port, ignore it. */
- goto errout;
+ mach_port_deallocate (mach_task_self (), node);
+ }
- /* Re-do the lookup without O_NOTRANS to get the root node. */
- mach_port_deallocate (mach_task_self (), node);
+ /* (Re-)do the lookup without O_NOTRANS to get the root node. */
node = file_name_lookup (path, 0, 0666);
if (node == MACH_PORT_NULL)
{
@@ -461,9 +443,6 @@ mtab_populate (struct mtab *mtab, const char *path, int
insecure)
if (node != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), node);
- if (fsys != MACH_PORT_NULL)
- mach_port_deallocate (mach_task_self (), fsys);
-
if (argz)
vm_deallocate (mach_task_self (), (vm_address_t) argz, argz_len);
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 08/98: proc: fix error handling in S_proc_exception_raise, (continued)
- [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, 2014/01/13
- [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 <=
- [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
- [hurd] 94/98: trans/mtab: do not include non-filesystem translators by default, Samuel Thibault, 2014/01/13
- [hurd] 96/98: libdiskfs: register passive translator startups, Samuel Thibault, 2014/01/13
- [hurd] 92/98: trans/mtab: properly lock mtab objects, Samuel Thibault, 2014/01/13
- [hurd] 03/98: libports: fix the thread counts in case the thread creation fails, Samuel Thibault, 2014/01/13
- [hurd] 76/98: utils/settrans: fix the teardown of chrooted environments, Samuel Thibault, 2014/01/13
- [hurd] 16/98: libshouldbeinlibc: fix reference counting in port_name_xlator_create, Samuel Thibault, 2014/01/13