From patchwork Wed Apr 17 10:42:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 13633168 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 933CD13C669 for ; Wed, 17 Apr 2024 10:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713350535; cv=none; b=SeLFu3gKp8j2xG9O7InbSKeVdGam/u1pm8kWKkGx9+YTkKdO5Nze2P6WGhR2t5kua6spIfJrYA0Z6e1stJSu6jXg69pGmwiZlEfCPHLde/oVKVFuDIPHLDNzrfNM1YRbSG4RcBGNCqsx7/JSsI5BmdoY9DxJJ1kVMSOmn1rRU0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713350535; c=relaxed/simple; bh=g3fx1ZTkHRAoDOZOkdg+UOQMZLU5smY4eolMVN8yWPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i7VMcPfqhOO27dNtu80Lixa1H3kk0MQj6hx+8/L0DpMraLxkfcCIB0xNilgef/RhbTuBaoHGWEvThIvZ20P7aQN1X74yL140FWDr0kMbk+7QcLGFTwxMgMomRfejOARgQdX9SauuRALZaHHnNwcQdzAaaqbdtM8jAQC31NnD4Og= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=RXBDiRyl; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="RXBDiRyl" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1713350533; x=1744886533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=g3fx1ZTkHRAoDOZOkdg+UOQMZLU5smY4eolMVN8yWPg=; b=RXBDiRylX1HF6Io2bzZ3ug36wbY+7WlcW7IgLMkUhwPs/lzyABH5gHaz A5BFtFdqUeVHLdbuTrTxtBhqrwOTAKyrqcFCXrrDE7tafngWytCpoBQ2G uqyJrRQKFJC8YcnpXabpFwK4z+in55xKGXIfLKtEXypQbdVQss9GCquE2 WL0wYkojFr1IXNEyJMIIb7yJsXUzXDiqWSUZjNaJRV1WS8vZ/b2e/XV2x spw4H9jyumFIV+D/bxM1sFedYZedWTNThQNiWx9JMz3kVEKZpkaxLJGo9 TiDENAvKXnKhiRqa+/uw6ORjWcH/BboDxmV4IsMco8/wPpf3yXJ/nEm95 A==; X-CSE-ConnectionGUID: crJ0WLQMT8GXPGiltpLZxQ== X-CSE-MsgGUID: seLPxtj4Q7yB601KdFMt8Q== X-IronPort-AV: E=Sophos;i="6.07,209,1708358400"; d="scan'208";a="14913462" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 17 Apr 2024 18:42:12 +0800 IronPort-SDR: s0MLqSAiP9XP86Or1h9WNdkaZky1JDhb/Q+qFnXaO8SlhieqVpFm9mwPh5RQsy/wK6PhvQ69ZO L2hsb5dVPjJ1qCbtMknOSmxC9B7hlM9y7ktcXerDKs1l0XfFQJbansaC+qfaUxtYISaX098uqL O1m+2kdG0MsYNkhxerCy59ChflC0fOWMgl8ybWycUm1Karu9/AqsE/3c02OM0ZJCVDC9m2XFIe 8GgxwMhuaJS6iyZ4biEoMEfw9/1Y8jJ/VbkuF4kZ3VyH6HUAuzAa/RQlFLnqX3I5BPfdO1fhOb mDw= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Apr 2024 02:44:50 -0700 IronPort-SDR: TgN2iPQSnxWxnpydXPHereC4u1YXV0HsheYkj204Wsc1vXCoUPopvgdAkz/ZYWifaxsk3Ui0UC u+BhJIfslqPozNamHXM3+uFE+6w1nLrR3mmsdu3qBf6e9u4RK/LNqS/m7oojriPRh/QmcD2fCU RxCrYjLIiLD4NtbYu15OU+GA1MVGtpjppTzZ0jf+BgJmYJotTsH+j1fhJh6jcfmyNgeAocLIq+ c/UIvwLREBZQatUW4vsadPXm+3/TtegnCwucqFUdCEtq0GEs7BEHG8mrL/6ZBF3H9cSn3AEBMW vnQ= WDCIronportException: Internal Received: from unknown (HELO shindev.ssa.fujisawa.hgst.com) ([10.149.66.30]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Apr 2024 03:42:11 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: nbd@other.debian.org, Josef Bacik , Yi Zhang , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 1/2] nbd/002: fix wrong -L/-nonetlink option usage Date: Wed, 17 Apr 2024 19:42:08 +0900 Message-ID: <20240417104209.2898526-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417104209.2898526-1-shinichiro.kawasaki@wdc.com> References: <20240417104209.2898526-1-shinichiro.kawasaki@wdc.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As the commit 3c014acd5171 ("nbd/001: use -L for nbd-client") explains, the nbd-client command uses the netlink interface instead of the ioctl interface. The default interface changed at nbd version 3.17 in March 2018. Before that, the default was ioctl. After the change, the nbd-client command requires -L or -nonetlink option to use the ioctl interface. The commit 3c014acd5171 adjusted nbd/001 test script to the default interface change. However, it is not reflected to nbd/002. This caused mismatch between the comments in the test case and the actual test. The comments describe the first half as "Do it with ioctls", and the last half as "Do it with netlink". However, the test script does opposite. It specifies no option for the first half, then tests with netlink interface. It specifies -L option for the last half, then tests with the ioctl interface. This makes it difficult to debug the failure of the test case. Fix the nbd-client command option to match the comments. Also, use the long option -nonetlink instead of -L for easier reading. Signed-off-by: Shin'ichiro Kawasaki --- tests/nbd/002 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/nbd/002 b/tests/nbd/002 index fd992a0..968c9fa 100755 --- a/tests/nbd/002 +++ b/tests/nbd/002 @@ -53,11 +53,11 @@ test() { echo "Testing IOCTL path" - nbd-client -N export localhost /dev/nbd0 >> "$FULL" 2>&1 + nbd-client -nonetlink -N export localhost /dev/nbd0 >> "$FULL" 2>&1 if ! _wait_for_nbd_connect; then echo "Connect didn't happen?" - nbd-client -d /dev/nbd0 >> "$FULL" 2>&1 + nbd-client -nonetlink -d /dev/nbd0 >> "$FULL" 2>&1 _stop_nbd_server return 1 fi @@ -66,12 +66,12 @@ test() { if ! stat /dev/nbd0p1 >> "$FULL" 2>&1; then echo "Didn't have partition on ioctl path" - nbd-client -d /dev/nbd0 >> "$FULL" 2>&1 + nbd-client -nonetlink -d /dev/nbd0 >> "$FULL" 2>&1 _stop_nbd_server return 1 fi - nbd-client -d /dev/nbd0 >> "$FULL" 2>&1 + nbd-client -nonetlink -d /dev/nbd0 >> "$FULL" 2>&1 udevadm settle @@ -83,7 +83,7 @@ test() { # Do it with netlink echo "Testing the netlink path" - nbd-client -L -N export localhost /dev/nbd0 >> "$FULL" 2>&1 + nbd-client -N export localhost /dev/nbd0 >> "$FULL" 2>&1 if ! _wait_for_nbd_connect; then echo "Connect didn't happen?" @@ -96,12 +96,12 @@ test() { if ! stat /dev/nbd0p1 >/dev/null 2>&1; then echo "Didn't have partition on the netlink path" - nbd-client -L -d /dev/nbd0 >> "$FULL" 2>&1 + nbd-client -d /dev/nbd0 >> "$FULL" 2>&1 _stop_nbd_server return 1 fi - nbd-client -L -d /dev/nbd0 >> "$FULL" 2>&1 + nbd-client -d /dev/nbd0 >> "$FULL" 2>&1 if ! _wait_for_nbd_disconnect; then echo "Disconnect didn't happen?" From patchwork Wed Apr 17 10:42:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 13633169 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51B02139CEF for ; Wed, 17 Apr 2024 10:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713350536; cv=none; b=OWLGtSsK07Ol2Vb3zuR7yz257gnfCRBtwjBwqNvlR9S3R2g2nCBRRBE0moWaYnicecS9Ez54xuWLimIwtBYrKzczqj48POVfhMxi/4jdMpEIT4oYx8/2Eqy27gHNOqmsUiUjX9WV7tcfnCcVxlYO5YxeXiKJtPeqEj/u4jmZXwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713350536; c=relaxed/simple; bh=3roGAFq0akpy3yja+jCNy+bt+me5vr5KFtx4OdO58SQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ROacMOjzSpVMIiOT7isEp/T6QCo68yG5+fS18Iq4crAcIlsxYqa7iqOUKnuk6StMtXLogfWr2jmjDiMNf+caTKvnxTDl7xzrhqDxro2fFTDM2CErx+pOYwka8pG+2OWRgRSC6SmTwflm1zDDeyHDgzWiSiRwc64hywrlnpTi9bw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=rrvwvvPt; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="rrvwvvPt" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1713350534; x=1744886534; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3roGAFq0akpy3yja+jCNy+bt+me5vr5KFtx4OdO58SQ=; b=rrvwvvPtvGiv3BWGODM06LST5I7rPD7s3uNsKsIrFGwvBvz5/pYvIw4L jisLdKy7lRLMF8MoITfri+jhn9hOwI0V3XQrvc7Jgwsmzg7gfmKZcMKrp /G8kdy3ku1uiGTWV/Z31rHr2swmGDaohvXZaBAUI4VP3VTjOhxdInpOhH Uzb2UrOTjGqQSfiXWb5MKULInWAfW1qcWHTxBi+EtCZ0YFysTqT7IzW3k YQr+0LvShzYH0QF+M23F3QyYT8pyL8Yul6tVi4lXXdU3waiz3NyRlzYC0 QPZaciLv65VMf2QZV4bgjeqhX4of5bemVYQifNpCQhbCQ7DFaINk+MdwO w==; X-CSE-ConnectionGUID: PhKVrGAxQQOMEXm1aseN8g== X-CSE-MsgGUID: 8p4C7daaSj6T/MEcINRK7A== X-IronPort-AV: E=Sophos;i="6.07,209,1708358400"; d="scan'208";a="14913464" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 17 Apr 2024 18:42:13 +0800 IronPort-SDR: F2s4IIMSa+sa6VdhnyrPOZ4plzkW1qO+UjWRWZeZXfmspyWRXluFy9aX9dWuOL2Tzh0zkfHLOQ 8bqJg7yy0YnNNHLzbfdueBObuNZ91fLu/m5S+SA33s3dWmjUIqspee7PqHEMNbVbUdusL1Os3Q OHbFk3eMnSmAChPW6eZ6Zg0vmmhL0SVuOSV25xnYtlGi2gRBox9E0GjL4mPYPJFWmskkDTPb94 R9wjomGGXU0tY7pSH+3AUWHz7k2O/JtxMqiZutEvMhsyKxlkKP3VVwnfymU49gLfbzy39ESy6I 0rc= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Apr 2024 02:44:51 -0700 IronPort-SDR: 2lueZgCJKeUgOK1iCvOdv3rtDN0qEyJDam5qcH2IIBDzHsgoBZvkQdoKLeENNXMTgu+l+hfPLD 90eiTc2LV5LRzQ+tHnPEQUYCPVxSYD8Ue/3W7bP4oikLs9RdY9DQWxuALWGqecIcCUB3EdlG4/ l3CSbHV2XVYDC23NGZFeWUZECv4OUGXN5mDRKg0lYF2LQt+6ReOaqaoGsJLFTbmAvaGtyh/G63 7HrNJV4VSZgWDYhYZKQYGGtsqa60AggHRIGo0SI38EmC/Ex55xTpHJSMkJW9ZJnARtx5LG+iyo owA= WDCIronportException: Internal Received: from unknown (HELO shindev.ssa.fujisawa.hgst.com) ([10.149.66.30]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Apr 2024 03:42:13 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: nbd@other.debian.org, Josef Bacik , Yi Zhang , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 2/2] nbd/002: repeat partition existence check for ioctl interface Date: Wed, 17 Apr 2024 19:42:09 +0900 Message-ID: <20240417104209.2898526-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417104209.2898526-1-shinichiro.kawasaki@wdc.com> References: <20240417104209.2898526-1-shinichiro.kawasaki@wdc.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When nbd-client is set up with the ioctl interface, it takes some time for the nbd driver and the block layer to complete the partition read. The test script calls stat command for the /dev/nbd0p1 device to check the partition exists as expected. However, this stat command is often called before the partition read completion, then causes the test case failure. To avoid the test case failure, repeat the partition check a few times with one second wait. Signed-off-by: Shin'ichiro Kawasaki --- tests/nbd/002 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/nbd/002 b/tests/nbd/002 index 968c9fa..8e4e062 100755 --- a/tests/nbd/002 +++ b/tests/nbd/002 @@ -21,6 +21,8 @@ requires() { } test() { + local pass i + echo "Running ${TEST_NAME}" _start_nbd_server { @@ -64,7 +66,15 @@ test() { udevadm settle - if ! stat /dev/nbd0p1 >> "$FULL" 2>&1; then + pass=false + for ((i = 0; i < 3; i++)); do + if stat /dev/nbd0p1 >> "$FULL" 2>&1; then + pass=true + break + fi + sleep 1 + done + if [[ $pass != true ]]; then echo "Didn't have partition on ioctl path" nbd-client -nonetlink -d /dev/nbd0 >> "$FULL" 2>&1 _stop_nbd_server