[sheepdog] [PATCH 2/2] sheep: fix illegal direct assignments to an uatomic_bool typed variable

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Tue Jan 29 06:51:06 CET 2013


global_cache->in_reclaim and sockfd_cache_fd->in_use should be
accessed with uatomic_set_{true, false}.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/object_cache.c |    2 +-
 sheep/sockfd_cache.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index 4e26392..519a86e 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -1274,7 +1274,7 @@ int object_cache_init(const char *p)
 	strbuf_copyout(&buf, object_cache_dir, sizeof(object_cache_dir));
 
 	uatomic_set(&gcache.capacity, 0);
-	gcache.in_reclaim = false;
+	uatomic_set_true(&gcache.in_reclaim);
 
 	ret = load_cache();
 err:
diff --git a/sheep/sockfd_cache.c b/sheep/sockfd_cache.c
index f1124c0..d39ff6e 100644
--- a/sheep/sockfd_cache.c
+++ b/sheep/sockfd_cache.c
@@ -304,7 +304,7 @@ static void do_grow_fds(struct work *work)
 		entry->fds = xrealloc(entry->fds, new_size);
 		for (i = old_fds_count; i < new_fds_count; i++) {
 			entry->fds[i].fd = -1;
-			entry->fds[i].in_use = false;
+			uatomic_set_false(&entry->fds[i].in_use);
 		}
 	}
 	pthread_rwlock_unlock(&sockfd_cache.lock);
-- 
1.7.2.5




More information about the sheepdog mailing list