From d76611fbba18d3120ac59f8f127981d0c950962a Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Tue, 6 Nov 2018 18:18:30 +0200 Subject: libglusterfs/src/iobuf.c: don't forget to unlock a mutex commit ed83a4ee7b73e6b04694d1ac11ed25d2983ac943 changed locking order and forgot to unlock in a negative path (when index was -1). Coverity caught it (thanks!) as CID 1396581: Program hangs (LOCK) Note: I'm unlocking before logging the failure. I think it's the right order - logging can take a while (especially if your disk is slow). Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul Change-Id: I82ac241edf1d511bf6807cf9c46c538ab9f4acc4 --- libglusterfs/src/iobuf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libglusterfs/src/iobuf.c') diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c index 13c8309e670..46efab692fc 100644 --- a/libglusterfs/src/iobuf.c +++ b/libglusterfs/src/iobuf.c @@ -363,6 +363,7 @@ iobuf_pool_new(void) index = gf_iobuf_get_arena_index(page_size); if (index == -1) { + pthread_mutex_unlock(&iobuf_pool->mutex); gf_msg("iobuf", GF_LOG_ERROR, 0, LG_MSG_PAGE_SIZE_EXCEEDED, "page_size (%zu) of iobufs in arena being added is " "greater than max available", -- cgit