From patchwork Mon Apr 24 21:08:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1773106 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=xlT7Bg/C; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=FicrRFrf; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q4yRV0wpcz23s0 for ; Tue, 25 Apr 2023 07:08:54 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id EBBA73CEF12 for ; Mon, 24 Apr 2023 23:08:51 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 439203CBCCB for ; Mon, 24 Apr 2023 23:08:14 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id CBCFF2000AF for ; Mon, 24 Apr 2023 23:08:13 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 443EE2197E; Mon, 24 Apr 2023 21:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1682370492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ewYSS6/K3VhhpPZUmvT8hvwvjLF4gKgkfo/wRmB4X9g=; b=xlT7Bg/Cf3/i+UbwgR91qSyM+0L9fHTBEh0U+zN8oZyc5PzX4YJ+qgTJAxHbMbMp0AiB4q UF7/aThlT1IUYzTOPgGo09avND1bwGJ5/pG+ObBqc43KkVY2riMGS651LD8iYymGaXtzn1 wQYrSzlkKjmsB82Omsf4th53Szf3BPc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1682370492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ewYSS6/K3VhhpPZUmvT8hvwvjLF4gKgkfo/wRmB4X9g=; b=FicrRFrffoJrGjsaBGE2xi0QnSheBtJUCeo77JpYpEMyqytHTKbx5C6dDRaNd1sRLa5kt3 8J4AoIJ1GxzRN2BA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AFAA01390E; Mon, 24 Apr 2023 21:08:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uCTxJ7vvRmSzIAAAMHmgww (envelope-from ); Mon, 24 Apr 2023 21:08:11 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Mon, 24 Apr 2023 23:08:16 +0200 Message-Id: <20230424210818.2885479-2-pvorel@suse.cz> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230424210818.2885479-1-pvorel@suse.cz> References: <20230424210818.2885479-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH v3 1/3] nfs_lib.sh: Cleanup local and remote directories setup 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: , Cc: linux-nfs@vger.kernel.org, NeilBrown , Jeff Layton , Steve Dickson , Chuck Lever , Trond Myklebust Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Logic for creating local and remote directories was on more places. Create get_local_dir() and get_remote_dir() functions to keep it on single place. local dir is needed in nfs_mount(), but was defined in nfs_setup() and reused local variable with shell inheritance (ugly!), because there were all parameters from loop. Similarly, remote dir is needed in both nfs_mount() and nfs_setup_server(), but created with shell inheritance in nfs_setup(). Pass these params to nfs_mount() and nfs_setup_server() and define variables with new functions get_local_dir() and get_remote_dir(). Use get_remote_dir() in nfs_get_remote_path(). Move cd to local directory to the end of nfs_mount() (it used to cd after nfs_mount(), but only if -v parameter contained single version, but it does not harm to always cd). Signed-off-by: Petr Vorel --- testcases/network/nfs/nfs_stress/nfs_lib.sh | 52 ++++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index af7d46a21..1b5604ab5 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -1,6 +1,6 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-or-later -# Copyright (c) Linux Test Project, 2016-2022 +# Copyright (c) Linux Test Project, 2016-2023 # Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved. # Copyright (c) International Business Machines Corp., 2001 @@ -53,6 +53,24 @@ get_socket_type() done } +# directory mounted by NFS client +get_local_dir() +{ + local v="$1" + local n="$2" + + echo "$TST_TMPDIR/$v/$n" +} + +# directory on NFS server +get_remote_dir() +{ + local v="$1" + local n="$2" + + echo "$TST_TMPDIR/$v/$n" +} + nfs_get_remote_path() { local v @@ -63,7 +81,7 @@ nfs_get_remote_path() done v=${1:-$v} - echo "$TST_TMPDIR/$v/$type" + echo "$(get_remote_dir $v $type)" } nfs_server_udp_enabled() @@ -78,8 +96,8 @@ nfs_server_udp_enabled() nfs_setup_server() { - - local fsid="$1" + local remote_dir="$1" + local fsid="$2" local export_cmd="exportfs -i -o fsid=$fsid,no_root_squash,rw *:$remote_dir" [ -z "$fsid" ] && tst_brk TBROK "empty fsid" @@ -97,10 +115,14 @@ nfs_setup_server() nfs_mount() { - local opts="$1" + local local_dir="$1" + local remote_dir="$2" + local opts="$3" local host_type=rhost local mount_dir + mkdir -p "$local_dir" + tst_net_use_netns && host_type= if [ $TST_IPV6 ]; then @@ -131,6 +153,8 @@ nfs_mount() tst_brk TBROK "mount command failed" fi + + cd "$local_dir" } nfs_setup() @@ -162,20 +186,12 @@ nfs_setup() 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 - - nfs_setup_server $(($$ + n)) - - nfs_mount "-o proto=$type,vers=$i" + remote_dir="$(get_remote_dir $i $type)" + nfs_setup_server "$remote_dir" "$(($$ + n))" + nfs_mount "$(get_local_dir $i $n)" "$remote_dir" "-o proto=$type,vers=$i" n=$(( n + 1 )) done - - if [ "$n" -eq 1 ]; then - cd ${VERSION}/0 - fi } nfs_cleanup() @@ -190,7 +206,7 @@ nfs_cleanup() local n=0 for i in $VERSION; do - local_dir="$TST_TMPDIR/$i/$n" + local_dir="$(get_local_dir $i $n)" grep -q "$local_dir" /proc/mounts && umount $local_dir n=$(( n + 1 )) done @@ -198,7 +214,7 @@ nfs_cleanup() n=0 for i in $VERSION; do type=$(get_socket_type $n) - remote_dir="$TST_TMPDIR/$i/$type" + remote_dir="$(get_remote_dir $i $type)" tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir" tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir" n=$(( n + 1 )) From patchwork Mon Apr 24 21:08:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1773104 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=U4rmdr9c; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1N8e7Zb0; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q4yR12Bg6z23s0 for ; Tue, 25 Apr 2023 07:08:29 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B0C243CEA01 for ; Mon, 24 Apr 2023 23:08:26 +0200 (CEST) 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]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id BEF813CB304 for ; Mon, 24 Apr 2023 23:08:13 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 4C1006005CB for ; Mon, 24 Apr 2023 23:08:13 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CD4471FD94; Mon, 24 Apr 2023 21:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1682370492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/iyzeLzCsMCdsmJwHyVbIHUwIBHNpy11fYoEtMxyvpk=; b=U4rmdr9cQT6ujltj2tGLrrVOw4jfXby9gVqC3Y/2kt2QWKiZyS7aSE3YO7ugrgT7sNrTHE AJHDhorMu0bFVoH7Qp5Y7PVKJAC8TTpjtv4JinVAPJpG8V3h42wNqrtUAiyjikjuaJm4O8 jjgZTpK2tjAt8CVXjkKf4Qw2RbWahIY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1682370492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/iyzeLzCsMCdsmJwHyVbIHUwIBHNpy11fYoEtMxyvpk=; b=1N8e7Zb00xKsGhfSvd7jIk0ZAjyMLFWhAKO8aDc7cXMQy76YH1AFXNkSK6W4z/O55LLTO5 qcaJpgR6QzuyGjAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4D0A61390E; Mon, 24 Apr 2023 21:08:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iMLlELzvRmSzIAAAMHmgww (envelope-from ); Mon, 24 Apr 2023 21:08:12 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Mon, 24 Apr 2023 23:08:17 +0200 Message-Id: <20230424210818.2885479-3-pvorel@suse.cz> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230424210818.2885479-1-pvorel@suse.cz> References: <20230424210818.2885479-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v3 2/3] nfs_lib.sh: Unexport on proper side 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: , Cc: linux-nfs@vger.kernel.org, NeilBrown , Jeff Layton , Steve Dickson , Chuck Lever , Trond Myklebust , Nikita Yushchenko Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" f6b267055 changed exportfs run locally on netns, therefore unexporting should be also run at the same namespace. This is not problematic now, but will be a problem with TST_ALL_FILESYSTEMS=1, which is sensitive for timing. Fixes: f6b267055 ("nfs_lib.sh: run exportfs at "server side" in LTP_NETNS case") Signed-off-by: Petr Vorel --- testcases/network/nfs/nfs_stress/nfs_lib.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index 1b5604ab5..042fea5e4 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -215,8 +215,16 @@ nfs_cleanup() for i in $VERSION; do type=$(get_socket_type $n) remote_dir="$(get_remote_dir $i $type)" - tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir" - tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir" + + if tst_net_use_netns; then + if test -d $remote_dir; then + exportfs -u *:$remote_dir + rm -rf $remote_dir + fi + else + tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir" + tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir" + fi n=$(( n + 1 )) done } From patchwork Mon Apr 24 21:08:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1773105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=ImjkAmTf; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=CqrRsHcf; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q4yRH29DBz23s0 for ; Tue, 25 Apr 2023 07:08:43 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5542E3CE9F2 for ; Mon, 24 Apr 2023 23:08:40 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 396933CB304 for ; Mon, 24 Apr 2023 23:08:14 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id B041B14002C6 for ; Mon, 24 Apr 2023 23:08:13 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 47C3E1FD95; Mon, 24 Apr 2023 21:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1682370493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pWlOVDELT0awlYxBjI0RnsXk6+ecnICOhOidzzdVm/Q=; b=ImjkAmTf5Tv3C7ZG51VgEQzbrNt0DlYZkACohF82+G8wG1Ne84toosFe4wdsryHaaW2Ufb suJu6HfWobTu/yOZDXN0iC8tyYv2Fjaa/SkOpwj90GPhAp5Fg/TAMfGeY+YhCNcZICgtgT IkW52df6uvpuvp6O33Kf+tABGba31M4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1682370493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pWlOVDELT0awlYxBjI0RnsXk6+ecnICOhOidzzdVm/Q=; b=CqrRsHcfHra/Ct25pn9AmqaVJuQfSu0czspdMMaC21kihRXT0Lld4EEm9pzhB1lKWdJvYS R/D5gGP+YtUdYuBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D99AB1390E; Mon, 24 Apr 2023 21:08:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EJFdM7zvRmSzIAAAMHmgww (envelope-from ); Mon, 24 Apr 2023 21:08:12 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Mon, 24 Apr 2023 23:08:18 +0200 Message-Id: <20230424210818.2885479-4-pvorel@suse.cz> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230424210818.2885479-1-pvorel@suse.cz> References: <20230424210818.2885479-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v3 3/3] nfs: Run on all filesystems 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: , Cc: linux-nfs@vger.kernel.org, NeilBrown , Jeff Layton , Steve Dickson , Chuck Lever , Trond Myklebust Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Use variables: * TST_ALL_FILESYSTEMS=1 to run on all filesystems * TST_FORMAT_DEVICE=1 to get loop device formatted * TST_MOUNT_DEVICE=1 to get it mounted Filesystems (tested the usual LTP way on loop device) are used for server side (exportfs), client side (NFS mount) is kept outside of it. For some reason umounting needs some time before NFS server stops using underlying loop device. Also exportfs needs time before files can be removed. Otherwise second umounting fails: nfs07 4 TINFO: Cleaning up testcase umount: /var/tmp/LTP_nfs07.FNZ7yCbqZe/mntpoint: target is busy. nfs07 4 TINFO: umount(/var/tmp/LTP_nfs07.FNZ7yCbqZe/mntpoint) failed, try 1 ... nfs07 4 TINFO: Likely gvfsd-trash is probing newly mounted fs, kill it to speed up tests. umount: /var/tmp/LTP_nfs07.FNZ7yCbqZe/mntpoint: target is busy. Solved with adding two sleeps for 1 sec (using less is not enough, specially for nfs07.sh). Skipping some problematic filesystems: * exfat Although it works on some systems (e.g. openSUSE Tumbleweed with kernel 6.2.8-1-default, nfs-utils 2.6.2, exfatprogs 1.2.0), it fails on other systems (e.g. SLES 15-SP4 with kernel 5.14.21, nfs-utils 2.1.1, exfatprogs 1.0.4 or Debian 12 bookworm with kernel 6.1.0-6-amd64, nfs-utils 2.6.2, exfatprogs 1.2.0) * tmpfs on nfs-utils < 2 tmpfs fails on nfs-utils 1.3.3: nfs07 1 TINFO: mount.nfs: (linux nfs-utils 1.3.3) nfs07 1 TINFO: setup NFSv4.2, socket type tcp nfs07 1 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=4.2 10.0.0.2:/tmp/LTP_nfs07.cex71Q5bxw/mntpoint/4.2/tcp /tmp/LTP_nfs07.cex71Q5bxw/4.2/0 mount.nfs: mount(2): No such file or directory mount.nfs: mounting 10.0.0.2:/tmp/LTP_nfs07.cex71Q5bxw/mntpoint/4.2/tcp failed, reason given by server: No such file or directory mount.nfs: timeout set for Mon Apr 24 21:34:02 2023 mount.nfs: trying text-based options 'proto=tcp,vers=4.2,addr=10.0.0.2,clientaddr=10.0.0.1' nfs07 1 TBROK: mount command failed But it works on nfs-utils 2.1.1 on SLE15-SP4. Signed-off-by: Petr Vorel --- I'd expect that c5528f40 ("Fix NFSv4 export of tmpfs filesystems") from 2.5.4 is needed, but it works in SLE 15-SP4 which is 2.1.1 and this patch was not backported. testcases/network/nfs/nfs_stress/nfs_lib.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index 042fea5e4..1c6657a14 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -28,7 +28,10 @@ NFS_PARSE_ARGS_CALLER="$TST_PARSE_ARGS" TST_OPTS="v:t:$TST_OPTS" TST_PARSE_ARGS=nfs_parse_args TST_USAGE=nfs_usage -TST_NEEDS_TMPDIR=1 +TST_ALL_FILESYSTEMS=1 +TST_SKIP_FILESYSTEMS="exfat" +TST_MOUNT_DEVICE=1 +TST_FORMAT_DEVICE=1 TST_NEEDS_ROOT=1 TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs mount.nfs" TST_SETUP="${TST_SETUP:-nfs_setup}" @@ -68,7 +71,7 @@ get_remote_dir() local v="$1" local n="$2" - echo "$TST_TMPDIR/$v/$n" + echo "$TST_MNTPOINT/$v/$n" } nfs_get_remote_path() @@ -165,6 +168,7 @@ nfs_setup() local local_dir local remote_dir local mount_dir + local util_version if [ "$(stat -f . | grep "Type: nfs")" ]; then tst_brk TCONF "Cannot run nfs-stress test on mounted NFS" @@ -178,6 +182,14 @@ nfs_setup() tst_res TINFO "$(mount.nfs -V)" + util_version=$(mount.nfs -V | sed 's/.*nfs-utils \([0-9]\)\..*/\1/') + if ! tst_is_int "$util_version"; then + tst_brk TBROK "Failed to detect mount.nfs major version" + fi + if [ "$TST_FS_TYPE" = "tmpfs" ] && [ "$util_version" -lt 2 ]; then + tst_brk TCONF "Testing tmpfs requires nfs-utils > 1" + fi + for i in $VERSION; do type=$(get_socket_type $n) tst_res TINFO "setup NFSv$i, socket type $type" @@ -210,6 +222,7 @@ nfs_cleanup() grep -q "$local_dir" /proc/mounts && umount $local_dir n=$(( n + 1 )) done + sleep 1 n=0 for i in $VERSION; do @@ -219,12 +232,15 @@ nfs_cleanup() if tst_net_use_netns; then if test -d $remote_dir; then exportfs -u *:$remote_dir + sleep 1 rm -rf $remote_dir fi else tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir" + sleep 1 tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir" fi + n=$(( n + 1 )) done }