Whamcloud - gitweb
LU-9166 mdt: Add trailing newlines to proc files 77/25977/4
authorSteve Guminski <stephenx.guminski@intel.com>
Tue, 21 Mar 2017 19:04:19 +0000 (15:04 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Apr 2017 04:47:28 +0000 (04:47 +0000)
Adds trailing newlines to two proc files.  A new sanity test ensures
that all non-empty readable proc files end with a newline.

Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: Id65dd5a43edc41be9f572d476b38975f0144fbaf
Reviewed-on: https://review.whamcloud.com/25977
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdd/mdd_lproc.c
lustre/mdt/mdt_coordinator.c
lustre/tests/sanity.sh

index 7897fe9..92982eb 100644 (file)
@@ -90,6 +90,7 @@ static int mdd_changelog_mask_seq_show(struct seq_file *m, void *data)
                        seq_printf(m, "%s ", changelog_type2str(i));
                i++;
        }
                        seq_printf(m, "%s ", changelog_type2str(i));
                i++;
        }
+       seq_putc(m, '\n');
        return 0;
 }
 
        return 0;
 }
 
index da11033..c563284 100644 (file)
@@ -1742,7 +1742,7 @@ static void hsm_policy_bit2str(struct seq_file *m, const __u64 mask,
        }
        /* remove last ' ' */
        m->count--;
        }
        /* remove last ' ' */
        m->count--;
-       seq_putc(m, '\0');
+       seq_putc(m, '\n');
 }
 
 /* methods to read/write HSM policy flags */
 }
 
 /* methods to read/write HSM policy flags */
index 701aeeb..146525c 100755 (executable)
@@ -9804,6 +9804,34 @@ test_133g() {
 }
 run_test 133g "Check for Oopses on bad io area writes/reads in /proc"
 
 }
 run_test 133g "Check for Oopses on bad io area writes/reads in /proc"
 
+test_133h() {
+       remote_mds_nodsh && skip "remote MDS with nodsh" && return
+       remote_ost_nodsh && skip "remote OST with nodsh" && return
+       [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.54) ]] &&
+               skip "Need MDS version at least 2.9.54" && return
+
+       local facet
+       for facet in client mds1 ost1; do
+               local facet_proc_dirs=$(do_facet $facet \
+                                       \\\ls -d $proc_regexp 2> /dev/null)
+               [ -z "$facet_proc_dirs" ] && error "no proc_dirs on $facet"
+               echo "${facet}_proc_dirs='$facet_proc_dirs'"
+               # Get the list of files that are missing the terminating newline
+               local missing=($(do_facet $facet \
+                       find ${facet_proc_dirs} -type f \|              \
+                               while read F\; do                       \
+                                       awk -v FS='\v' -v RS='\v\v'     \
+                                       "'END { if(NR>0 &&              \
+                                       \\\$NF !~ /.*\\\n\$/)           \
+                                               print FILENAME}'"       \
+                                       '\$F'\;                         \
+                               done 2>/dev/null))
+               [ ${#missing[*]} -eq 0 ] ||
+                       error "files do not end with newline: ${missing[*]}"
+       done
+}
+run_test 133h "Proc files should end with newlines"
+
 test_134a() {
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
        [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.54) ]] &&
 test_134a() {
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
        [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.54) ]] &&