[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 01/02: Fix a spurious hashtable removal
From: |
Samuel Thibault |
Subject: |
[hurd] 01/02: Fix a spurious hashtable removal |
Date: |
Sat, 06 Jan 2018 01:07:00 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch master
in repository hurd.
commit 4082a842d743fba88291568cd4a846647b5c871f
Author: Samuel Thibault <address@hidden>
Date: Sat Jan 6 00:16:43 2018 +0000
Fix a spurious hashtable removal
---
debian/changelog | 1 +
debian/patches/get-identity_weakref.diff | 36 ++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 38 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 276a432..98de37b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ hurd (1:0.9.git20171119-4) UNRELEASED; urgency=medium
* patches/get-identity_hash.diff: Fix inode hashing for FS with inode
numbers bigger than 4 billion.
+ * patches/get-identity_weakref.diff: Fix a spurious hashtable removal.
-- Samuel Thibault <address@hidden> Fri, 05 Jan 2018 23:55:59 +0000
diff --git a/debian/patches/get-identity_weakref.diff
b/debian/patches/get-identity_weakref.diff
new file mode 100644
index 0000000..4752e72
--- /dev/null
+++ b/debian/patches/get-identity_weakref.diff
@@ -0,0 +1,36 @@
+commit a7c7e4c642aa284cb57a855ea94bab90cc2dae3e
+Author: Samuel Thibault <address@hidden>
+Date: Sat Jan 6 01:13:02 2018 +0100
+
+ libfshelp/get-identity.c: Avoid spurious ihash removal
+
+ Reported by Brent W. Baccala.
+
+ While some thread has converted a hardref to a weakref and tries to release
+ the hash weakref, another thread might reacquire a hardref, and then
convert
+ it to a weakref and try to release it. We thus have to make sure that we
+ really have the last weakref before removing from the hash.
+
+ * libfshelp/get-identity.c (id_clean): Also check that there are only
+ two weak refs left.
+
+diff --git a/libfshelp/get-identity.c b/libfshelp/get-identity.c
+index f88e0f82..96de55a8 100644
+--- a/libfshelp/get-identity.c
++++ b/libfshelp/get-identity.c
+@@ -69,10 +69,13 @@ static void
+ id_clean (void *cookie)
+ {
+ struct idspec *i = cookie;
++ struct references result;
+ pthread_mutex_lock (&idlock);
+- if (refcounts_hard_references(&i->pi.refcounts) == 0)
++ refcounts_references (&i->pi.refcounts, &result);
++ if (result.hard == 0 && result.weak == 2)
+ {
+- /* Nobody got a send right in between, we can remove from the hash. */
++ /* Nobody got a send right in between and we have the last weak
reference
++ in addition to our caller's, so we can remove from the hash. */
+ hurd_ihash_locp_remove (&idhash, i->id_hashloc);
+ ports_port_deref_weak (&i->pi);
+ }
diff --git a/debian/patches/series b/debian/patches/series
index a130fb5..12b415d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -32,3 +32,4 @@ exec_set_exe.patch
pie-core
hash-weakref
get-identity_hash.diff
+get-identity_weakref.diff
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git