X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fllog_reader.c;h=dc7e43708c4a0771800e119e374e96e31e51be7a;hb=dd5c6382909db38546409051bdd7f683cf42486b;hp=d1fd956a3c95f8384f560372984a68dcac0637d3;hpb=665e36b780faa2144cecccd29a0d8a8196a76903;p=fs%2Flustre-release.git diff --git a/lustre/utils/llog_reader.c b/lustre/utils/llog_reader.c index d1fd956..dc7e437 100644 --- a/lustre/utils/llog_reader.c +++ b/lustre/utils/llog_reader.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,8 +24,10 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -167,16 +167,16 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog, recs_pr[i] = cur_rec; if (ext2_test_bit(idx, (*llog)->llh_bitmap)) { - if (le32_to_cpu(cur_rec->lrh_type) != OBD_CFG_REC) + if (le32_to_cpu(cur_rec->lrh_type) != OBD_CFG_REC) printf("rec #%d type=%x len=%u\n", idx, cur_rec->lrh_type, cur_rec->lrh_len); } else { printf("Bit %d of %d not set\n", idx, recs_num); - cur_rec->padding = CANCELLED; + cur_rec->lrh_id = CANCELLED; /* The header counts only set records */ i--; } - + ptr += le32_to_cpu(cur_rec->lrh_len); if ((ptr - file_buf) > file_size) { printf("The log is corrupt (too big at %d)\n", i); @@ -350,7 +350,10 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) } case(LCFG_SET_TIMEOUT):{ printf("set_timeout=%d ", lcfg->lcfg_num); - print_1_cfg(lcfg); + break; + } + case(LCFG_SET_LDLM_TIMEOUT):{ + printf("set_ldlm_timeout=%d ", lcfg->lcfg_num); break; } case(LCFG_SET_UPCALL):{ @@ -363,9 +366,15 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) print_1_cfg(lcfg); break; } + case(LCFG_SPTLRPC_CONF):{ + printf("sptlrpc_conf "); + print_1_cfg(lcfg); + break; + } case(LCFG_MARKER):{ struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1); char createtime[26], canceltime[26] = ""; + time_t time_tmp; if (marker->cm_flags & CM_SKIP) { if (marker->cm_flags & CM_START) { @@ -376,18 +385,39 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) *skip = 0; } } + if (marker->cm_flags & CM_EXCLUDE) { - if (marker->cm_flags & CM_START) + if (marker->cm_flags & CM_START) printf("EXCLUDE START "); else printf("EXCLUDE END "); } - ctime_r(&marker->cm_createtime, createtime); - createtime[strlen(createtime) - 1] = 0; + + /* Handle overflow of 32-bit time_t gracefully. + * The copy to time_tmp is needed in any case to + * keep the pointer happy, even on 64-bit systems. */ + time_tmp = marker->cm_createtime; + if (time_tmp == marker->cm_createtime) { + ctime_r(&time_tmp, createtime); + createtime[strlen(createtime) - 1] = 0; + } else { + strcpy(createtime, "in the distant future"); + } + if (marker->cm_canceltime) { - ctime_r(&marker->cm_canceltime, canceltime); - canceltime[strlen(canceltime) - 1] = 0; + /* Like cm_createtime, we try to handle overflow of + * 32-bit time_t gracefully. The copy to time_tmp + * is also needed on 64-bit systems to keep the + * pointer happy, see bug 16771 */ + time_tmp = marker->cm_canceltime; + if (time_tmp == marker->cm_canceltime) { + ctime_r(&time_tmp, canceltime); + canceltime[strlen(canceltime) - 1] = 0; + } else { + strcpy(canceltime, "in the distant future"); + } } + printf("marker %3d (flags=%#04x, v%d.%d.%d.%d) %-15s '%s' %s-%s", marker->cm_step, marker->cm_flags, OBD_OCD_VERSION_MAJOR(marker->cm_vers), @@ -429,16 +459,16 @@ void print_records(struct llog_rec_hdr **recs, int rec_number) { __u32 lopt; int i, skip = 0; - + for(i = 0; i < rec_number; i++) { printf("#%.2d (%.3d)", le32_to_cpu(recs[i]->lrh_index), le32_to_cpu(recs[i]->lrh_len)); lopt = le32_to_cpu(recs[i]->lrh_type); - if (recs[i]->padding == CANCELLED) + if (recs[i]->lrh_id == CANCELLED) printf("NOT SET "); - + if (lopt == OBD_CFG_REC) { struct lustre_cfg *lcfg; lcfg = (struct lustre_cfg *)((char*)(recs[i]) +