From 89c31f6814a49a2697259ffe57e480e6653d31ee Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Tue, 21 Mar 2017 15:04:19 -0400 Subject: [PATCH] LU-9166 mdt: Add trailing newlines to proc files 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 Change-Id: Id65dd5a43edc41be9f572d476b38975f0144fbaf Reviewed-on: https://review.whamcloud.com/25977 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/mdd/mdd_lproc.c | 1 + lustre/mdt/mdt_coordinator.c | 2 +- lustre/tests/sanity.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c index 7897fe9..92982eb 100644 --- a/lustre/mdd/mdd_lproc.c +++ b/lustre/mdd/mdd_lproc.c @@ -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_putc(m, '\n'); return 0; } diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index da11033..c563284 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -1742,7 +1742,7 @@ static void hsm_policy_bit2str(struct seq_file *m, const __u64 mask, } /* remove last ' ' */ m->count--; - seq_putc(m, '\0'); + seq_putc(m, '\n'); } /* methods to read/write HSM policy flags */ diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 701aeeb..146525c 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9804,6 +9804,34 @@ test_133g() { } 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) ]] && -- 1.8.3.1