summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2018-01-31 22:46:23 +0530
committerAndreas Schneider <asn@samba.org>2018-05-02 16:31:42 +0200
commitda1fe44b27ce2dc66d795637c13bc13b2a657b79 (patch)
treee549a8e2caa47220eb23703bf138394a281e28ff
parent7299ab3541c94f38ee62a9d39348bbeb438bfc1a (diff)
downloadsocket_wrapper-da1fe44b27ce2dc66d795637c13bc13b2a657b79.tar.gz
socket_wrapper-da1fe44b27ce2dc66d795637c13bc13b2a657b79.tar.xz
socket_wrapper-da1fe44b27ce2dc66d795637c13bc13b2a657b79.zip
swrap: Update free-list only when refcount is zero
Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--src/socket_wrapper.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index ed42b2d..6c9ec51 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -2015,8 +2015,6 @@ static void swrap_remove_stale(int fd)
SWRAP_DLIST_REMOVE(socket_fds, fi);
- swrap_set_next_free(si, first_free);
- first_free = si_index;
swrap_dec_refcount(si);
free(fi);
@@ -2029,6 +2027,9 @@ static void swrap_remove_stale(int fd)
unlink(si->un_addr.sun_path);
}
+ swrap_set_next_free(si, first_free);
+ first_free = si_index;
+
out:
SWRAP_UNLOCK_SI(si);
SWRAP_UNLOCK(first_free);
@@ -5887,9 +5888,6 @@ static int swrap_close(int fd)
ret = libc_close(fd);
- swrap_set_next_free(si, first_free);
- first_free = si_index;
-
swrap_dec_refcount(si);
free(fi);
@@ -5912,6 +5910,9 @@ static int swrap_close(int fd)
unlink(si->un_addr.sun_path);
}
+ swrap_set_next_free(si, first_free);
+ first_free = si_index;
+
out:
SWRAP_UNLOCK_SI(si);
SWRAP_UNLOCK(first_free);