diff options
author | Kotresh HR <khiremat@redhat.com> | 2017-05-22 08:47:07 -0400 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-05-29 13:57:11 +0000 |
commit | a89449a1b831b626a6ba170cf3b16af6df190471 (patch) | |
tree | 3ee67463de3f97d6b11e866cb2ecc3d2626b1225 /xlators/features | |
parent | 12c5b9d774f6e03b69efc8e276165debdf360cb6 (diff) |
features/bitrot: Fix glusterfsd crash
With object versioning being optional, it can
so happen the bitrot stub context is not always
set. When it's not found, it's initialized. But
was not being assigned to use in the local
function. This was leading for brick crash.
Fixed the same.
> Change-Id: I0dab6435cdfe16a8c7f6a31ffec1a370822597a8
> BUG: 1454317
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
> Reviewed-on: https://review.gluster.org/17357
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
(cherry picked from commit 6908e962f6293d38f0ee65c088247a66f2832e4a)
Change-Id: I0dab6435cdfe16a8c7f6a31ffec1a370822597a8
BUG: 1456331
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: https://review.gluster.org/17406
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/bit-rot/src/stub/bit-rot-stub.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c index 4ff897d5c86..895e7690a5e 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c @@ -356,7 +356,7 @@ br_stub_prepare_signing_request (dict_t *dict, static int br_stub_init_inode_versions (xlator_t *this, fd_t *fd, inode_t *inode, unsigned long version, gf_boolean_t markdirty, - gf_boolean_t bad_object) + gf_boolean_t bad_object, uint64_t *ctx_addr) { int32_t ret = 0; br_stub_inode_ctx_t *ctx = NULL; @@ -383,6 +383,9 @@ br_stub_init_inode_versions (xlator_t *this, fd_t *fd, inode_t *inode, ret = br_stub_set_inode_ctx (this, inode, ctx); if (ret) goto free_ctx; + + if (ctx_addr) + *ctx_addr = (uint64_t) ctx; return 0; free_ctx: @@ -481,7 +484,8 @@ br_stub_need_versioning (xlator_t *this, ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr); if (ret < 0) { ret = br_stub_init_inode_versions (this, fd, fd->inode, version, - _gf_true, _gf_false); + _gf_true, _gf_false, + &ctx_addr); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to " @@ -579,7 +583,8 @@ br_stub_mark_inode_modified (xlator_t *this, br_stub_local_t *local) ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr); if (ret < 0) { ret = br_stub_init_inode_versions (this, fd, fd->inode, version, - _gf_true, _gf_false); + _gf_true, _gf_false, + &ctx_addr); if (ret) goto error_return; } @@ -624,7 +629,7 @@ br_stub_check_bad_object (xlator_t *this, inode_t *inode, int32_t *op_ret, if (ret == -1) { ret = br_stub_init_inode_versions (this, NULL, inode, version, - _gf_true, _gf_false); + _gf_true, _gf_false, NULL); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_GET_INODE_CONTEXT_FAILED, @@ -2324,7 +2329,8 @@ br_stub_open (call_frame_t *frame, xlator_t *this, ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr); if (ret) { ret = br_stub_init_inode_versions (this, fd, fd->inode, version, - _gf_true, _gf_false); + _gf_true, _gf_false, + &ctx_addr); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_GET_INODE_CONTEXT_FAILED, @@ -2426,7 +2432,8 @@ br_stub_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr); if (ret < 0) { ret = br_stub_init_inode_versions (this, fd, inode, version, - _gf_true, _gf_false); + _gf_true, _gf_false, + &ctx_addr); if (ret) { op_ret = -1; op_errno = EINVAL; @@ -2482,7 +2489,7 @@ br_stub_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unwind; ret = br_stub_init_inode_versions (this, NULL, inode, version, - _gf_true, _gf_false); + _gf_true, _gf_false, NULL); /** * Like lookup, if init_inode_versions fail, return EINVAL */ @@ -2573,7 +2580,7 @@ br_stub_lookup_version (xlator_t *this, return -1; return br_stub_init_inode_versions (this, NULL, inode, version, - _gf_true, bad_object); + _gf_true, bad_object, NULL); } |