From patchwork Wed Mar 11 17:50:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1253110 X-Patchwork-Delegate: akodanev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48czyM755lz9sPK for ; Thu, 12 Mar 2020 04:50:27 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 827B53C71CC for ; Wed, 11 Mar 2020 18:50:23 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 9C92D3C7080 for ; Wed, 11 Mar 2020 18:50:21 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 06717601CBE for ; Wed, 11 Mar 2020 18:50:20 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 470EBAEC7; Wed, 11 Mar 2020 17:50:20 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 11 Mar 2020 18:50:09 +0100 Message-Id: <20200311175011.12171-1-pvorel@suse.cz> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH v2 1/3] nfs_lib: Unify remote directory creation X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" remote directory creation can be done by tst_rhost_run() also on netns. This simplifies code a bit. Signed-off-by: Petr Vorel --- Changes v1-v2: * remove changes in nfs_mount() (to keep using netns) testcases/network/nfs/nfs_stress/nfs_lib.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index 66f2fb038..f233976c7 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -50,14 +50,6 @@ nfs_setup_server() { local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir" - if [ -n "$LTP_NETNS" ]; then - if [ ! -d $remote_dir ]; then - mkdir -p $remote_dir - ROD $export_cmd - fi - return - fi - if ! tst_rhost_run -c "test -d $remote_dir"; then tst_rhost_run -s -c "mkdir -p $remote_dir; $export_cmd" fi From patchwork Wed Mar 11 17:50:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1253111 X-Patchwork-Delegate: akodanev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48czyQ2D54z9sPK for ; Thu, 12 Mar 2020 04:50:38 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 9FC303C71DE for ; Wed, 11 Mar 2020 18:50:35 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id B8D573C7081 for ; Wed, 11 Mar 2020 18:50:21 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 06F571000BEB for ; Wed, 11 Mar 2020 18:50:20 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5D119AEE1; Wed, 11 Mar 2020 17:50:20 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 11 Mar 2020 18:50:10 +0100 Message-Id: <20200311175011.12171-2-pvorel@suse.cz> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200311175011.12171-1-pvorel@suse.cz> References: <20200311175011.12171-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v2 2/3] nfs: Detect disabled UDP X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" nfs-utils disabled serving NFS over UDP in version 2.2.1, which produce TBROK: nfs01 1 TBROK: 'mount -t nfs -o proto=udp,vers=3 10.0.0.2:/tmp/LTP_nfs01.3pixnljzEv/3/udp /tmp/LTP_nfs01.3pixnljzEv/3/0' failed on '': 'mount.nfs: requested NFS version or transport protocol is not supported' Detect UDP enabled (parsing all configs) and return TCONF when disabled. Also detect UDP enabled by default by default, when config has commented default values. NOTE: Debian based distros still use older version, once it upgrades, it will might keep using current configuration files (/etc/default/nfs-kernel-server, /etc/default/nfs-common), therefore code might need to be adjusted. Signed-off-by: Petr Vorel --- Changes v1-v2: * detect UDP also on IPv6 ("udp6") * use Simplified regexp testcases/network/nfs/nfs_stress/nfs_lib.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index f233976c7..3d447783d 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -46,6 +46,15 @@ get_socket_type() done } +nfs_server_udp_enabled() +{ + local config f + + tst_rhost_run -c "[ -f /etc/nfs.conf ]" || return 0 + config=$(tst_rhost_run -c 'for f in $(grep ^include.*= '/etc/nfs.conf' | cut -d = -f2); do [ -f $f ] && printf "$f "; done') + tst_rhost_run -c "grep -q '^[# ]*udp *= *y' /etc/nfs.conf $config" +} + nfs_setup_server() { local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir" @@ -98,6 +107,10 @@ nfs_setup() type=$(get_socket_type $n) tst_res TINFO "setup NFSv$i, socket type $type" + if [ "$type" = "udp" -o "$type" = "udp6" ] && ! nfs_server_udp_enabled; then + tst_brk TCONF "UDP support disabled on NFS server" + fi + local_dir="$TST_TMPDIR/$i/$n" remote_dir="$TST_TMPDIR/$i/$type" mkdir -p $local_dir From patchwork Wed Mar 11 17:50:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1253112 X-Patchwork-Delegate: akodanev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48czyc4R0jz9sPK for ; Thu, 12 Mar 2020 04:50:48 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 08A3C3C71CE for ; Wed, 11 Mar 2020 18:50:46 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id C24663C7082 for ; Wed, 11 Mar 2020 18:50:21 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id E639F6006D4 for ; Wed, 11 Mar 2020 18:50:20 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 73B7CAEED; Wed, 11 Mar 2020 17:50:20 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 11 Mar 2020 18:50:11 +0100 Message-Id: <20200311175011.12171-3-pvorel@suse.cz> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200311175011.12171-1-pvorel@suse.cz> References: <20200311175011.12171-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v2 3/3] nfs_lib: Add option to run traffic via lo on netns X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" When $LTP_NFS_NETNS_USE_LO set and test is using netns ($TST_USE_NETNS set) NFS traffic will go through lo interface instead of ltp_ns_veth* netns interfaces. This can be useful for debugging whether test failures are related to veth/netns. Suggested-by: Alexey Kodanev Signed-off-by: Petr Vorel Reviewed-by: Alexey Kodanev --- Changes v1-v2: * new commit testcases/network/nfs/nfs_stress/nfs_lib.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index 3d447783d..b7c372afb 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -31,6 +31,11 @@ TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs" TST_SETUP="${TST_SETUP:-nfs_setup}" TST_CLEANUP="${TST_CLEANUP:-nfs_cleanup}" +# When set and test is using netns ($TST_USE_NETNS set) NFS traffic will go +# through lo interface instead of ltp_ns_veth* netns interfaces (useful for +# debugging whether test failures are related to veth/netns). +LTP_NFS_NETNS_USE_LO= + . tst_net.sh get_socket_type() @@ -52,6 +57,7 @@ nfs_server_udp_enabled() tst_rhost_run -c "[ -f /etc/nfs.conf ]" || return 0 config=$(tst_rhost_run -c 'for f in $(grep ^include.*= '/etc/nfs.conf' | cut -d = -f2); do [ -f $f ] && printf "$f "; done') + tst_rhost_run -c "grep -q '^[# ]*udp *= *y' /etc/nfs.conf $config" } @@ -80,7 +86,7 @@ nfs_mount() local mnt_cmd="mount -t nfs $opts $mount_dir $local_dir" tst_res TINFO "Mounting NFS: $mnt_cmd" - if [ -n "$LTP_NETNS" ]; then + if [ -n "$LTP_NETNS" ] && [ -z "$LTP_NFS_NETNS_USE_LO" ]; then tst_rhost_run -s -c "$mnt_cmd" return fi