diff options
| author | Tamar Shacked <tshacked@redhat.com> | 2020-06-04 11:35:30 +0300 | 
|---|---|---|
| committer | Amar Tumballi <amar@kadalu.io> | 2020-06-09 01:31:20 +0000 | 
| commit | dbd74e0b8d710956f5224dfd420b7e9ff4bb165b (patch) | |
| tree | ca0f4e5ef037bf1052a5a5e6c2bb03fa321641f4 | |
| parent | af89d9e623cd99d3cec55cd650304d7ff9fae7e5 (diff) | |
When creating new file don't set xatrr "trusted.glusterfs.dht"
The curr call to delete the xattr from the dict fails to find the key: dict_del_sizen(xdata, xattr_name);
This is beacuse keysize is calculated as sizeof of xattr_name which is a pointer, this lead to wrong size -> hash.
Fix: call to dict_deln which get keysize using strlen.
fixes: #1282
Change-Id: I23ce1f8f7928e9daa43bc3a9fa8d3611e81bbc36
Signed-off-by: Tamar Shacked <tshacked@redhat.com>
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 6 | 
1 files changed, 4 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 4528445625e..24466c4abf6 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -3503,6 +3503,7 @@ posix_is_layout_stale(dict_t *xdata, char *par_path, xlator_t *this)      gf_boolean_t have_val = _gf_false;      data_t *arg_data = NULL;      char *xattr_name = NULL; +    size_t xattr_len = 0;      gf_boolean_t is_stale = _gf_false;      op_ret = dict_get_str_sizen(xdata, GF_PREOP_PARENT_KEY, &xattr_name); @@ -3511,7 +3512,8 @@ posix_is_layout_stale(dict_t *xdata, char *par_path, xlator_t *this)          return is_stale;      } -    arg_data = dict_get(xdata, xattr_name); +    xattr_len = strlen(xattr_name); +    arg_data = dict_getn(xdata, xattr_name, xattr_len);      if (!arg_data) {          op_ret = 0;          dict_del_sizen(xdata, GF_PREOP_PARENT_KEY); @@ -3559,7 +3561,7 @@ posix_is_layout_stale(dict_t *xdata, char *par_path, xlator_t *this)      }  out: -    dict_del_sizen(xdata, xattr_name); +    dict_deln(xdata, xattr_name, xattr_len);      dict_del_sizen(xdata, GF_PREOP_PARENT_KEY);      if (op_ret == -1) {  | 
