diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-11-06 18:18:30 +0200 |
---|---|---|
committer | Yaniv Kaul <ykaul@redhat.com> | 2018-11-06 18:33:36 +0200 |
commit | d76611fbba18d3120ac59f8f127981d0c950962a (patch) | |
tree | 979c2b3041ffb958a862c428f1d3ce6457dc2cb0 /libglusterfs/src/iobuf.c | |
parent | bab025b08e63afd28cba6a3e2c5e18474904dcd3 (diff) |
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
Diffstat (limited to 'libglusterfs/src/iobuf.c')
-rw-r--r-- | libglusterfs/src/iobuf.c | 1 |
1 files changed, 1 insertions, 0 deletions
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", |