summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2018-09-29 12:10:46 +0800
committerAmar Tumballi <amarts@redhat.com>2018-10-17 09:49:13 +0000
commit24dbcfb6ebaab021e2db4f63bd66f3b06192bc89 (patch)
treec1536103c6c2384fe3a5e2bbb9d2df06ccf3719b /xlators/storage
parent573253d250972dad60ec28cd101f9facd82a0fe2 (diff)
posix: return more xattrs at getxattr/fgetxattr when client request
Change-Id: I37ac6186b3631979d2503d1b185a61b8094dbd0d Updates: bz#1634220 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 4ce181d9c0e..0c15a0100e4 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -2970,6 +2970,10 @@ posix_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
int keybuff_len;
char *value_buf = NULL;
gf_boolean_t have_val = _gf_false;
+ struct iatt buf = {
+ 0,
+ };
+ dict_t *xattr_rsp = NULL;
DECLARE_OLD_FS_ID_VAR;
@@ -3438,6 +3442,11 @@ posix_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
done:
op_ret = size;
+ if (xdata && (op_ret >= 0)) {
+ xattr_rsp = posix_xattr_fill(this, real_path, loc, NULL, -1, xdata,
+ &buf);
+ }
+
if (dict) {
dict_del(dict, GFID_XATTR_KEY);
dict_del(dict, GF_XATTR_VOL_ID_KEY);
@@ -3446,7 +3455,10 @@ done:
out:
SET_TO_OLD_FS_ID();
- STACK_UNWIND_STRICT(getxattr, frame, op_ret, op_errno, dict, NULL);
+ STACK_UNWIND_STRICT(getxattr, frame, op_ret, op_errno, dict, xattr_rsp);
+
+ if (xattr_rsp)
+ dict_unref(xattr_rsp);
if (dict) {
dict_unref(dict);
@@ -3476,6 +3488,10 @@ posix_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
int key_len;
char *value_buf = NULL;
gf_boolean_t have_val = _gf_false;
+ struct iatt buf = {
+ 0,
+ };
+ dict_t *xattr_rsp = NULL;
DECLARE_OLD_FS_ID_VAR;
@@ -3730,6 +3746,11 @@ posix_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
done:
op_ret = size;
+ if (xdata && (op_ret >= 0)) {
+ xattr_rsp = posix_xattr_fill(this, NULL, NULL, fd, pfd->fd, xdata,
+ &buf);
+ }
+
if (dict) {
dict_del(dict, GFID_XATTR_KEY);
dict_del(dict, GF_XATTR_VOL_ID_KEY);
@@ -3738,7 +3759,10 @@ done:
out:
SET_TO_OLD_FS_ID();
- STACK_UNWIND_STRICT(fgetxattr, frame, op_ret, op_errno, dict, NULL);
+ STACK_UNWIND_STRICT(fgetxattr, frame, op_ret, op_errno, dict, xattr_rsp);
+
+ if (xattr_rsp)
+ dict_unref(xattr_rsp);
if (dict)
dict_unref(dict);