From: robert.read Date: Tue, 21 Oct 2008 22:36:59 +0000 (+0000) Subject: Branch b1_6 X-Git-Tag: GIT_EPOCH_B_RELEASE_1_6_7~2^3~155 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ddf16c888885e36d80c010729e91a63d0ebd65ef;p=fs%2Flustre-release.git Branch b1_6 b=1819 i=adilger i=nathan Add an import file to the osc, mdc, and mgc proc dir, and include test for new proc file. --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index a0bd3d0..7a20a8f 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -41,6 +41,13 @@ tbd Sun Microsystems, Inc. 16929. Severity : enhancement +Bugzilla : 1819 +Description: Add /proc entry for import status +Details : The mdc, osc, and mgc import directories now have + an import directory that contains useful import data for debugging + connection problems. + +Severity : enhancement Bugzilla : 15966 Description: Re-disable certain /proc logging Details : Enable and disable client's offset_stats, extents_stats and diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index e5c0138..32579d8 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -446,6 +446,8 @@ extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off, int count, int *eof, void *data); extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count, int *eof, void *data); +extern int lprocfs_rd_import(char *page, char **start, off_t off, int count, + int *eof, void *data); extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off, int count, int *eof, void *data); extern int lprocfs_rd_num_exports(char *page, char **start, off_t off, @@ -730,6 +732,8 @@ static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off, static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; } +static inline int lprocfs_rd_import(char *page, char **start, off_t off, int count, + int *eof, void *data) { return 0; } static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; } diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index 81f8af2..accb538 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -91,6 +91,7 @@ static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { { "max_rpcs_in_flight", mdc_rd_max_rpcs_in_flight, mdc_wr_max_rpcs_in_flight, 0 }, { "timeouts", lprocfs_rd_timeouts, 0, 0 }, + { "import", lprocfs_rd_import, 0, 0 }, { 0 } }; diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c index c679668..ba98f1b 100644 --- a/lustre/mgc/lproc_mgc.c +++ b/lustre/mgc/lproc_mgc.c @@ -48,6 +48,7 @@ static struct lprocfs_vars lprocfs_mgc_obd_vars[] = { { "connect_flags", lprocfs_rd_connect_flags, 0, 0 }, { "mgs_server_uuid", lprocfs_rd_server_uuid, 0, 0 }, { "mgs_conn_uuid", lprocfs_rd_conn_uuid, 0, 0 }, + { "import", lprocfs_rd_import, 0, 0 }, { 0 } }; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index def72ea..306e461 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -609,6 +609,73 @@ int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count, return rc; } +#define flag2str(flag) \ + if (imp->imp_##flag && max - len > 0) \ + len += snprintf(str + len, max - len, " " #flag); + +/** + * Append a space separated list of current set flags to str. + */ +static int obd_import_flags2str(struct obd_import *imp, char *str, + int max) +{ + int len = 0; + + if (imp->imp_obd->obd_no_recov) + len += snprintf(str, max - len, " no_recov"); + + flag2str(invalid); + flag2str(deactive); + flag2str(replayable); + flag2str(pingable); + flag2str(recon_bk); + flag2str(last_recon); + return len; +} +#undef flags2str + +int lprocfs_rd_import(char *page, char **start, off_t off, int count, + int *eof, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + struct obd_import *imp; + char *imp_state_name = NULL; + int rc = 0; + + LASSERT(obd != NULL); + LPROCFS_CLIMP_CHECK(obd); + imp = obd->u.cli.cl_import; + imp_state_name = ptlrpc_import_state_name(imp->imp_state); + *eof = 1; + + rc = snprintf(page, count, + "import: %s\n" + " target: %s@%s\n" + " state: %s\n" + " inflight: %u\n" + " conn_cnt: %u\n" + " generation: %u\n" + " inval_cnt: %u\n" + " last_replay_transno: "LPU64"\n" + " peer_committed_transno: "LPU64"\n" + " last_trasno_checked: "LPU64"\n" + " flags:", + obd->obd_name, + obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid, + imp_state_name, + atomic_read(&imp->imp_inflight), + imp->imp_conn_cnt, + imp->imp_generation, + atomic_read(&imp->imp_inval_count), + imp->imp_last_replay_transno, + imp->imp_peer_committed_transno, + imp->imp_last_transno_checked); + rc += obd_import_flags2str(imp, page + rc, count - rc); + rc += snprintf(page+rc, count - rc, "\n"); + LPROCFS_CLIMP_EXIT(obd); + return rc; +} + int lprocfs_at_hist_helper(char *page, int count, int rc, struct adaptive_timeout *at) { @@ -1974,6 +2041,7 @@ EXPORT_SYMBOL(lprocfs_rd_conn_uuid); EXPORT_SYMBOL(lprocfs_rd_num_exports); EXPORT_SYMBOL(lprocfs_rd_numrefs); EXPORT_SYMBOL(lprocfs_at_hist_helper); +EXPORT_SYMBOL(lprocfs_rd_import); EXPORT_SYMBOL(lprocfs_rd_timeouts); EXPORT_SYMBOL(lprocfs_rd_blksize); EXPORT_SYMBOL(lprocfs_rd_kbytestotal); diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 508bae5..182caa9 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -477,6 +477,7 @@ static struct lprocfs_vars lprocfs_osc_obd_vars[] = { { "checksum_type", osc_rd_checksum_type, osc_wd_checksum_type, 0 }, { "resend_count", osc_rd_resend_count, osc_wr_resend_count, 0}, { "timeouts", lprocfs_rd_timeouts, 0, 0 }, + { "import", lprocfs_rd_import, 0, 0 }, { 0 } }; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f9e30b7..00fd9c6 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -152,6 +152,12 @@ test_0b() { } run_test 0b "chmod 0755 $DIR =============================" +test_0c() { + $LCTL get_param mdc.*.import | grep "state: FULL" || error "import not FULL" + $LCTL get_param mdc.*.import | grep "target: $FSNAME-MDT" || error "bad target" +} +run_test 0c "check import proc =============================" + test_1a() { mkdir $DIR/d1 mkdir $DIR/d1/d2