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 <ykaul@redhat.com>

Change-Id: I82ac241edf1d511bf6807cf9c46c538ab9f4acc4
This commit is contained in:
Yaniv Kaul 2018-11-06 18:18:30 +02:00
parent bab025b08e
commit d76611fbba

View File

@ -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",