Whamcloud - gitweb
LU-2724 ptlrpc: skip NULL obd_svc_stats in lprocfs_rd_import()
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 28 Feb 2013 09:39:45 +0000 (03:39 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 8 Mar 2013 20:53:55 +0000 (15:53 -0500)
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 <john.hammond@intel.com>
Change-Id: Ic94056eb4f02d71491cdaf948cbe27b82de2153d
Reviewed-on: http://review.whamcloud.com/5234
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Tested-by: Hudson
Reviewed-by: Li Wei <wei.g.li@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/lprocfs_status.c
lustre/tests/sanity.sh

index 8aeb3c3..4eb8534 100644 (file)
@@ -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);
 
                      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) {
        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;
 }
         LPROCFS_CLIMP_EXIT(obd);
         return i;
 }
index 5042e40..940e64c 100644 (file)
@@ -8274,6 +8274,36 @@ test_133e() {
 }
 run_test 133e "Verifying OST {read,write}_bytes nid stats ================="
 
 }
 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"
 test_140() { #bug-17379
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
         test_mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir"