summaryrefslogtreecommitdiffstats
path: root/xlators/debug
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-09-06 05:41:51 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-06 09:37:25 -0700
commitd48378e4971b6b75f328923054959f6dc4dd89f6 (patch)
tree4622df4368adfa257c2d8386a91f1a3529ab29a4 /xlators/debug
parentf5b97620b10fff73693fbe8e7f98226b837cf5f9 (diff)
debug/trace: use uint64_t variable while using localtime.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 737 (uint32_t ia_atime crashes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=737
Diffstat (limited to 'xlators/debug')
-rw-r--r--xlators/debug/trace/src/trace.c173
1 files changed, 113 insertions, 60 deletions
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index f3f2fe2e185..32a3869e6df 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -62,18 +62,24 @@ int trace_log_level = GF_LOG_NORMAL;
static char *
trace_stat_to_str (struct iatt *stbuf)
{
- char *statstr = NULL;
- char atime_buf[256] = {0,};
- char mtime_buf[256] = {0,};
- char ctime_buf[256] = {0,};
- int asprint_ret_value = 0;
-
+ char *statstr = NULL;
+ char atime_buf[256] = {0,};
+ char mtime_buf[256] = {0,};
+ char ctime_buf[256] = {0,};
+ int asprint_ret_value = 0;
+ uint64_t ia_time = 0;
+
+ ia_time = stbuf->ia_atime;
strftime (atime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&stbuf->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = stbuf->ia_mtime;
strftime (mtime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&stbuf->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = stbuf->ia_ctime;
strftime (ctime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&stbuf->ia_ctime));
+ localtime ((time_t *)&ia_time));
asprint_ret_value = gf_asprintf (&statstr,
"ia_ino=%"PRIu64", ia_gen=%"PRIu64
@@ -156,19 +162,24 @@ int
trace_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *buf)
{
- char atime_buf[256];
- char mtime_buf[256];
- char ctime_buf[256];
-
+ uint64_t ia_time = 0;
+ char atime_buf[256];
+ char mtime_buf[256];
+ char ctime_buf[256];
if (trace_fop_names[GF_FOP_STAT].enabled) {
if (op_ret >= 0) {
+ ia_time = buf->ia_atime;
strftime (atime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = buf->ia_mtime;
strftime (mtime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = buf->ia_ctime;
strftime (ctime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_ctime));
+ localtime ((time_t *)&ia_time));
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, buf {ia_gen=%"PRIu64", "
@@ -198,18 +209,24 @@ trace_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iovec *vector,
int32_t count, struct iatt *buf, struct iobref *iobref)
{
- char atime_buf[256];
- char mtime_buf[256];
- char ctime_buf[256];
+ uint64_t ia_time = 0;
+ char atime_buf[256];
+ char mtime_buf[256];
+ char ctime_buf[256];
if (trace_fop_names[GF_FOP_READ].enabled) {
if (op_ret >= 0) {
+ ia_time = buf->ia_atime;
strftime (atime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = buf->ia_mtime;
strftime (mtime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = buf->ia_ctime;
strftime (ctime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_ctime));
+ localtime ((time_t *)&ia_time));
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, op_errno=%d, *buf {ia_gen=%"PRIu64", "
@@ -346,28 +363,39 @@ trace_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost)
{
- char atime_pre[256] = {0,};
- char mtime_pre[256] = {0,};
- char ctime_pre[256] = {0,};
- char atime_post[256] = {0,};
- char mtime_post[256] = {0,};
- char ctime_post[256] = {0,};
+ uint64_t ia_time = 0;
+ char atime_pre[256] = {0,};
+ char mtime_pre[256] = {0,};
+ char ctime_pre[256] = {0,};
+ char atime_post[256] = {0,};
+ char mtime_post[256] = {0,};
+ char ctime_post[256] = {0,};
if (trace_fop_names[GF_FOP_SETATTR].enabled) {
if (op_ret >= 0) {
+ ia_time = statpre->ia_atime;
strftime (atime_pre, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpre->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpre->ia_mtime;
strftime (mtime_pre, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpre->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpre->ia_ctime;
strftime (ctime_pre, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpre->ia_ctime));
+ localtime ((time_t *)&ia_time));
+ ia_time = statpost->ia_atime;
strftime (atime_post, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpost->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpost->ia_mtime;
strftime (mtime_post, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpost->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpost->ia_ctime;
strftime (ctime_post, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpost->ia_ctime));
+ localtime ((time_t *)&ia_time));
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, *statpre "
@@ -401,28 +429,39 @@ trace_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost)
{
- char atime_pre[256] = {0,};
- char mtime_pre[256] = {0,};
- char ctime_pre[256] = {0,};
- char atime_post[256] = {0,};
- char mtime_post[256] = {0,};
- char ctime_post[256] = {0,};
+ uint64_t ia_time = 0;
+ char atime_pre[256] = {0,};
+ char mtime_pre[256] = {0,};
+ char ctime_pre[256] = {0,};
+ char atime_post[256] = {0,};
+ char mtime_post[256] = {0,};
+ char ctime_post[256] = {0,};
if (trace_fop_names[GF_FOP_FSETATTR].enabled) {
if (op_ret >= 0) {
+ ia_time = statpre->ia_atime;
strftime (atime_pre, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpre->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpre->ia_mtime;
strftime (mtime_pre, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpre->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpre->ia_ctime;
strftime (ctime_pre, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpre->ia_ctime));
+ localtime ((time_t *)&ia_time));
+ ia_time = statpost->ia_atime;
strftime (atime_post, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpost->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpost->ia_mtime;
strftime (mtime_post, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpost->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = statpost->ia_ctime;
strftime (ctime_post, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&statpost->ia_ctime));
+ localtime ((time_t *)&ia_time));
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, *statpre "
@@ -1038,18 +1077,24 @@ int
trace_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *buf)
{
- char atime_buf[256];
- char mtime_buf[256];
- char ctime_buf[256];
+ uint64_t ia_time = 0;
+ char atime_buf[256] = {0, };
+ char mtime_buf[256] = {0, };
+ char ctime_buf[256] = {0, };
if (trace_fop_names[GF_FOP_FSTAT].enabled) {
if (op_ret >= 0) {
+ ia_time = buf->ia_atime;
strftime (atime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = buf->ia_mtime;
strftime (mtime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_mtime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = buf->ia_ctime;
strftime (ctime_buf, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&buf->ia_ctime));
+ localtime ((time_t *)&ia_time));
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (op_ret=%d, *buf {ia_gen=%"PRIu64", "
@@ -1465,8 +1510,9 @@ int
trace_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
struct iatt *stbuf, int32_t valid)
{
- char actime_str[256] = {0,};
- char modtime_str[256] = {0,};
+ uint64_t ia_time = 0;
+ char actime_str[256] = {0,};
+ char modtime_str[256] = {0,};
if (trace_fop_names[GF_FOP_SETATTR].enabled) {
if (valid & GF_SET_ATTR_MODE) {
@@ -1486,10 +1532,13 @@ trace_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
}
if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) {
+ ia_time = stbuf->ia_atime;
strftime (actime_str, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&stbuf->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = stbuf->ia_mtime;
strftime (modtime_str, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&stbuf->ia_mtime));
+ localtime ((time_t *)&ia_time));
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (loc {path=%s, ino=%"PRIu64"}, "
@@ -1512,8 +1561,9 @@ int
trace_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iatt *stbuf, int32_t valid)
{
- char actime_str[256] = {0,};
- char modtime_str[256] = {0,};
+ uint64_t ia_time = 0;
+ char actime_str[256] = {0,};
+ char modtime_str[256] = {0,};
if (trace_fop_names[GF_FOP_FSETATTR].enabled) {
if (valid & GF_SET_ATTR_MODE) {
@@ -1531,10 +1581,13 @@ trace_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
}
if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) {
+ ia_time = stbuf->ia_atime;
strftime (actime_str, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&stbuf->ia_atime));
+ localtime ((time_t *)&ia_time));
+
+ ia_time = stbuf->ia_mtime;
strftime (modtime_str, 256, "[%b %d %H:%M:%S]",
- localtime ((time_t *)&stbuf->ia_mtime));
+ localtime ((time_t *)&ia_time));
gf_log (this->name, GF_LOG_NORMAL,
"%"PRId64": (*fd=%p"