summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/dht/src/dht-common.c30
-rw-r--r--xlators/debug/io-stats/src/io-stats.c9
-rw-r--r--xlators/protocol/server/src/server-helpers.c58
-rw-r--r--xlators/protocol/server/src/server.h3
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c6
5 files changed, 95 insertions, 11 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 0a39084a1..a262ba6ca 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1938,10 +1938,12 @@ int
dht_setxattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, dict_t *xattr, int flags)
{
- xlator_t *subvol = NULL;
- int op_errno = -1;
- dht_local_t *local = NULL;
-
+ xlator_t *subvol = NULL;
+ dht_local_t *local = NULL;
+ dht_conf_t *conf = NULL;
+ dht_layout_t *layout = NULL;
+ int i = 0;
+ int op_errno = EINVAL;
VALIDATE_OR_GOTO (frame, err);
VALIDATE_OR_GOTO (this, err);
@@ -1949,6 +1951,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (loc->inode, err);
VALIDATE_OR_GOTO (loc->path, err);
+ conf = this->private;
subvol = dht_subvol_get_cached (this, loc->inode);
if (!subvol) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -1965,11 +1968,22 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->call_cnt = 1;
+ local->layout = layout = dht_layout_get (this, loc->inode);
+ if (!layout) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "no layout for path=%s", loc->path);
+ op_errno = EINVAL;
+ goto err;
+ }
- STACK_WIND (frame, dht_err_cbk,
- subvol, subvol->fops->setxattr,
- loc, xattr, flags);
+ local->call_cnt = layout->cnt;
+
+ for (i = 0; i < layout->cnt; i++) {
+ STACK_WIND (frame, dht_err_cbk,
+ layout->list[i].xlator,
+ layout->list[i].xlator->fops->setxattr,
+ loc, xattr, flags);
+ }
return 0;
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 4a96ca3c2..2d56ecf6a 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -243,14 +243,17 @@ io_stats_dump_global (xlator_t *this, struct ios_global_stats *stats,
(1 << i), stats->block_count_write[i]);
}
- for (i = 0; i < GF_FOP_MAXVALUE; i++)
- if (stats->fop_hits[i])
+ for (i = 0; i < GF_FOP_MAXVALUE; i++) {
+ if (stats->fop_hits[i] && !stats->latency[i].avg)
+ ios_log (this, logfp, "%14s : %"PRId64,
+ gf_fop_list[i], stats->fop_hits[i]);
+ else if (stats->fop_hits[i] && stats->latency[i].avg)
ios_log (this, logfp, "%14s : %"PRId64 ", latency"
"(avg: %f, min: %f, max: %f)",
gf_fop_list[i], stats->fop_hits[i],
stats->latency[i].avg, stats->latency[i].min,
stats->latency[i].max);
-
+ }
return 0;
}
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index e63bc2002..0743ede23 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -25,6 +25,8 @@
#include "server.h"
#include "server-helpers.h"
+#include <fnmatch.h>
+
int
server_decode_groups (call_frame_t *frame, rpcsvc_request_t *req)
{
@@ -1299,3 +1301,59 @@ readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp)
return 0;
}
+
+int
+gf_server_check_getxattr_cmd (call_frame_t *frame, const char *key)
+{
+
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
+
+ conf = frame->this->private;
+ if (!conf)
+ return 0;
+
+ if (fnmatch ("*list*mount*point*", key, 0) == 0) {
+ /* list all the client protocol connecting to this process */
+ list_for_each_entry (xprt, &conf->xprt_list, list) {
+ gf_log ("mount-point-list", GF_LOG_INFO,
+ "%s", xprt->peerinfo.identifier);
+ }
+ }
+
+ /* Add more options/keys here */
+
+ return 0;
+}
+
+int
+gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict)
+{
+
+ data_pair_t *pair = NULL;
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
+ uint64_t total_read = 0;
+ uint64_t total_write = 0;
+
+ conf = frame->this->private;
+ if (!conf)
+ return 0;
+
+ for (pair = dict->members_list; pair; pair = pair->next) {
+ /* this exact key is used in 'io-stats' too.
+ * But this is better place for this information dump.
+ */
+ if (fnmatch ("*io*stat*dump", pair->key, 0) == 0) {
+ list_for_each_entry (xprt, &conf->xprt_list, list) {
+ total_read += xprt->total_bytes_read;
+ total_write += xprt->total_bytes_write;
+ }
+ gf_log ("stats", GF_LOG_INFO,
+ "total-read %"PRIu64", total-write %"PRIu64,
+ total_read, total_write);
+ }
+ }
+
+ return 0;
+}
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index 5786ae5b5..06f9beabb 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -204,4 +204,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
int xdr_to_glusterfs_req (rpcsvc_request_t *req, void *arg,
gfs_serialize_t sfunc);
+int gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict);
+int gf_server_check_getxattr_cmd (call_frame_t *frame, const char *name);
+
#endif /* !_SERVER_H */
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 1b0c407ee..aa633c65b 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -3420,6 +3420,9 @@ server_setxattr (rpcsvc_request_t *req)
state->dict = dict;
}
+ /* There can be some commands hidden in key, check and proceed */
+ gf_server_check_setxattr_cmd (frame, dict);
+
resolve_and_resume (frame, server_setxattr_resume);
return 0;
@@ -3718,6 +3721,9 @@ server_getxattr (rpcsvc_request_t *req)
if (args.namelen)
state->name = gf_strdup (args.name);
+ /* There can be some commands hidden in key, check and proceed */
+ gf_server_check_getxattr_cmd (frame, state->name);
+
resolve_and_resume (frame, server_getxattr_resume);
out:
return 0;