diff options
| author | Shreyas Siravara <sshreyas@fb.com> | 2017-09-06 15:37:34 -0700 |
|---|---|---|
| committer | Shreyas Siravara <sshreyas@fb.com> | 2017-09-08 23:14:22 +0000 |
| commit | bad06a5ce47772d1885dd054dc384af750f0c5da (patch) | |
| tree | f3830740fc5ab8bc9f095f7aa6e4997e57ca71c3 /cli/src | |
| parent | cfda6dde4587cff2d525a3d591f333b89e739b90 (diff) | |
exports: Add a reference count to export_item_t structs and ensure they are correctly used
Summary:
This diff fixes a bug in the NFS daemon where the auth cache would use an export item after it was free'd by the
auth params refresh thread. This usually manifests as a crash in production, when exports files are updated by chef.
Since each auth cache entry holds a pointer to an export_item_t it makes sense that it should first get a reference to it.
Freein'g the export_item_t struct happens only in `exp_item_unref()`, once the reference count has dropped to 0.
This diff also fixes a use-after-free bug in the auth-cache, in the insertion path.
In _cache_item(), if we find an entry in the dict, we update that entry with a timestamp & ref the export item associated with it.
However, if the item already existed and we called old_cache_insert() with the same key, we gave the dict permission to free the old entry.
We then end up using that entry.
The fix is to use dict_set_static_bin() instead of dict_set_bin() which informs the dict that the pointer we are giving it belongs to us.
This is a port of D5780476, D5785038 to 3.8
Change-Id: I5cdcdc1cc6abad26c7077d66a14f263da07678ac
Reviewed-on: https://review.gluster.org/18248
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'cli/src')
0 files changed, 0 insertions, 0 deletions
