summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkarthik-us <ksubrahm@redhat.com>2018-04-26 12:38:23 +0530
committerkarthik-us <ksubrahm@redhat.com>2018-04-27 11:57:47 +0530
commitaa981531458a6d6e279f9a9a26f7c61b24cc14ab (patch)
treea165f07b43799cf7b2cc8bf80520cabf78b2344c
parent69c35dbb4b3b92c60cbce8dff58e9d1399820b0d (diff)
libglusterfs: Capture the dict response in syncop_xattrop_cbk
Problem: Currently it is not possible to capture the xattrs values which are set on the bricks by calling syncop_(f)xattrop, because the response dict is not being assigned to any of the dictionaries. Fix: In the xattrop callback capture the response dict and send it back to the caller if it is requested. Change-Id: I9de9bcd97d6008091c9b060bcca3676cb9ae8ef9 fixes: bz#1572076 Signed-off-by: karthik-us <ksubrahm@redhat.com>
-rw-r--r--libglusterfs/src/syncop.c18
-rw-r--r--libglusterfs/src/syncop.h7
-rw-r--r--xlators/cluster/ec/src/ec-heal.c2
-rwxr-xr-xxlators/experimental/fdl/src/gen_recon.py4
-rw-r--r--xlators/features/marker/src/marker-quota.c8
5 files changed, 30 insertions, 9 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 58477770368..3db6fae6b00 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -3175,6 +3175,8 @@ syncop_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
args->op_errno = op_errno;
if (xdata)
args->xdata = dict_ref (xdata);
+ if (dict)
+ args->dict_out = dict_ref (dict);
__wake (args);
@@ -3184,7 +3186,8 @@ syncop_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
syncop_xattrop (xlator_t *subvol, loc_t *loc, gf_xattrop_flags_t flags,
- dict_t *dict, dict_t *xdata_in, dict_t **xdata_out)
+ dict_t *dict, dict_t *xdata_in, dict_t **dict_out,
+ dict_t **xdata_out)
{
struct syncargs args = {0, };
@@ -3196,6 +3199,11 @@ syncop_xattrop (xlator_t *subvol, loc_t *loc, gf_xattrop_flags_t flags,
else if (args.xdata)
dict_unref (args.xdata);
+ if (dict_out)
+ *dict_out = args.dict_out;
+ else if (args.dict_out)
+ dict_unref (args.dict_out);
+
if (args.op_ret < 0)
return -args.op_errno;
@@ -3204,7 +3212,8 @@ syncop_xattrop (xlator_t *subvol, loc_t *loc, gf_xattrop_flags_t flags,
int
syncop_fxattrop (xlator_t *subvol, fd_t *fd, gf_xattrop_flags_t flags,
- dict_t *dict, dict_t *xdata_in, dict_t **xdata_out)
+ dict_t *dict, dict_t *xdata_in, dict_t **dict_out,
+ dict_t **xdata_out)
{
struct syncargs args = {0, };
@@ -3216,6 +3225,11 @@ syncop_fxattrop (xlator_t *subvol, fd_t *fd, gf_xattrop_flags_t flags,
else if (args.xdata)
dict_unref (args.xdata);
+ if (dict_out)
+ *dict_out = args.dict_out;
+ else if (args.dict_out)
+ dict_unref (args.dict_out);
+
if (args.op_ret < 0)
return -args.op_errno;
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 367204d05b7..3000d2e74c9 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -159,6 +159,7 @@ struct syncargs {
dict_t *xdata;
struct gf_flock flock;
struct gf_lease lease;
+ dict_t *dict_out;
/* some more _cbk needs */
uuid_t uuid;
@@ -544,11 +545,13 @@ int syncop_lease (xlator_t *subvol, loc_t *loc, struct gf_lease *lease,
int syncop_ipc (xlator_t *subvol, int op, dict_t *xdata_in, dict_t **xdata_out);
int syncop_xattrop (xlator_t *subvol, loc_t *loc, gf_xattrop_flags_t flags,
- dict_t *dict, dict_t *xdata_in, dict_t **xdata_out);
+ dict_t *dict, dict_t *xdata_in, dict_t **dict_out,
+ dict_t **xdata_out);
int
syncop_fxattrop (xlator_t *subvol, fd_t *fd, gf_xattrop_flags_t flags,
- dict_t *dict, dict_t *xdata_in, dict_t **xdata_out);
+ dict_t *dict, dict_t *xdata_in, dict_t **dict_out,
+ dict_t **xdata_out);
int
syncop_seek (xlator_t *subvol, fd_t *fd, off_t offset, gf_seek_what_t what,
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
index d1e40607e33..2ff713b7bbd 100644
--- a/xlators/cluster/ec/src/ec-heal.c
+++ b/xlators/cluster/ec/src/ec-heal.c
@@ -2136,7 +2136,7 @@ ec_data_undo_pending (call_frame_t *frame, ec_t *ec, fd_t *fd, dict_t *xattr,
}
ret = syncop_fxattrop (ec->xl_list[idx], fd,
- GF_XATTROP_ADD_ARRAY64, xattr, NULL, NULL);
+ GF_XATTROP_ADD_ARRAY64, xattr, NULL, NULL, NULL);
out:
return ret;
}
diff --git a/xlators/experimental/fdl/src/gen_recon.py b/xlators/experimental/fdl/src/gen_recon.py
index 295df699f6e..af1765517f3 100755
--- a/xlators/experimental/fdl/src/gen_recon.py
+++ b/xlators/experimental/fdl/src/gen_recon.py
@@ -145,6 +145,10 @@ def get_special_subs (name, args, fop_type):
elif name == 'symlink':
# Swap 'linkpath' and 'loc'.
s_args_str = '&loc, linkpath, &iatt, xdata'
+ elif name == 'xattrop':
+ s_args_str = '&loc, flags, dict, xdata, NULL'
+ elif name == 'fxattrop':
+ s_args_str = 'fd, flags, dict, xdata, NULL'
else:
s_args_str = string.join (s_args, ", ")
return code, links, s_args_str, cleanups
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index b4c3eb395bd..b6bf2fb36a4 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -475,7 +475,7 @@ mq_create_size_xattrs (xlator_t *this, quota_inode_ctx_t *ctx, loc_t *loc)
ret = syncop_xattrop (FIRST_CHILD(this), loc,
GF_XATTROP_ADD_ARRAY64_WITH_DEFAULT, dict, NULL,
- NULL);
+ NULL, NULL);
if (ret < 0) {
gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
@@ -601,7 +601,7 @@ mq_get_set_dirty (xlator_t *this, loc_t *loc, int32_t dirty,
}
ret = syncop_xattrop (FIRST_CHILD(this), loc, GF_XATTROP_GET_AND_SET,
- dict, NULL, &rsp_dict);
+ dict, NULL, NULL, &rsp_dict);
if (ret < 0) {
gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
@@ -956,7 +956,7 @@ mq_update_contri (xlator_t *this, loc_t *loc, inode_contribution_t *contri,
goto out;
ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64,
- dict, NULL, NULL);
+ dict, NULL, NULL, NULL);
if (ret < 0) {
gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
@@ -1015,7 +1015,7 @@ mq_update_size (xlator_t *this, loc_t *loc, quota_meta_t *delta)
ret = syncop_xattrop(FIRST_CHILD(this), loc,
GF_XATTROP_ADD_ARRAY64_WITH_DEFAULT, dict, NULL,
- NULL);
+ NULL, NULL);
if (ret < 0) {
gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "