commit-hurd
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]