From 8d5a124be53200c775b818e933603c1c8eeefbe5 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 5 Oct 2016 13:34:26 +0200 Subject: 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. --- libnetfs/dir-lookup.c | 74 +++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 40 deletions(-) (limited to 'libnetfs/dir-lookup.c') diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c index c24a4989..321ee6e1 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; -- cgit v1.2.3