diff options
author | Xavi Hernandez <xhernandez@redhat.com> | 2019-04-12 13:40:59 +0200 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-04-22 03:54:17 +0000 |
commit | b0fce72477d56eeca616ab089756eab4f4b4bf8e (patch) | |
tree | 1f9721fc2a901dda61868600047d397a790cf117 /libglusterfs/src/glusterfs/xlator.h | |
parent | 02a7a9ef1c0703990d6333b8b800a36da04c9f3e (diff) |
core: handle memory accounting correctly
When a translator stops, memory accounting for that translator is not
destroyed (because there could remain memory allocated that references
it), but mutexes that coordinate updates of memory accounting were
destroyed. This caused incorrect memory accounting and even crashes in
debug mode.
This patch also fixes some other things:
* Reduce the number of atomic operations needed to manage memory
accounting.
* Correctly account memory when realloc() is used.
* Merge two critical sections into one.
* Cleaned the code a bit.
Change-Id: Id5eaee7338729b9bc52c931815ca3ff1e5a7dcc8
Updates: bz#1659334
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'libglusterfs/src/glusterfs/xlator.h')
-rw-r--r-- | libglusterfs/src/glusterfs/xlator.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libglusterfs/src/glusterfs/xlator.h b/libglusterfs/src/glusterfs/xlator.h index 90396f93431..b7d0249c9c8 100644 --- a/libglusterfs/src/glusterfs/xlator.h +++ b/libglusterfs/src/glusterfs/xlator.h @@ -1035,6 +1035,8 @@ gf_boolean_t loc_is_nameless(loc_t *loc); int xlator_mem_acct_init(xlator_t *xl, int num_types); +void +xlator_mem_acct_unref(struct mem_acct *mem_acct); int is_gf_log_command(xlator_t *trans, const char *name, char *value, size_t size); int |