diff options
author | Jeff Layton <jlayton@kernel.org> | 2024-01-16 12:31:27 -0500 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2024-02-05 14:21:21 +0800 |
commit | b3da25544c60103f391f9013151e87dd24dfcdcc (patch) | |
tree | 795e98c845d1756fc8329a5692bb37a01fcb45e0 | |
parent | 79e87ccf207fc6cd1478599118aca045dae983fa (diff) | |
download | xfstests-dev-b3da25544c60103f391f9013151e87dd24dfcdcc.tar.gz |
common/rc: NFSv2/3 do not support negative timestamps
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 <jlayton@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r-- | common/rc | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -2916,6 +2916,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 @@ -2939,7 +2960,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 $? ;; @@ -5143,6 +5164,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 } |