summaryrefslogtreecommitdiff
path: root/debian/patches/fixes0002-Avoid-superfluous-locking-of-node.patch
blob: b1dbafaf957b2c457e375cea576009657f002c3f (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
From 614e8df719de7b7b03f9a15ee3049e3a29b06f87 Mon Sep 17 00:00:00 2001
From: Justus Winter <justus@gnupg.org>
Date: Mon, 25 Apr 2016 00:54:08 +0200
Subject: [PATCH hurd 2/3] Avoid superfluous locking of node

* libdiskfs/io-restrict-auth.c (diskfs_S_io_restrict_auth): Do not
lock the associated node.  No operation here needs synchronization.
* libnetfs/io-restrict-auth.c (netfs_S_io_restrict_auth): Likewise.
---
 libdiskfs/io-restrict-auth.c | 2 --
 libnetfs/io-restrict-auth.c  | 3 ---
 2 files changed, 5 deletions(-)

diff --git a/libdiskfs/io-restrict-auth.c b/libdiskfs/io-restrict-auth.c
index 80c0b20..1c2c999 100644
--- a/libdiskfs/io-restrict-auth.c
+++ b/libdiskfs/io-restrict-auth.c
@@ -40,7 +40,6 @@ diskfs_S_io_restrict_auth (struct protid *cred,
   if (err)
     return err;
 
-  pthread_mutex_lock (&cred->po->np->lock);
   refcount_ref (&cred->po->refcnt);
   err = diskfs_create_protid (cred->po, user, &newpi);
   if (! err)
@@ -51,7 +50,6 @@ diskfs_S_io_restrict_auth (struct protid *cred,
     }
   else
     refcount_deref (&cred->po->refcnt);
-  pthread_mutex_unlock (&cred->po->np->lock);
 
   iohelp_free_iouser (user);
   return err;
diff --git a/libnetfs/io-restrict-auth.c b/libnetfs/io-restrict-auth.c
index 79b7d09..89df671 100644
--- a/libnetfs/io-restrict-auth.c
+++ b/libnetfs/io-restrict-auth.c
@@ -42,19 +42,16 @@ netfs_S_io_restrict_auth (struct protid *user,
   if (err)
     return err;
 
-  pthread_mutex_lock (&user->po->np->lock);
   refcount_ref (&user->po->refcnt);
   newpi = netfs_make_protid (user->po, new_user);
   if (newpi)
     {
       *newport = ports_get_right (newpi);
-      pthread_mutex_unlock (&user->po->np->lock);
       *newporttype = MACH_MSG_TYPE_MAKE_SEND;
     }
   else
     {
       refcount_deref (&user->po->refcnt);
-      pthread_mutex_unlock (&user->po->np->lock);
       iohelp_free_iouser (new_user);
       err = ENOMEM;
     }
-- 
2.1.4