diff options
author | Poornima G <pgurusid@redhat.com> | 2017-08-03 17:43:22 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-08-12 13:42:27 +0000 |
commit | 3fe535afa61fa06c066e511c3c6e269902924296 (patch) | |
tree | 466f9a9dc619401d9a3a93bbdd2beb37442ac0db /xlators/features/upcall/src/upcall.c | |
parent | 0b099fc4b38edd9d6af187bbee23af29a874b640 (diff) |
gfapi: Duplicate the buffer sent in setxattr calls
Issue:
The caller of glfs_setxattr sends a buffer to set as the value.
We create a dict in which the pointer to the value is set.
Underlying layers like md-cache take a ref on this dict to store
the value for a longer time. But the moment setxattr is complete,
the caller of glfs_setxattr can free the value memory.
Solution:
memcpy the setxattr value to the gluster buffer.
> Reviewed-on: https://review.gluster.org/17967
> Reviewed-by: soumya k <skoduri@redhat.com>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
> (cherry picked from commit e11296f8e52b7e3b13d21b41d4fa34baea878edf)
Change-Id: I58753fe702e8b7d0f6c4f058714c65d0ad5d7a0a
BUG: 1479656
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: https://review.gluster.org/18002
Smoke: Gluster 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/upcall/src/upcall.c')
-rw-r--r-- | xlators/features/upcall/src/upcall.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c index e20a2e87093..3e1d307260a 100644 --- a/xlators/features/upcall/src/upcall.c +++ b/xlators/features/upcall/src/upcall.c @@ -1876,7 +1876,7 @@ up_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, EXIT_IF_UPCALL_OFF (this, out); - xattr = dict_for_key_value (name, "", 1); + xattr = dict_for_key_value (name, "", 1, _gf_true); if (!xattr) { op_errno = ENOMEM; goto err; @@ -1964,7 +1964,7 @@ up_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, EXIT_IF_UPCALL_OFF (this, out); - xattr = dict_for_key_value (name, "", 1); + xattr = dict_for_key_value (name, "", 1, _gf_true); if (!xattr) { op_errno = ENOMEM; goto err; |