diff options
author | Amar Tumballi <amarts@redhat.com> | 2018-11-01 07:25:25 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-11-05 18:50:59 +0000 |
commit | 74e8328d3f6901d6ba38a313965fe910c8411324 (patch) | |
tree | 4816063d412cf9e436da301fccf165485bf22e18 | |
parent | 2effe3b0d3fa51fc627c970353de2e326bcf1ef2 (diff) |
all: fix the format string exceptions
Currently, there are possibilities in few places, where a user-controlled
(like filename, program parameter etc) string can be passed as 'fmt' for
printf(), which can lead to segfault, if the user's string contains '%s',
'%d' in it.
While fixing it, makes sense to make the explicit check for such issues
across the codebase, by making the format call properly.
Fixes: CVE-2018-14661
Fixes: bz#1644763
Change-Id: Ib547293f2d9eb618594cbff0df3b9c800e88bde4
Signed-off-by: Amar Tumballi <amarts@redhat.com>
40 files changed, 123 insertions, 117 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index af2cccca23c..4b5af6bd707 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -2861,7 +2861,7 @@ cli_launch_glfs_heal(int heal_op, dict_t *options) runner_add_args(&runner, "source-brick", NULL); runner_argprintf(&runner, "%s:%s", hostname, path); if (dict_get_str(options, "file", &filename) == 0) - runner_argprintf(&runner, filename); + runner_argprintf(&runner, "%s", filename); break; case GF_SHD_OP_SPLIT_BRAIN_FILES: runner_add_args(&runner, "split-brain-info", NULL); diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index 35e0beda8d6..586cbd84e5c 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -585,7 +585,8 @@ client_dump(client_t *client, char *prefix) if (!client) return; - gf_proc_dump_write("refcount", GF_PRI_ATOMIC, GF_ATOMIC_GET(client->count)); + gf_proc_dump_write("refcount", "%" GF_PRI_ATOMIC, + GF_ATOMIC_GET(client->count)); } void @@ -626,7 +627,7 @@ clienttable_dump(clienttable_t *clienttable, char *prefix) if (GF_CLIENTENTRY_ALLOCATED == clienttable->cliententries[i].next_free) { gf_proc_dump_build_key(key, prefix, "cliententry[%d]", i); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); cliententry_dump(&clienttable->cliententries[i], key); } } @@ -773,7 +774,7 @@ gf_client_dump_fdtables(xlator_t *this) gf_proc_dump_write(key, "%s", client->subdir_mount); } gf_proc_dump_build_key(key, "conn", "%d.ref", count); - gf_proc_dump_write(key, GF_PRI_ATOMIC, + gf_proc_dump_write(key, "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(client->count)); if (client->bound_xl) { gf_proc_dump_build_key(key, "conn", "%d.bound_xl", count); diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index d26b7097fd4..6c521317110 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -992,13 +992,14 @@ fd_dump(fd_t *fd, char *prefix) if (!fd) return; - gf_proc_dump_write("pid", "%llu", fd->pid); - gf_proc_dump_write("refcount", "%d", fd->refcount); + gf_proc_dump_write("pid", "%" PRIu64, fd->pid); + gf_proc_dump_write("refcount", "%" GF_PRI_ATOMIC, + GF_ATOMIC_GET(fd->refcount)); gf_proc_dump_write("flags", "%d", fd->flags); if (fd->inode) { gf_proc_dump_build_key(key, "inode", NULL); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); inode_dump(fd->inode, key); } } @@ -1040,7 +1041,7 @@ fdtable_dump(fdtable_t *fdtable, char *prefix) for (i = 0; i < fdtable->max_fds; i++) { if (GF_FDENTRY_ALLOCATED == fdtable->fdentries[i].next_free) { gf_proc_dump_build_key(key, prefix, "fdentry[%d]", i); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); fdentry_dump(&fdtable->fdentries[i], key); } } diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 538c7797c61..8bfd5c70db8 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -31,7 +31,7 @@ { \ gf_proc_dump_build_key(key_buf, key_prefix, "%s.%d", list_type, \ i++); \ - gf_proc_dump_add_section(key_buf); \ + gf_proc_dump_add_section("%s", key_buf); \ inode_dump(inode, key); \ } \ } @@ -2341,7 +2341,7 @@ inode_table_dump(inode_table_t *itable, char *prefix) } gf_proc_dump_build_key(key, prefix, "hashsize"); - gf_proc_dump_write(key, "%d", itable->hashsize); + gf_proc_dump_write(key, "%" GF_PRI_SIZET, itable->hashsize); gf_proc_dump_build_key(key, prefix, "name"); gf_proc_dump_write(key, "%s", itable->name); diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c index 8682420d8f8..c9e0ff35198 100644 --- a/libglusterfs/src/iobuf.c +++ b/libglusterfs/src/iobuf.c @@ -1068,7 +1068,7 @@ iobuf_info_dump(struct iobuf *iobuf, const char *key_prefix) UNLOCK(&iobuf->lock); gf_proc_dump_build_key(key, key_prefix, "ref"); - gf_proc_dump_write(key, "%d", my_iobuf.ref); + gf_proc_dump_write(key, "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(my_iobuf.ref)); gf_proc_dump_build_key(key, key_prefix, "ptr"); gf_proc_dump_write(key, "%p", my_iobuf.ptr); @@ -1094,13 +1094,13 @@ iobuf_arena_info_dump(struct iobuf_arena *iobuf_arena, const char *key_prefix) gf_proc_dump_build_key(key, key_prefix, "alloc_cnt"); gf_proc_dump_write(key, "%" PRIu64, iobuf_arena->alloc_cnt); gf_proc_dump_build_key(key, key_prefix, "max_active"); - gf_proc_dump_write(key, "%" PRIu64, iobuf_arena->max_active); + gf_proc_dump_write(key, "%d", iobuf_arena->max_active); gf_proc_dump_build_key(key, key_prefix, "page_size"); - gf_proc_dump_write(key, "%" PRIu64, iobuf_arena->page_size); + gf_proc_dump_write(key, "%" GF_PRI_SIZET, iobuf_arena->page_size); list_for_each_entry(trav, &iobuf_arena->active.list, list) { gf_proc_dump_build_key(key, key_prefix, "active_iobuf.%d", i++); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); iobuf_info_dump(trav, key); } @@ -1126,9 +1126,10 @@ iobuf_stats_dump(struct iobuf_pool *iobuf_pool) } gf_proc_dump_add_section("iobuf.global"); gf_proc_dump_write("iobuf_pool", "%p", iobuf_pool); - gf_proc_dump_write("iobuf_pool.default_page_size", "%d", + gf_proc_dump_write("iobuf_pool.default_page_size", "%" GF_PRI_SIZET, iobuf_pool->default_page_size); - gf_proc_dump_write("iobuf_pool.arena_size", "%d", iobuf_pool->arena_size); + gf_proc_dump_write("iobuf_pool.arena_size", "%" GF_PRI_SIZET, + iobuf_pool->arena_size); gf_proc_dump_write("iobuf_pool.arena_cnt", "%d", iobuf_pool->arena_cnt); gf_proc_dump_write("iobuf_pool.request_misses", "%" PRId64, iobuf_pool->request_misses); @@ -1137,21 +1138,21 @@ iobuf_stats_dump(struct iobuf_pool *iobuf_pool) list_for_each_entry(trav, &iobuf_pool->arenas[j], list) { snprintf(msg, sizeof(msg), "arena.%d", i); - gf_proc_dump_add_section(msg); + gf_proc_dump_add_section("%s", msg); iobuf_arena_info_dump(trav, msg); i++; } list_for_each_entry(trav, &iobuf_pool->purge[j], list) { snprintf(msg, sizeof(msg), "purge.%d", i); - gf_proc_dump_add_section(msg); + gf_proc_dump_add_section("%s", msg); iobuf_arena_info_dump(trav, msg); i++; } list_for_each_entry(trav, &iobuf_pool->filled[j], list) { snprintf(msg, sizeof(msg), "filled.%d", i); - gf_proc_dump_add_section(msg); + gf_proc_dump_add_section("%s", msg); iobuf_arena_info_dump(trav, msg); i++; } diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c index 2dc2a318216..afbb6dcad80 100644 --- a/libglusterfs/src/latency.c +++ b/libglusterfs/src/latency.c @@ -69,7 +69,7 @@ gf_proc_dump_latency_info(xlator_t *xl) int i; snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.latency", xl->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); for (i = 0; i < GF_FOP_MAXVALUE; i++) { gf_proc_dump_build_key(key, key_prefix, "%s", (char *)gf_fop_list[i]); diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index f2294488fae..859050d568b 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -183,7 +183,8 @@ _gf_log_callingfn(const char *domain, const char *file, const char *function, __attribute__((__format__(__printf__, 6, 7))); int -_gf_log_eh(const char *function, const char *fmt, ...); +_gf_log_eh(const char *function, const char *fmt, ...) + __attribute__((__format__(__printf__, 2, 3))); /* treat GF_LOG_TRACE and GF_LOG_NONE as LOG_DEBUG and * other level as is */ diff --git a/libglusterfs/src/mem-pool.h b/libglusterfs/src/mem-pool.h index af6b4decd2c..118170fd17f 100644 --- a/libglusterfs/src/mem-pool.h +++ b/libglusterfs/src/mem-pool.h @@ -93,7 +93,8 @@ int gf_vasprintf(char **string_ptr, const char *format, va_list arg); int -gf_asprintf(char **string_ptr, const char *format, ...); +gf_asprintf(char **string_ptr, const char *format, ...) + __attribute__((__format__(__printf__, 2, 3))); void __gf_free(void *ptr); diff --git a/libglusterfs/src/run.h b/libglusterfs/src/run.h index dd19972d07e..76af95fd27f 100644 --- a/libglusterfs/src/run.h +++ b/libglusterfs/src/run.h @@ -81,8 +81,8 @@ runner_add_args(runner_t *runner, ...); * @param format printf style format specifier */ void -runner_argprintf(runner_t *runner, const char *format, ...); - +runner_argprintf(runner_t *runner, const char *format, ...) + __attribute__((__format__(__printf__, 2, 3))); /** * log a message about the command to be run. * diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c index c8a3b792979..4b5d13c3fc8 100644 --- a/libglusterfs/src/stack.c +++ b/libglusterfs/src/stack.c @@ -148,7 +148,7 @@ gf_proc_dump_call_frame(call_frame_t *call_frame, const char *key_buf, ...) out: if (ret) { gf_proc_dump_write("Unable to dump the frame information", - "(Lock acquisition failed) %p", my_frame); + "(Lock acquisition failed)"); return; } } @@ -185,9 +185,9 @@ gf_proc_dump_call_stack(call_stack_t *call_stack, const char *key_buf, ...) gf_proc_dump_write("uid", "%d", call_stack->uid); gf_proc_dump_write("gid", "%d", call_stack->gid); gf_proc_dump_write("pid", "%d", call_stack->pid); - gf_proc_dump_write("unique", "%Ld", call_stack->unique); + gf_proc_dump_write("unique", "%" PRIu64, call_stack->unique); gf_proc_dump_write("lk-owner", "%s", lkowner_utoa(&call_stack->lk_owner)); - gf_proc_dump_write("ctime", "%lld.%" GF_PRI_SNSECONDS, + gf_proc_dump_write("ctime", "%" GF_PRI_SECOND ".%" GF_PRI_SNSECONDS, call_stack->tv.tv_sec, call_stack->tv.tv_nsec); if (call_stack->type == GF_OP_TYPE_FOP) @@ -224,7 +224,7 @@ gf_proc_dump_pending_frames(call_pool_t *call_pool) gf_proc_dump_add_section("global.callpool"); section_added = _gf_true; gf_proc_dump_write("callpool_address", "%p", call_pool); - gf_proc_dump_write("callpool.cnt", "%d", call_pool->cnt); + gf_proc_dump_write("callpool.cnt", "%" PRId64, call_pool->cnt); list_for_each_entry(trav, &call_pool->all_frames, all_frames) { diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index d0701e53a84..0f4a7102697 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -255,12 +255,13 @@ gf_proc_dump_xlator_mem_info_only_in_use(xlator_t *xl) gf_proc_dump_add_section("%s.%s - usage-type %d", xl->type, xl->name, i); - gf_proc_dump_write("size", "%u", xl->mem_acct->rec[i].size); - gf_proc_dump_write("max_size", "%u", xl->mem_acct->rec[i].max_size); + gf_proc_dump_write("size", "%" PRIu64, xl->mem_acct->rec[i].size); + gf_proc_dump_write("max_size", "%" PRIu64, + xl->mem_acct->rec[i].max_size); gf_proc_dump_write("num_allocs", "%u", xl->mem_acct->rec[i].num_allocs); gf_proc_dump_write("max_num_allocs", "%u", xl->mem_acct->rec[i].max_num_allocs); - gf_proc_dump_write("total_allocs", "%u", + gf_proc_dump_write("total_allocs", "%" PRIu64, xl->mem_acct->rec[i].total_allocs); } @@ -379,8 +380,8 @@ gf_proc_dump_mempool_info(glusterfs_ctx_t *ctx) gf_proc_dump_write("-----", "-----"); gf_proc_dump_write("pool-name", "%s", pool->name); gf_proc_dump_write("active-count", "%" GF_PRI_ATOMIC, active); - gf_proc_dump_write("sizeof-type", "%d", pool->sizeof_type); - gf_proc_dump_write("padded-sizeof", "%lu", + gf_proc_dump_write("sizeof-type", "%lu", pool->sizeof_type); + gf_proc_dump_write("padded-sizeof", "%d", 1 << pool->pool->power_of_two); gf_proc_dump_write("size", "%lu", (1 << pool->pool->power_of_two) * active); @@ -466,7 +467,7 @@ gf_proc_dump_dict_info(glusterfs_ctx_t *ctx) total_dicts = GF_ATOMIC_GET(ctx->stats.total_dicts_used); total_pairs = GF_ATOMIC_GET(ctx->stats.total_pairs_used); - gf_proc_dump_write("max-pairs-per-dict", "%u", + gf_proc_dump_write("max-pairs-per-dict", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ctx->stats.max_dict_pairs)); gf_proc_dump_write("total-pairs-used", "%lu", total_pairs); gf_proc_dump_write("total-dicts-used", "%lu", total_dicts); diff --git a/libglusterfs/src/statedump.h b/libglusterfs/src/statedump.h index 6c32c161ad3..af653041493 100644 --- a/libglusterfs/src/statedump.h +++ b/libglusterfs/src/statedump.h @@ -81,10 +81,12 @@ void gf_proc_dump_info(int signum, glusterfs_ctx_t *ctx); int -gf_proc_dump_add_section(char *key, ...); +gf_proc_dump_add_section(char *key, ...) + __attribute__((__format__(__printf__, 1, 2))); int -gf_proc_dump_write(char *key, char *value, ...); +gf_proc_dump_write(char *key, char *value, ...) + __attribute__((__format__(__printf__, 2, 3))); void inode_table_dump(inode_table_t *itable, char *prefix); diff --git a/rpc/rpc-lib/src/rpc-drc.c b/rpc/rpc-lib/src/rpc-drc.c index ff983b23fb4..50013776c86 100644 --- a/rpc/rpc-lib/src/rpc-drc.c +++ b/rpc/rpc-lib/src/rpc-drc.c @@ -564,10 +564,10 @@ rpcsvc_drc_priv(rpcsvc_drc_globals_t *drc) gf_proc_dump_write(key, "%d", drc->lru_factor); gf_proc_dump_build_key(key, "drc", "duplicate_request_count"); - gf_proc_dump_write(key, "%d", drc->cache_hits); + gf_proc_dump_write(key, "%" PRIu64, drc->cache_hits); gf_proc_dump_build_key(key, "drc", "in_transit_duplicate_requests"); - gf_proc_dump_write(key, "%d", drc->intransit_hits); + gf_proc_dump_write(key, "%" PRIu64, drc->intransit_hits); list_for_each_entry(client, &drc->clients_head, client_list) { diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 3a62df34aef..c27159a07af 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -4860,7 +4860,7 @@ afr_priv_dump(xlator_t *this) GF_ASSERT(priv); snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("child_count", "%u", priv->child_count); for (i = 0; i < priv->child_count; i++) { sprintf(key, "child_up[%d]", i); @@ -4897,7 +4897,7 @@ afr_priv_dump(xlator_t *this) gf_proc_dump_write("ta_child_up", "%d", priv->ta_child_up); gf_proc_dump_write("ta_bad_child_index", "%d", priv->ta_bad_child_index); - gf_proc_dump_write("ta_notify_dom_lock_offset", "%lld", + gf_proc_dump_write("ta_notify_dom_lock_offset", "%" PRId64, priv->ta_notify_dom_lock_offset); } diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c index 8cccbc86f0f..0a7aa15e242 100644 --- a/xlators/cluster/dht/src/dht-shared.c +++ b/xlators/cluster/dht/src/dht-shared.c @@ -158,7 +158,7 @@ dht_priv_dump(xlator_t *this) gf_proc_dump_write(key, "%lf", conf->du_stats[i].avail_inodes); snprintf(key, sizeof(key), "du_stats[%d].log", i); - gf_proc_dump_write(key, "%lu", conf->du_stats[i].log); + gf_proc_dump_write(key, "%" PRIu32, conf->du_stats[i].log); } } diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index 00c374e7ca3..b56dd9ada3e 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -1380,7 +1380,7 @@ ec_dump_private(xlator_t *this) GF_ASSERT(ec); snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("up", "%u", ec->up); gf_proc_dump_write("nodes", "%u", ec->nodes); gf_proc_dump_write("redundancy", "%u", ec->redundancy); @@ -1400,21 +1400,21 @@ ec_dump_private(xlator_t *this) snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s.stats.stripe_cache", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); - gf_proc_dump_write("hits", "%llu", + gf_proc_dump_write("hits", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ec->stats.stripe_cache.hits)); - gf_proc_dump_write("misses", "%llu", + gf_proc_dump_write("misses", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ec->stats.stripe_cache.misses)); - gf_proc_dump_write("updates", "%llu", + gf_proc_dump_write("updates", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ec->stats.stripe_cache.updates)); - gf_proc_dump_write("invalidations", "%llu", + gf_proc_dump_write("invalidations", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ec->stats.stripe_cache.invals)); - gf_proc_dump_write("evicts", "%llu", + gf_proc_dump_write("evicts", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ec->stats.stripe_cache.evicts)); - gf_proc_dump_write("allocations", "%llu", + gf_proc_dump_write("allocations", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ec->stats.stripe_cache.allocs)); - gf_proc_dump_write("errors", "%llu", + gf_proc_dump_write("errors", "%" GF_PRI_ATOMIC, GF_ATOMIC_GET(ec->stats.stripe_cache.errors)); return 0; diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index ad8ca088777..0aca3a9a5bb 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -77,7 +77,7 @@ dump_history_trace(circular_buffer_t *cb, void *data) ".%" GF_PRI_SUSECONDS, cb->tv.tv_usec); gf_proc_dump_write("TIME", "%s", timestr); - gf_proc_dump_write("FOP", "%s\n", cb->data); + gf_proc_dump_write("FOP", "%s\n", (char *)cb->data); return 0; } @@ -3218,7 +3218,7 @@ trace_dump_history(xlator_t *this) // Is it ok to return silently if log-history option his off? if (conf && conf->log_history == _gf_true) { gf_proc_dump_build_key(key_prefix, "xlator.debug.trace", "history"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); eh_dump(this->history, NULL, dump_history_trace); } ret = 0; diff --git a/xlators/experimental/jbr-client/src/jbrc.c b/xlators/experimental/jbr-client/src/jbrc.c index 01c3020e117..28801ecc99f 100644 --- a/xlators/experimental/jbr-client/src/jbrc.c +++ b/xlators/experimental/jbr-client/src/jbrc.c @@ -283,7 +283,7 @@ jbrc_priv_dump(xlator_t *this) GF_VALIDATE_OR_GOTO(this->name, priv, out); snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("up_children", "%u", priv->up_children); diff --git a/xlators/features/barrier/src/barrier.c b/xlators/features/barrier/src/barrier.c index edecae1a55e..1c5c5ffdc22 100644 --- a/xlators/features/barrier/src/barrier.c +++ b/xlators/features/barrier/src/barrier.c @@ -721,7 +721,7 @@ __barrier_dump_queue(barrier_priv_t *priv) list_for_each_entry(stub, &priv->queue, list) { snprintf(key, sizeof(key), "stub.%d", i++); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); barrier_dump_stub(stub, key); } @@ -745,7 +745,7 @@ barrier_dump_priv(xlator_t *this) return 0; gf_proc_dump_build_key(key, "xlator.features.barrier", "priv"); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); LOCK(&priv->lock); { diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 68768eebf4e..0cf7870856b 100644 --- a/xlators/features/gfid-access/src/gfid-access.c +++ b/xlators/features/gfid-access/src/gfid-access.c @@ -1365,7 +1365,7 @@ ga_dump_inodectx(xlator_t *this, inode_t *inode) if (ret == 0) { tmp_inode = (void *)(uintptr_t)value; gf_proc_dump_build_key(key_prefix, this->name, "inode"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("real-gfid", "%s", uuid_utoa(tmp_inode->gfid)); } diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index f08a22d4fc3..17f733a720e 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -3224,7 +3224,7 @@ __dump_entrylks(pl_inode_t *pl_inode) lock->connection_id, blocked, granted); } - gf_proc_dump_write(key, tmp); + gf_proc_dump_write(key, "%s", tmp); count++; } @@ -3242,7 +3242,7 @@ __dump_entrylks(pl_inode_t *pl_inode) lkowner_utoa(&lock->owner), lock->client, lock->connection_id, blocked); - gf_proc_dump_write(key, tmp); + gf_proc_dump_write(key, "%s", tmp); count++; } @@ -3286,7 +3286,7 @@ __dump_inodelks(pl_inode_t *pl_inode) lock->client, lock->connection_id, &lock->granted_time.tv_sec, &lock->blkd_time.tv_sec, _gf_true); - gf_proc_dump_write(key, tmp); + gf_proc_dump_write(key, "%s", tmp); count++; } @@ -3299,7 +3299,7 @@ __dump_inodelks(pl_inode_t *pl_inode) pl_dump_lock(tmp, sizeof(tmp), &lock->user_flock, &lock->owner, lock->client, lock->connection_id, 0, &lock->blkd_time.tv_sec, _gf_false); - gf_proc_dump_write(key, tmp); + gf_proc_dump_write(key, "%s", tmp); count++; } @@ -3334,7 +3334,7 @@ __dump_posixlks(pl_inode_t *pl_inode) lock->client, NULL, &lock->granted_time.tv_sec, &lock->blkd_time.tv_sec, (lock->blocked) ? _gf_false : _gf_true); - gf_proc_dump_write(key, tmp); + gf_proc_dump_write(key, "%s", tmp); count++; } diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 0b81e370e43..eb461f4ad22 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -5125,7 +5125,7 @@ quota_priv_dump(xlator_t *this) if (!priv) goto out; - gf_proc_dump_add_section("xlators.features.quota.priv", this->name); + gf_proc_dump_add_section("xlators.features.quota.priv"); ret = TRY_LOCK(&priv->lock); if (ret) diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 79804bdeadd..b63236884d3 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -6759,12 +6759,12 @@ shard_priv_dump(xlator_t *this) priv = this->private; snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); str = gf_uint64_2human_readable(priv->block_size); gf_proc_dump_write("shard-block-size", "%s", str); gf_proc_dump_write("inode-count", "%d", priv->inode_count); gf_proc_dump_write("ilist_head", "%p", &priv->ilist_head); - gf_proc_dump_write("lru-max-limit", "%d", priv->lru_limit); + gf_proc_dump_write("lru-max-limit", "%" PRIu64, priv->lru_limit); GF_FREE(str); diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 014d3d55b98..fd500ca606e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -2173,7 +2173,7 @@ glusterd_op_stage_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict) gf_asprintf(op_errstr, "Hard-limit " "value out of range (0 - %" PRId64 "): %s", - hard_limit_str); + hard_limit, hard_limit_str); else gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_CONVERSION_FAILED, diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 3046cc40f06..f90d3de9843 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -304,7 +304,7 @@ glusterd_handle_defrag_start(glusterd_volinfo_t *volinfo, char *op_errstr, runner_add_arg(&runner, "--pid-file"); runner_argprintf(&runner, "%s", pidfile); runner_add_arg(&runner, "-l"); - runner_argprintf(&runner, logfile); + runner_argprintf(&runner, "%s", logfile); if (volinfo->memory_accounting) runner_add_arg(&runner, "--mem-accounting"); if (dict_get_strn(priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY, diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.c b/xlators/mgmt/glusterd/src/glusterd-statedump.c index 1d10c629ed0..8c2786cb3f7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-statedump.c +++ b/xlators/mgmt/glusterd/src/glusterd-statedump.c @@ -180,7 +180,7 @@ glusterd_dump_priv(xlator_t *this) return 0; gf_proc_dump_build_key(key, "xlator.glusterd", "priv"); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); pthread_mutex_lock(&priv->mutex); { diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index d34f77cb7c1..75b91a43fb1 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -5290,7 +5290,7 @@ fuse_priv_dump(xlator_t *this) gf_proc_dump_write("proto_minor", "%u", private->proto_minor); gf_proc_dump_write("volfile", "%s", private->volfile ? private->volfile : "None"); - gf_proc_dump_write("volfile_size", "%d", private->volfile_size); + gf_proc_dump_write("volfile_size", "%" GF_PRI_SIZET, private->volfile_size); gf_proc_dump_write("mount_point", "%s", private->mount_point); gf_proc_dump_write("fuse_thread_started", "%d", (int)private->fuse_thread_started); @@ -5324,7 +5324,7 @@ fuse_history_dump(xlator_t *this) GF_VALIDATE_OR_GOTO(this->name, this->history, out); gf_proc_dump_build_key(key_prefix, "xlator.mount.fuse", "history"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); eh_dump(this->history, NULL, dump_history_fuse); ret = 0; @@ -5345,7 +5345,7 @@ dump_history_fuse(circular_buffer_t *cb, void *data) ".%" GF_PRI_SUSECONDS, cb->tv.tv_usec); gf_proc_dump_write("TIME", "%s", timestr); - gf_proc_dump_write("message", "%s\n", cb->data); + gf_proc_dump_write("message", "%s\n", (char *)cb->data); return 0; } diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 6ffad7d1a64..380ba876cba 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -1868,7 +1868,7 @@ __ioc_page_dump(ioc_page_t *page, char *prefix) goto out; { gf_proc_dump_write("offset", "%" PRId64, page->offset); - gf_proc_dump_write("size", "%" PRId64, page->size); + gf_proc_dump_write("size", "%" GF_PRI_SIZET, page->size); gf_proc_dump_write("dirty", "%s", page->dirty ? "yes" : "no"); gf_proc_dump_write("ready", "%s", page->ready ? "yes" : "no"); ioc_page_waitq_dump(page, prefix); @@ -1962,7 +1962,7 @@ ioc_inode_dump(xlator_t *this, inode_t *inode) if (gf_uuid_is_null(ioc_inode->inode->gfid)) goto unlock; - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); section_added = _gf_true; __inode_path(ioc_inode->inode, NULL, &path); @@ -1985,7 +1985,7 @@ unlock: out: if (ret && ioc_inode) { if (section_added == _gf_false) - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("Unable to print the status of ioc_inode", "(Lock acquisition failed) %s", uuid_utoa(inode->gfid)); @@ -2009,7 +2009,7 @@ ioc_priv_dump(xlator_t *this) priv = this->private; gf_proc_dump_build_key(key_prefix, "io-cache", "priv"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); add_section = _gf_true; ret = pthread_mutex_trylock(&priv->table_lock); @@ -2021,8 +2021,8 @@ ioc_priv_dump(xlator_t *this) gf_proc_dump_write("cache_used", "%ld", priv->cache_used); gf_proc_dump_write("inode_count", "%u", priv->inode_count); gf_proc_dump_write("cache_timeout", "%u", priv->cache_timeout); - gf_proc_dump_write("min-file-size", "%u", priv->min_file_size); - gf_proc_dump_write("max-file-size", "%u", priv->max_file_size); + gf_proc_dump_write("min-file-size", "%" PRIu64, priv->min_file_size); + gf_proc_dump_write("max-file-size", "%" PRIu64, priv->max_file_size); } pthread_mutex_unlock(&priv->table_lock); out: @@ -2032,7 +2032,7 @@ out: "xlator." "performance.io-cache", "priv"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); } gf_proc_dump_write( "Unable to dump the state of private " diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 7f1a34676d9..80d42ded5eb 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -937,7 +937,7 @@ iot_priv_dump(xlator_t *this) snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("maximum_threads_count", "%d", conf->max_count); gf_proc_dump_write("current_threads_count", "%d", conf->curr_count); diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 700666957c1..bf4b6399549 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -3063,7 +3063,7 @@ mdc_priv_dump(xlator_t *this) conf = this->private; snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("stat_hit_count", "%" PRId64, GF_ATOMIC_GET(conf->mdc_counter.stat_hit)); diff --git a/xlators/performance/nl-cache/src/nl-cache-helper.c b/xlators/performance/nl-cache/src/nl-cache-helper.c index f2954a83228..279c023a5b1 100644 --- a/xlators/performance/nl-cache/src/nl-cache-helper.c +++ b/xlators/performance/nl-cache/src/nl-cache-helper.c @@ -1161,7 +1161,7 @@ nlc_dump_inodectx(xlator_t *this, inode_t *inode) if (!ret) { gf_proc_dump_build_key(key_prefix, "xlator.performance.nl-cache", "nlc_inode"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); __inode_path(inode, NULL, &path); if (path != NULL) { @@ -1176,14 +1176,14 @@ nlc_dump_inodectx(xlator_t *this, inode_t *inode) gf_proc_dump_write("state", "%" PRIu64, nlc_ctx->state); gf_proc_dump_write("timer", "%p", nlc_ctx->timer); - gf_proc_dump_write("cache-time", "%lld", nlc_ctx->cache_time); + gf_proc_dump_write("cache-time", "%" GF_PRI_TIME, nlc_ctx->cache_time); gf_proc_dump_write("cache-size", "%zu", nlc_ctx->cache_size); gf_proc_dump_write("refd-inodes", "%" PRIu64, nlc_ctx->refd_inodes); if (IS_PE_VALID(nlc_ctx->state)) list_for_each_entry_safe(pe, tmp, &nlc_ctx->pe, list) { - gf_proc_dump_write("pe", "%p, %s", pe, pe->inode, pe->name); + gf_proc_dump_write("pe", "%p, %p, %s", pe, pe->inode, pe->name); } if (IS_NE_VALID(nlc_ctx->state)) diff --git a/xlators/performance/nl-cache/src/nl-cache.c b/xlators/performance/nl-cache/src/nl-cache.c index efa54ee346b..02d6df55349 100644 --- a/xlators/performance/nl-cache/src/nl-cache.c +++ b/xlators/performance/nl-cache/src/nl-cache.c @@ -588,7 +588,7 @@ nlc_priv_dump(xlator_t *this) conf = this->private; snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("negative_lookup_hit_count", "%" PRId64, GF_ATOMIC_GET(conf->nlc_counter.nlc_hit)); diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c index 8021fd07a2e..6164b3b046d 100644 --- a/xlators/performance/open-behind/src/open-behind.c +++ b/xlators/performance/open-behind/src/open-behind.c @@ -1130,7 +1130,7 @@ ob_priv_dump(xlator_t *this) gf_proc_dump_build_key(key_prefix, "xlator.performance.open-behind", "priv"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("use_anonymous_fd", "%d", conf->use_anonymous_fd); @@ -1160,14 +1160,14 @@ ob_fdctx_dump(xlator_t *this, fd_t *fd) gf_proc_dump_build_key(key_prefix, "xlator.performance.open-behind", "file"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("fd", "%p", fd); gf_proc_dump_write("open_frame", "%p", ob_fd->open_frame); if (ob_fd->open_frame) - gf_proc_dump_write("open_frame.root.unique", "%p", + gf_proc_dump_write("open_frame.root.unique", "%" PRIu64, ob_fd->open_frame->root->unique); gf_proc_dump_write("loc.path", "%s", ob_fd->loc.path); diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 21734607390..ea61a2ec302 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -1044,7 +1044,7 @@ qr_inodectx_dump(xlator_t *this, inode_t *inode) gf_proc_dump_build_key(key_prefix, "xlator.performance.quick-read", "inodectx"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("entire-file-cached", "%s", qr_inode->data ? "yes" : "no"); @@ -1088,9 +1088,9 @@ qr_priv_dump(xlator_t *this) gf_proc_dump_build_key(key_prefix, "xlator.performance.quick-read", "priv"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); - gf_proc_dump_write("max_file_size", "%d", conf->max_file_size); + gf_proc_dump_write("max_file_size", "%" PRIu64, conf->max_file_size); gf_proc_dump_write("cache_timeout", "%d", conf->cache_timeout); if (!table) { @@ -1106,11 +1106,13 @@ qr_priv_dump(xlator_t *this) } gf_proc_dump_write("total_files_cached", "%d", file_count); - gf_proc_dump_write("total_cache_used", "%d", total_size); - gf_proc_dump_write("cache-hit", "%" PRId64, priv->qr_counter.cache_hit); - gf_proc_dump_write("cache-miss", "%" PRId64, priv->qr_counter.cache_miss); - gf_proc_dump_write("cache-invalidations", "%" PRId64, - priv->qr_counter.file_data_invals); + gf_proc_dump_write("total_cache_used", "%" PRIu64, total_size); + gf_proc_dump_write("cache-hit", "%" GF_PRI_ATOMIC, + GF_ATOMIC_GET(priv->qr_counter.cache_hit)); + gf_proc_dump_write("cache-miss", "%" GF_PRI_ATOMIC, + GF_ATOMIC_GET(priv->qr_counter.cache_miss)); + gf_proc_dump_write("cache-invalidations", "%" GF_PRI_ATOMIC, + GF_ATOMIC_GET(priv->qr_counter.file_data_invals)); out: return 0; diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 2fdb56479ab..c62bd1bb172 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -744,7 +744,7 @@ ra_page_dump(struct ra_page *page) gf_proc_dump_write("offset", "%" PRId64, page->offset); - gf_proc_dump_write("size", "%" PRId64, page->size); + gf_proc_dump_write("size", "%" GF_PRI_SIZET, page->size); gf_proc_dump_write("dirty", "%s", page->dirty ? "yes" : "no"); @@ -770,9 +770,6 @@ ra_fdctx_dump(xlator_t *this, fd_t *fd) int32_t ret = 0, i = 0; uint64_t tmp_file = 0; char *path = NULL; - char key[GF_DUMP_MAX_BUF_LEN] = { - 0, - }; char key_prefix[GF_DUMP_MAX_BUF_LEN] = { 0, }; @@ -787,7 +784,7 @@ ra_fdctx_dump(xlator_t *this, fd_t *fd) gf_proc_dump_build_key(key_prefix, "xlator.performance.read-ahead", "file"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); ret = __inode_path(fd->inode, NULL, &path); if (path != NULL) { @@ -812,8 +809,7 @@ ra_fdctx_dump(xlator_t *this, fd_t *fd) file->offset); for (page = file->pages.next; page != &file->pages; page = page->next) { - sprintf(key, "page[%d]", i); - gf_proc_dump_write(key, "%p", page[i++]); + gf_proc_dump_write("page", "%d: %p", i++, (void *)page); ra_page_dump(page); } @@ -1040,14 +1036,14 @@ ra_priv_dump(xlator_t *this) gf_proc_dump_build_key(key_prefix, "xlator.performance.read-ahead", "priv"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); add_section = _gf_true; ret = pthread_mutex_trylock(&conf->conf_lock); if (ret) goto out; { - gf_proc_dump_write("page_size", "%d", conf->page_size); + gf_proc_dump_write("page_size", "%" PRIu64, conf->page_size); gf_proc_dump_write("page_count", "%d", conf->page_count); gf_proc_dump_write("force_atime_update", "%d", conf->force_atime_update); @@ -1058,7 +1054,7 @@ ra_priv_dump(xlator_t *this) out: if (ret && conf) { if (add_section == _gf_false) - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("Unable to dump priv", "(Lock acquisition failed) %s", this->name); diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 473c8e9320a..b46a42f300f 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -2843,10 +2843,10 @@ wb_priv_dump(xlator_t *this) gf_proc_dump_build_key(key_prefix, "xlator.performance.write-behind", "priv"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); - gf_proc_dump_write("aggregate_size", "%d", conf->aggregate_size); - gf_proc_dump_write("window_size", "%d", conf->window_size); + gf_proc_dump_write("aggregate_size", "%" PRIu64, conf->aggregate_size); + gf_proc_dump_write("window_size", "%" PRIu64, conf->window_size); gf_proc_dump_write("flush_behind", "%d", conf->flush_behind); gf_proc_dump_write("trickling_writes", "%d", conf->trickling_writes); @@ -2873,7 +2873,7 @@ __wb_dump_requests(struct list_head *head, char *prefix) gf_proc_dump_build_key(key_prefix, key, "%s", (char *)gf_fop_list[req->fop]); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); gf_proc_dump_write("unique", "%" PRIu64, req->unique); @@ -2884,7 +2884,7 @@ __wb_dump_requests(struct list_head *head, char *prefix) else gf_proc_dump_write("wound", "no"); - gf_proc_dump_write("generation-number", "%d", req->gen); + gf_proc_dump_write("generation-number", "%" PRIu64, req->gen); gf_proc_dump_write("req->op_ret", "%d", req->op_ret); gf_proc_dump_write("req->op_errno", "%d", req->op_errno); @@ -2946,7 +2946,7 @@ wb_inode_dump(xlator_t *this, inode_t *inode) gf_proc_dump_build_key(key_prefix, "xlator.performance.write-behind", "wb_inode"); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); __inode_path(inode, NULL, &path); if (path != NULL) { diff --git a/xlators/playground/template/src/template.c b/xlators/playground/template/src/template.c index 4a9e8d2e6f3..e96374e0302 100644 --- a/xlators/playground/template/src/template.c +++ b/xlators/playground/template/src/template.c @@ -50,7 +50,7 @@ template_priv(xlator_t *this) template_private_t *priv = NULL; priv = this->private; - gf_proc_dump_write("template.dummy", "%lu", priv->dummy); + gf_proc_dump_write("template.dummy", "%" PRId32, priv->dummy); return 0; } diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index ffb0a6df656..c5bf28dcfb6 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2796,13 +2796,13 @@ client_priv_dump(xlator_t *this) gf_proc_dump_build_key(key_prefix, "xlator.protocol.client", "%s.priv", this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); pthread_spin_lock(&conf->fd_lock); list_for_each_entry(tmp, &conf->saved_fds, sfd_pos) { sprintf(key, "fd.%d.remote_fd", i); - gf_proc_dump_write(key, "%d", tmp->remote_fd); + gf_proc_dump_write(key, "%" PRId64, tmp->remote_fd); client_fd_lk_ctx_dump(this, tmp->lk_ctx, i); i++; } diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 4ec6fe8049a..8416b42b659 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -247,7 +247,7 @@ server_priv(xlator_t *this) return 0; gf_proc_dump_build_key(key, "xlator.protocol.server", "priv"); - gf_proc_dump_add_section(key); + gf_proc_dump_add_section("%s", key); ret = pthread_mutex_trylock(&conf->mutex); if (ret != 0) diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c index 03cb532e2c5..3642d475cb5 100644 --- a/xlators/storage/posix/src/posix-common.c +++ b/xlators/storage/posix/src/posix-common.c @@ -112,7 +112,7 @@ posix_priv(xlator_t *this) (void)snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name); - gf_proc_dump_add_section(key_prefix); + gf_proc_dump_add_section("%s", key_prefix); if (!this) return 0; @@ -124,8 +124,8 @@ posix_priv(xlator_t *this) gf_proc_dump_write("base_path", "%s", priv->base_path); gf_proc_dump_write("base_path_length", "%d", priv->base_path_length); - gf_proc_dump_write("max_read", "%d", priv->read_value); - gf_proc_dump_write("max_write", "%d", priv->write_value); + gf_proc_dump_write("max_read", "%" PRId64, priv->read_value); + gf_proc_dump_write("max_write", "%" PRId64, priv->write_value); gf_proc_dump_write("nr_files", "%ld", priv->nr_files); return 0; |