From 2f1703f595f40887d798119dcee0aa3163c5f3f3 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 28 Feb 2013 03:39:45 -0600 Subject: [PATCH] LU-2724 ptlrpc: skip NULL obd_svc_stats in lprocfs_rd_import() In lprocfs_rd_import() don't print trivial obd_svc_stats if they were not allocated for this import. Add a general proc file read check to sanity. Signed-off-by: John L. Hammond Change-Id: Ic94056eb4f02d71491cdaf948cbe27b82de2153d Reviewed-on: http://review.whamcloud.com/5234 Reviewed-by: Bobi Jam Tested-by: Hudson Reviewed-by: Li Wei Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/obdclass/lprocfs_status.c | 4 ++++ lustre/tests/sanity.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 8aeb3c3..4eb8534 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -1058,6 +1058,9 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count, cfs_atomic_read(&imp->imp_inval_count)); spin_unlock(&imp->imp_lock); + if (obd->obd_svc_stats == NULL) + goto out_climp; + header = &obd->obd_svc_stats->ls_cnt_header[PTLRPC_REQWAIT_CNTR]; lprocfs_stats_collect(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, &ret); if (ret.lc_count != 0) { @@ -1137,6 +1140,7 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count, } } +out_climp: LPROCFS_CLIMP_EXIT(obd); return i; } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 5042e40..940e64c 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -8274,6 +8274,36 @@ test_133e() { } run_test 133e "Verifying OST {read,write}_bytes nid stats =================" +test_133f() { + local proc_dirs="/proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/" + local facet + + # First without trusting modes. + find $proc_dirs \ + -exec cat '{}' \; &> /dev/null + + # Second verifying readability. + find $proc_dirs \ + -type f \ + -readable \ + -exec cat '{}' \; > /dev/null || + error "proc file read failed" + + for facet in $SINGLEMDS ost1; do + do_facet $facet find $proc_dirs \ + -not -name req_history \ + -exec cat '{}' \\\; &> /dev/null + + do_facet $facet find $proc_dirs \ + -not -name req_history \ + -type f \ + -readable \ + -exec cat '{}' \\\; > /dev/null || + error "proc file read failed" + done +} +run_test 133f "Check for LBUGs/Oopses/unreadable files in /proc" + test_140() { #bug-17379 [ $PARALLEL == "yes" ] && skip "skip parallel run" && return test_mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir" -- 1.8.3.1