summaryrefslogtreecommitdiff
path: root/debian/patches/fs_unification0005-libnetfs-treat-disconnected-shadow-roots-as-virtual-.patch
blob: 2f7dd8260b25374e66bb71cb3584c82ea07e0be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 0a4c575e6ad9587e5a007309576c89737a96de39 Mon Sep 17 00:00:00 2001
From: Justus Winter <justus@gnupg.org>
Date: Thu, 21 Apr 2016 17:51:40 +0200
Subject: [PATCH hurd 5/5] libnetfs: treat disconnected shadow roots as virtual
 roots

* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Treat a shadow_root with
null shadow_root_parent as a "virtual root".

Analog to 6875a586.
---
 libnetfs/dir-lookup.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index 3bcc745..731e53c 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -125,16 +125,29 @@ netfs_S_dir_lookup (struct protid *dircred,
 	if (dnp == dircred->po->shadow_root)
 	  /* We're at the root of a shadow tree.  */
 	  {
-	    *do_retry = FS_RETRY_REAUTH;
-	    *retry_port = dircred->po->shadow_root_parent;
-	    *retry_port_type = MACH_MSG_TYPE_COPY_SEND;
-	    if (lastcomp && mustbedir) /* Trailing slash.  */
-	      strcpy (retry_name, "/");
-	    else if (!lastcomp)
-	      strcpy (retry_name, nextname);
-	    err = 0;
-	    pthread_mutex_unlock (&dnp->lock);
-	    goto out;
+	    if (dircred->po->shadow_root_parent == MACH_PORT_NULL)
+	      {
+		/* This is a shadow root with no parent, meaning
+		   we should treat it as a virtual root disconnected
+		   from its real .. directory.	*/
+		err = 0;
+		np = dnp;
+		netfs_nref (np);
+	      }
+	    else
+	      {
+		/* Punt the client up to the shadow root parent.  */
+		*do_retry = FS_RETRY_REAUTH;
+		*retry_port = dircred->po->shadow_root_parent;
+		*retry_port_type = MACH_MSG_TYPE_COPY_SEND;
+		if (lastcomp && mustbedir) /* Trailing slash.  */
+		  strcpy (retry_name, "/");
+		else if (!lastcomp)
+		  strcpy (retry_name, nextname);
+		err = 0;
+		pthread_mutex_unlock (&dnp->lock);
+		goto out;
+	      }
 	  }
 	else if (dircred->po->root_parent != MACH_PORT_NULL)
 	  /* We're at a real translator root; even if DIRCRED->po has a
-- 
2.1.4