diff options
Diffstat (limited to 'rpc/xdr')
-rw-r--r-- | rpc/xdr/src/glusterfs3.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rpc/xdr/src/glusterfs3.h b/rpc/xdr/src/glusterfs3.h index bbe231139b3..550b9a3ceb8 100644 --- a/rpc/xdr/src/glusterfs3.h +++ b/rpc/xdr/src/glusterfs3.h @@ -668,6 +668,9 @@ dict_to_xdr (dict_t *this, gfx_dict *dict) goto out; } + /* Do the whole operation in locked region */ + LOCK (&this->lock); + dict->pairs.pairs_val = GF_CALLOC (1, (this->count * sizeof (gfx_dict_pair)), gf_common_mt_char); @@ -756,6 +759,10 @@ dict_to_xdr (dict_t *this, gfx_dict *dict) ret = 0; out: + /* this can be null here, so unlock only if its not null */ + if (this) + UNLOCK (&this->lock); + return ret; } |