linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH] xfstests/btrfs: _devmgt_add() to check if the device is back online
Date: Thu, 17 Jul 2014 15:17:41 +0800	[thread overview]
Message-ID: <1405581461-12379-1-git-send-email-anand.jain@oracle.com> (raw)

btrfs/003 uses a method to remove the device as part of the test
case, and after the test completes the removed device is added
back to the system. However on certain system, albeit the slow
running system the device comes back a bit later, and so the
latter occurring sub-test with in the btrfs/003 fails.

This patch adds script to wait and test if the device is back online,
and thus report the same to to the full log.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 common/rc | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/common/rc b/common/rc
index 2c83340..4a6511f 100644
--- a/common/rc
+++ b/common/rc
@@ -2054,6 +2054,31 @@ _devmgt_add()
 	tdl=`echo ${1} | cut -d":" -f 2-|sed 's/:/ /g'`
 
 	echo ${tdl} >  /sys/class/scsi_host/host${h}/scan || _fail "Add disk failed"
+
+	# ensure the device comes online
+	dev_back_oneline=0
+	for i in `seq 1 10`; do
+		if [ -d /sys/class/scsi_device/${1}/device/block ]; then
+			dev=`ls /sys/class/scsi_device/${1}/device/block`
+			for j in `seq 1 10`;
+			do
+				stat /dev/$dev > /dev/null 2>&1
+				if [ $? -eq 0 ]; then
+					dev_back_oneline=1
+					break
+				fi
+				sleep 1
+			done
+			break
+		else
+			sleep 1
+		fi
+	done
+	if [ $dev_back_oneline -eq 0 ]; then
+		echo "/dev/$dev online failed" >> $seqres.full
+	else
+		echo "/dev/$dev is back online" >> $seqres.full
+	fi
 }
 
 _require_fstrim()
-- 
2.0.0.153.g79dcccc


                 reply	other threads:[~2014-07-17  6:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405581461-12379-1-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).