[PATCH 1/8] mdadm/test: correct the logic operation in save_log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1. delete the mdadm -As, keep the original testing scene intact.
2. move some actions into 'array' test, 'mdadm -D $array' would
   complain errors if $array is null.

Signed-off-by: Zhilong Liu <zlliu@xxxxxxxx>
---
 test | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/test b/test
index e74bbe5..eb67ef5 100755
--- a/test
+++ b/test
@@ -59,16 +59,11 @@ save_log() {
 	cp $targetdir/log $logdir/$_basename.log
 	echo "## $HOSTNAME: saving dmesg." >> $logdir/$logfile
 	dmesg -c >> $logdir/$logfile
-	$mdadm -As 2> /dev/null
 	echo "## $HOSTNAME: saving proc mdstat." >> $logdir/$logfile
 	cat /proc/mdstat >> $logdir/$logfile
 	array=($(mdadm -Ds | cut -d' ' -f2))
-	echo "## $HOSTNAME: mdadm -D ${array[@]}" >> $logdir/$logfile
-	$mdadm -D ${array[@]} >> $logdir/$logfile
 	[ "$1" == "fail" ] &&
 		echo "FAILED - see $logdir/$_basename.log and $logdir/$logfile for details"
-	# ignore saving external(external file, imsm...) bitmap
-	cat /proc/mdstat | grep -q "linear\|external" && return 0
 	if [ $DEVTYPE == 'lvm' ]
 	then
 		# not supported lvm type yet
@@ -77,6 +72,10 @@ save_log() {
 	then
 		if [ ! -z "$array" -a ${#array[@]} -ge 1 ]
 		then
+			echo "## $HOSTNAME: mdadm -D ${array[@]}" >> $logdir/$logfile
+			$mdadm -D ${array[@]} >> $logdir/$logfile
+			# ignore saving external(external file, imsm...) bitmap
+			cat /proc/mdstat | grep -q "linear\|external" && return 0
 			md_disks=($($mdadm -D -Y ${array[@]} | grep "/dev/" | cut -d'=' -f2))
 			cat /proc/mdstat | grep -q "bitmap"
 			if [ $? -eq 0 ]
-- 
2.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux