Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp591930rdb; Tue, 16 Jan 2024 09:31:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGhQS8dI3CLg8HBuwN6xljYCQLrO4XypkHRJ+BpzxFmfFPoH698dlIQBcXrQ/aNF/+kaG4 X-Received: by 2002:a05:6402:14d8:b0:558:cce3:4ddd with SMTP id f24-20020a05640214d800b00558cce34dddmr2909182edx.78.1705426292674; Tue, 16 Jan 2024 09:31:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705426292; cv=pass; d=google.com; s=arc-20160816; b=Cuk9SaepYfHr2h77BLJl1DZ+Y6zpOXv2eXXehHHpNXVmduORDc3BLD3/DulxRY84dJ bPvP/db2TtwEKYfu+fsB989QgEPbDz6g1qyXD4w21Hcp70w1VUMiutfSgXLO0OphbqzU Uw/q9Of3dmqUDA0PNG4YhCbG3Jf/2P6C2zuDk6PWdJIAD+xs6EPf/YhJCgDt7D3Gu0pd hygdBHLfNXsBmVqB1fAcMYO5r/xxW5mxL8hq8qiZ5dBokRqeIOlIosNqbdAUUq3jMFh1 XxKFIy87ryCtcA1VU0w4Ee09V0ilYAO5QSleyXCspVPjP8kaQix81bmyYKw28w2qhIUr rU9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=+M1J7oh/c01/HWQUOJr4IAjF72Ysv3AEChC01TR+RuQ=; fh=ISf+s8rUs3NJuLPpnNNG0Wjc8IZ2aaDtGdJk+f2L2K8=; b=BDH/1Zqp4IMMOukoKwaGi2I/BHpTEiZ+Fh4Y6iSRmWum9/27APHA+kn75kha8kV9a1 yU54f816EudOBK29qa/dpc7gbmistVsnUPfPrPWNZbIKhUw/qgmy9kACHg2qUhULlo3K n7YT7qJ+n0vN6RteeUhmxY8EpdXve2+CseYZxupJmXGKFqpGmpEKS8yDM6lx1+CCqFUI jBP2uKI/FFxt9nYZcjl9enzacqBlDQ3J2r4DS7djTth+TF0YOaSa0KX1eYlYqFUdrbN3 AuhFIldT/WbtQm3K+8nhikmTSh6jRLNSxG0wkxCbRqIi0LYrDI381x9+rNXt+pxHKL1W hjNg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XxW6C+pT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1135-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1135-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y100-20020a50bb6d000000b00558dcdb338asi4048352ede.484.2024.01.16.09.31.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 09:31:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1135-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XxW6C+pT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1135-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1135-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 657021F23CF6 for ; Tue, 16 Jan 2024 17:31:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFAF31CAA9; Tue, 16 Jan 2024 17:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XxW6C+pT" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9836E1CA8C; Tue, 16 Jan 2024 17:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705426289; cv=none; b=fDypwbvobGJgRN/7IokQAdTVQvwgtkDIZhuN2MjQSnO6PgxNnjvLj2/U6eB6vrkBiS8uXSN8roloyP2vF7sO8+D++fe28RwRjP3qdbTa8Wmj2ieeQZOdn3hLd4i4761Him92sc1pEQXmm375lvRga/zEKgKGC13oZ1jQRVj4nJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705426289; c=relaxed/simple; bh=U/6k863bSOdTRHr/YigdbpLvuc4GxzvU4FIVevvOFug=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding; b=L+VzXoVCr4GA0Qvw82/xlYRLDm23cE0sOjONZch/CaS28NXjdAAG0SILbQjf1wBTUq7unRFkwMmjHTkb44ci13a3+Bcg1vW+w2n1nY1JS67Vb5QD4OztXuDyg56NPoILUvMdS8veoix3lO5uvcxufV8mS7bQvJi2NbUZiXT3vC4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XxW6C+pT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFFE4C433F1; Tue, 16 Jan 2024 17:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705426289; bh=U/6k863bSOdTRHr/YigdbpLvuc4GxzvU4FIVevvOFug=; h=From:To:Cc:Subject:Date:From; b=XxW6C+pT1WK6ZelHTJEgqS50xo2/gLkTjaEs6Q+FmPbs0A+qPH2ixlemnf6VlNPXc pbEj7qjxDm7D7bsq9VXzatw+2gZluo1zzH2FsgoddfZmbVAiCv2nvHM3ijt/bfPKvX xVuOHFH1+NZU7JwX/9B3VwakcM+n3A+pRaTm31DIVtck8FLuu8lKcC9X6IyFqTBb6J VLmEqfddBT+i/WM4jKX+KMeG7Mu/sb4A4MLcvyplhMZ7zixTLB1HD327pardfnrekD vIHoJ7B59kjk5a/SIhOWzF2S4uDe7nBNzizFSY71eN5N/ShbXBJFJn5OgAYMW8yfX1 0/Nj3Fnegyw+A== From: Jeff Layton To: fstests@vger.kernel.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH fstests] common/rc: NFSv2/3 do not support negative timestamps Date: Tue, 16 Jan 2024 12:31:27 -0500 Message-ID: <20240116173127.238994-1-jlayton@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The NFSv2 and v3 protocols use unsigned values for timestamps. Fix _require_negative_timestamps() to check the NFS version and _notrun if it's 2 or 3. Signed-off-by: Jeff Layton --- common/rc | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index a9e0ba7e22f1..d4ac0744fab0 100644 --- a/common/rc +++ b/common/rc @@ -2902,6 +2902,27 @@ _require_debugfs() [ -d "$DEBUGFS_MNT/boot_params" ] || _notrun "Debugfs not mounted" } +# +# Return the version of NFS in use on the mount on $1. Returns 0 +# if it's not NFS. +# +_nfs_version() +{ + local mountpoint=$1 + local nfsvers="" + + case "$FSTYP" in + nfs*) + nfsvers=`_mount | grep $1 | sed -n 's/^.*vers=\([0-9.]*\).*$/\1/p'` + ;; + *) + nfsvers="0" + ;; + esac + + echo "$nfsvers" +} + # The default behavior of SEEK_HOLE is to always return EOF. # Filesystems that implement non-default behavior return the offset # of holes with SEEK_HOLE. There is no way to query the filesystem @@ -2925,7 +2946,7 @@ _fstyp_has_non_default_seek_data_hole() nfs*) # NFSv2, NFSv3, and NFSv4.0/4.1 only support default behavior of SEEK_HOLE, # while NFSv4.2 supports non-default behavior - local nfsvers=`_mount() | grep $TEST_DEV | sed -n 's/^.*vers=\([0-9.]*\).*$/\1/p'` + local nfsvers=$( _nfs_version "$TEST_DIR" ) [ "$nfsvers" = "4.2" ] return $? ;; @@ -5129,6 +5150,16 @@ _require_negative_timestamps() { ceph|exfat) _notrun "$FSTYP does not support negative timestamps" ;; + nfs*) + # + # NFSv2/3 timestamps use 32-bit unsigned values, and so + # cannot represent values prior to the epoch + # + local nfsvers=$( _nfs_version "$TEST_DIR" ) + if [ "$nfsvers" = "2" -o "$nfsvers" = "3" ]; then + _notrun "$FSTYP version $nfsvers does not support negative timestamps" + fi + ;; esac } -- 2.43.0