File 0194-mdcheck-add-some-logging.patch of Package mdadm.7989

From ea835492b6fffdb5ede879e461c8635b1e412a27 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Fri, 6 Oct 2017 12:33:36 +1100
Subject: [PATCH] mdcheck: add some logging.
Git-commit: ea835492b6fffdb5ede879e461c8635b1e412a27
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

Use 'logger' to report when mdcheck starts, stops, or continues
the check on an array.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 misc/mdcheck | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/misc/mdcheck b/misc/mdcheck
index 2c8f54d..589d038 100644
--- a/misc/mdcheck
+++ b/misc/mdcheck
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Copyright (C) 2014 Neil Brown <neilb@suse.de>
+# Copyright (C) 2014-2017 Neil Brown <neilb@suse.de>
 #
 #
 #    This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
 #    GNU General Public License for more details.
 #
 #    Author: Neil Brown
-#    Email: <neilb@suse.de>
+#    Email: <neilb@suse.com>
 
 # This script should be run periodically to automatically
 # perform a 'check' on any md arrays.
@@ -94,17 +94,20 @@ do
 	if [ -z "$cont" ]
 	then
 		start=0
+		logger -p daemon.info mdcheck start checking $dev
 	elif [ -z "$MD_UUID" -o ! -f "$fl" ]
 	then
 		# Nothing to continue here
 		continue
 	else
 		start=`cat "$fl"`
+		logger -p daemon.info mdcheck continue checking $dev from $start
 	fi
 
 	cnt=$[cnt+1]
 	eval MD_${cnt}_fl=\$fl
 	eval MD_${cnt}_sys=\$sys
+	eval MD_${cnt}_dev=\$dev
 	echo $start > $fl
 	echo $start > $sys/md/sync_min
 	echo check > $sys/md/sync_action
@@ -145,6 +148,7 @@ for i in `eval echo {1..$cnt}`
 do
 	eval fl=\$MD_${i}_fl
 	eval sys=\$MD_${i}_sys
+	eval dev=\$MD_${i}_dev
 
 	if [ -z "$fl" ]; then continue; fi
 
@@ -156,4 +160,5 @@ do
 	fi
 	echo idle > $sys/md/sync_action
 	cat $sys/md/sync_min > $fl
+	logger -p daemon.info pause checking $dev at `cat $fl`
 done
-- 
2.13.6
openSUSE Build Service is sponsored by