[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 03/15: Fix active translator registration.
From: |
Samuel Thibault |
Subject: |
[hurd] 03/15: Fix active translator registration. |
Date: |
Sun, 19 Nov 2017 15:27:05 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch dde
in repository hurd.
commit 8d5a124be53200c775b818e933603c1c8eeefbe5
Author: Justus Winter <address@hidden>
Date: Wed Oct 5 13:34:26 2016 +0200
Fix active translator registration.
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Unconditionally
register translators. Previously, we missed translators because
'transbox.active' is not in fact reset if the translator dies.
* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise.
---
libdiskfs/dir-lookup.c | 66 ++++++++++++++++++++------------------------
libnetfs/dir-lookup.c | 74 +++++++++++++++++++++++---------------------------
2 files changed, 64 insertions(+), 76 deletions(-)
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 3c7198f..63bba78 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -249,13 +249,6 @@ diskfs_S_dir_lookup (struct protid *dircred,
if (np != dnp)
pthread_mutex_unlock (&dnp->lock);
- /* Check if an active translator is currently running. If
- not, fshelp_fetch_root will start one. In that case, we
- need to register it in the list of active
- translators. */
- boolean_t register_translator =
- np->transbox.active == MACH_PORT_NULL;
-
struct fshelp_stat_cookie2 cookie = {
.statp = &np->dn_stat,
.modep = &np->dn_stat.st_mode,
@@ -291,36 +284,37 @@ diskfs_S_dir_lookup (struct protid *dircred,
}
}
- if (register_translator)
- {
- char *translator_path = strdupa (relpath);
- char *complete_path;
- if (nextname != NULL)
- {
- /* This was not the last path component.
- NEXTNAME points to the next component, locate
- the end of the current component and use it
- to trim TRANSLATOR_PATH. */
- char *end = nextname;
- while (*end != 0)
- end--;
- translator_path[end - filename_start] = '\0';
- }
+ {
+ char *translator_path = strdupa (relpath);
+ char *complete_path;
+ if (nextname != NULL)
+ {
+ /* This was not the last path component.
+ NEXTNAME points to the next component, locate
+ the end of the current component and use it
+ to trim TRANSLATOR_PATH. */
+ char *end = nextname;
+ while (*end != 0)
+ end--;
+ translator_path[end - filename_start] = '\0';
+ }
- if (dircred->po->path == NULL || !strcmp
(dircred->po->path,"."))
- /* dircred is the root directory. */
- complete_path = translator_path;
- else
- asprintf (&complete_path, "%s/%s", dircred->po->path,
translator_path);
-
- err = fshelp_set_active_translator (&newpi->pi,
- complete_path,
- np->transbox.active);
- if (complete_path != translator_path)
- free(complete_path);
- if (err)
- goto out;
- }
+ if (dircred->po->path == NULL
+ || !strcmp (dircred->po->path,"."))
+ /* dircred is the root directory. */
+ complete_path = translator_path;
+ else
+ asprintf (&complete_path, "%s/%s", dircred->po->path,
+ translator_path);
+
+ err = fshelp_set_active_translator (&newpi->pi,
+ complete_path,
+ np->transbox.active);
+ if (complete_path != translator_path)
+ free(complete_path);
+ if (err)
+ goto out;
+ }
goto out;
}
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index c24a498..321ee6e 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -235,7 +235,6 @@ netfs_S_dir_lookup (struct protid *dircred,
}
}
- boolean_t register_translator = 0;
if (! err)
{
struct fshelp_stat_cookie2 cookie = {
@@ -246,12 +245,6 @@ netfs_S_dir_lookup (struct protid *dircred,
dirport = ports_get_send_right (newpi);
- /* Check if an active translator is currently running. If
- not, fshelp_fetch_root will start one. In that case, we
- need to register it in the list of active
- translators. */
- register_translator = np->transbox.active == MACH_PORT_NULL;
-
err = fshelp_fetch_root (&np->transbox,
&cookie,
dirport,
@@ -282,39 +275,40 @@ netfs_S_dir_lookup (struct protid *dircred,
}
}
- if (register_translator)
- {
- char *translator_path = strdupa (relpath);
- char *complete_path;
- if (nextname != NULL)
- {
- /* This was not the last path component.
- NEXTNAME points to the next component, locate
- the end of the current component and use it
- to trim TRANSLATOR_PATH. */
- char *end = nextname;
- while (*end != 0)
- end--;
- translator_path[end - filename_start] = '\0';
- }
-
- if (dircred->po->path == NULL || !strcmp
(dircred->po->path,"."))
- /* dircred is the root directory. */
- complete_path = translator_path;
- else
- asprintf (&complete_path, "%s/%s", dircred->po->path,
translator_path);
-
- err = fshelp_set_active_translator (&newpi->pi,
- complete_path,
- np->transbox.active);
- if (complete_path != translator_path)
- free(complete_path);
- if (err)
- {
- ports_port_deref (newpi);
- goto out;
- }
- }
+ {
+ char *translator_path = strdupa (relpath);
+ char *complete_path;
+ if (nextname != NULL)
+ {
+ /* This was not the last path component.
+ NEXTNAME points to the next component, locate
+ the end of the current component and use it
+ to trim TRANSLATOR_PATH. */
+ char *end = nextname;
+ while (*end != 0)
+ end--;
+ translator_path[end - filename_start] = '\0';
+ }
+
+ if (dircred->po->path == NULL
+ || !strcmp (dircred->po->path,"."))
+ /* dircred is the root directory. */
+ complete_path = translator_path;
+ else
+ asprintf (&complete_path, "%s/%s", dircred->po->path,
+ translator_path);
+
+ err = fshelp_set_active_translator (&newpi->pi,
+ complete_path,
+ np->transbox.active);
+ if (complete_path != translator_path)
+ free(complete_path);
+ if (err)
+ {
+ ports_port_deref (newpi);
+ goto out;
+ }
+ }
ports_port_deref (newpi);
goto out;
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 05/15: libfshelp: Always register dead-name notifications., (continued)
- [hurd] 05/15: libfshelp: Always register dead-name notifications., Samuel Thibault, 2017/11/19
- [hurd] 07/15: Normalize path of translators., Samuel Thibault, 2017/11/19
- [hurd] 09/15: libfshelp: Avoid some right diddling., Samuel Thibault, 2017/11/19
- [hurd] 08/15: libfshelp: Improve error handling., Samuel Thibault, 2017/11/19
- [hurd] 12/15: libdiskfs: Shutdown pagers on startup_dosync., Samuel Thibault, 2017/11/19
- [hurd] 10/15: libfshelp: Use node instead of name as key., Samuel Thibault, 2017/11/19
- [hurd] 06/15: libfshelp: Add function to map over all active translators., Samuel Thibault, 2017/11/19
- [hurd] 02/15: libfshelp: improve translator list, Samuel Thibault, 2017/11/19
- [hurd] 01/15: pflocal: Use default stub implementations., Samuel Thibault, 2017/11/19
- [hurd] 15/15: Merge branch 'dde-upstream' into dde, Samuel Thibault, 2017/11/19
- [hurd] 03/15: Fix active translator registration.,
Samuel Thibault <=
- [hurd] 13/15: Merge remote-tracking branch 'mainline/master' into dde, Samuel Thibault, 2017/11/19
- [hurd] 14/15: Merge branch 'dde' of git.savannah.gnu.org:/srv/git/hurd/incubator into dde-upstream, Samuel Thibault, 2017/11/19
- [hurd] 11/15: Traverse translator hierarchies using the fsys protocol., Samuel Thibault, 2017/11/19