NFSTEST_LOCK(1)
π NFSTEST_LOCK π
okay bestie, welcome to nfstest_lock β it's the nfstest_lock 1.3 tool, manual section 1, and it's literally the moment your NFS locking setup gets a full glow-up. grab a snack, this one's a long one but we're doing it together π«Ά
β¨ NAME β¨
nfstest_lock β locking tests π
πΈ SYNOPSIS πΈ
nfstest_lock --server <server> [--client <client>] [options]
π¦ DESCRIPTION π¦
so the basic locking tests are like... the vibe check for whether a lock actually gets granted when you throw different arguments at fcntl. we're talking blocking locks and non-blocking locks, read locks and write locks, and the file gets opened for reading, writing, or both β all the combos. it also pokes at different ranges, including the limit conditions, because edge cases are where the drama lives π
then the non-overlapping tests make sure locks get granted on both the client under test and a second process or a remote client when they're locking the same file. everybody eats, no conflict, iconic π
and the overlapping tests?? that's where it gets spicy π₯ a lock gets granted on the client under test, and meanwhile a second process or remote client tries to lock the same file β and they get denied if they issued a non-blocking lock, or blocked if they issued a blocking lock. no cap, that's the whole point.
π OPTIONS π
the basics, the little starter pack:
--versionβ shows the program's version number and dips β¨-h,--helpβ shows this help message and dips β¨- *
-f*FILE,--file=FILE β the file where options are specified, on top of the system wide file/etc/nfstest, the user wide file$HOME/.nfstest, or the.nfstestfile in the current directory ποΈ
π NFS specific options π
the NFS-flavored stuff, periodt:
- *
-s*SERVER,--server=SERVER β server name or IP address π‘ - *
-e*EXPORT,--export=EXPORT β exported file system to mount [default:'/'] - *
--nfsversion=NFSVERSION* β NFS version, like3,4,4.1, etc. [default:4.1] - *
-m*MTPOINT,--mtpoint=MTPOINT β mount point [default:'/mnt/t'] - *
-p*PORT,--port=PORT β NFS server port [default:2049] - *
--proto=PROTO* β NFS protocol name [default:'tcp'] - *
--sec=SEC* β security flavor [default:'sys'] - *
--nconnect=NCONNECT* β multiple TCP connections option [default:'1'] - *
-o*MTOPTS,--mtopts=MTOPTS β mount options [default:'hard,rsize=4096,wsize=4096'] - *
--datadir=DATADIR* β data directory where files are created; the directory gets created on the mount point [default:'']
π Logging options π
for when you want receipts π:
- *
-v*VERBOSE,--verbose=VERBOSE β verbose level for debug messages [default:'opts|info|dbg1|dbg2|dbg3'] - *
--tverbose=TVERBOSE* β verbose level for test messages [default:'2'] --createlogβ create log file--rexeclogβ create rexec log files--warningsβ display warnings β οΈ- *
--tag=TAG* β informational tag, displayed as an INFO message [default:''] --nottyβ do not use terminal colors on output--isattyβ use terminal colors on output β lowkey useful when running withnohupπ
π Packet trace options π
for the girls who love packet forensics:
--createtracesβ create a packet trace for each test- *
--tbsize=TBSIZE* β capture buffer size fortcpdump[default:192k] - *
--trcdelay=TRCDELAY* β seconds to delay before stopping packet trace [default:2.0] --keeptracesβ do not remove any trace files [default: remove trace files if no errors]--rmtracesβ remove trace files [default: remove trace files if no errors]- *
-i*INTERFACE,--interface=INTERFACE β device interface [default: automatically selected] --subtracesβ create a packet trace for each sub-test. > bestie, use this with caution because it will create a lot of packet traces π use--createtracesinstead unless you're trying to get a packet trace for one specific sub-test. it's best in combination with the--runtestoption.
π§ File options π§
- *
--nfiles=NFILES* β number of files to create [default:2] - *
--filesize=FILESIZE* β file size to use for test files [default:64k] - *
--rsize=RSIZE* β read size to use when reading files [default:4k] - *
--wsize=WSIZE* β write size to use when writing files [default:4k] - *
--iodelay=IODELAY* β seconds to delay I/O operations [default:0.1] - *
--offset-delta=OFFSET_DELTA* β read/write offset delta [default:4k]
πΈ Path options πΈ
where all your little binaries live:
- *
--sudo=SUDO* β full path of binary forsudo[default:'/usr/bin/sudo'] - *
--kill=KILL* β full path of binary forkill[default:'/usr/bin/kill'] - *
--nfsstat=NFSSTAT* β full path of binary fornfsstat[default:'/usr/sbin/nfsstat'] - *
--tcpdump=TCPDUMP* β full path of binary fortcpdump[default:'/usr/sbin/tcpdump'] - *
--iptables=IPTABLES* β full path of binary foriptables[default:'/usr/sbin/iptables'] - *
--messages=MESSAGES* β full path of log messages file [default:'/var/log/messages'] - *
--trcevents=TRCEVENTS* β full path of tracing events directory [default:'/sys/kernel/debug/tracing/events'] - *
--trcpipe=TRCPIPE* β full path of trace pipe file [default:'/sys/kernel/debug/tracing/trace_pipe'] - *
--tmpdir=TMPDIR* β temporary directory [default:'/tmp']
π Debug options π
main character debugging energy:
--nocleanupβ do not cleanup created files π--notimestampsβ do not display timestamps in debug messages- *
--bugmsgs=BUGMSGS* β file containing test messages to mark as bugs if they failed --nomountβ do not mount server and run the tests on local disk space- *
--basename=BASENAME* β base name for all files and logs [default: automatically generated] - *
--nfsdebug=NFSDEBUG* β set NFS kernel debug flags and save log messages [default:''] - *
--rpcdebug=RPCDEBUG* β set RPC kernel debug flags and save log messages [default:''] - *
--tracepoints=TRACEPOINTS* β list of trace points modules to enable [default:''] --nfsstatsβ get NFS stats [default:'False']--pktdispβ display main packets related to the given test--nfserrorsβ fail every NFS error found in the packet trace- *
--client-ipaddr=CLIENT_IPADDR* β IP address of localhost
β Reporting options β
--xunit-reportβ generate xUnit compatible test report π- *
--xunit-report-file=XUNIT_REPORT_FILE* β path to xout report file
π₯ Test options π₯
this is the good part, buckle up:
- *
--runtest=RUNTEST* β comma separated list of tests to run; if the list starts with a'^'then all tests are run except the ones listed [default:'all'] - *
--client=CLIENT* β remote NFS client and options used for conflicting lock tests. clients are separated by a','and each client definition is a list of arguments separated by a':'given in the following order if positional arguments is used (see examples):clientname:server:export:nfsversion:port:proto:sec:mtpoint - *
--nfsopts=NFSOPTS* β local process NFS options used for conflicting lock tests. processes are separated by a','and each process definition is a list of arguments separated by a':'given in the following order if positional arguments is used (see examples)::server:export:nfsversion:port:proto:sec:mtpoint - *
--offset=OFFSET* β offset of first lock granted [default:4k] - *
--length=LENGTH* β length of first lock granted [default:4k] - *
--unlock-delay=UNLOCK_DELAY* β time in seconds to unlock first lock [default:2.0] - *
--lockw-timeout=LOCKW_TIMEOUT* β time in seconds to wait for blocked lock after conflicting lock has been released [default:30] - *
--opentype=OPENTYPE* β list of open types to test [default:read,write,rdwr] - *
--locktype=LOCKTYPE* β list of lock types to test [default:read,write] - *
--opentype2=OPENTYPE2* β list of open types to test on remote client [default:read,write,rdwr] - *
--locktype2=LOCKTYPE2* β list of lock types to test on remote client [default:read,write] - *
--setlock=SETLOCK* β list of set lock types to test [default:immediate,block]
β¨ TESTS β¨
okay bestie, here's the whole test menu π each one is checking a different locking vibe, and you're gonna slay every single one.
btest01
Basic locking tests π
These tests verify that a lock is granted using various arguments to fcntl. That includes blocking and non-blocking locks, read or write locks, and the file being opened for reading, writing, or both. It also checks different ranges, including limit conditions.
noverlap
Run all the non-overlapping locking tests: nptest01, nptest02, nptest03, nptest04, nctest01, nctest02, nctest03, nctest04
nptest
Run all non-overlapping locking tests using a second process: nptest01, nptest02, nptest03, nptest04
nptest01
Locking non-overlapping range from a second process where end2 < start1
process1: |------------------|
process2: |--------|
nptest02
Locking non-overlapping range from a second process where end2 == start1 - 1
process1: |------------------|
process2: |------------------|
nptest03
Locking non-overlapping range from a second process where start2 > end1
process1: |------------------|
process2: |--------|
nptest04
Locking non-overlapping range from a second process where start2 == end1 + 1
process1: |------------------|
process2: |------------------|
nctest
Run all non-overlapping locking tests using a second client: nctest01, nctest02, nctest03, nctest04
nctest01
Locking non-overlapping range from a second client where end2 < start1
client1: |------------------|
client2: |--------|
nctest02
Locking non-overlapping range from a second client where end2 == start1 - 1
client1: |------------------|
client2: |------------------|
nctest03
Locking non-overlapping range from a second client where start2 > end1
client1: |------------------|
client2: |--------|
nctest04
Locking non-overlapping range from a second client where start2 == end1 + 1
client1: |------------------|
client2: |------------------|
overlap
Run all overlapping locking tests: optest01, optest02, optest03, optest04, optest05, optest06, optest07, optest08, optest09, octest01, octest02, octest03, octest04, octest05, octest06, octest07, octest08, octest09
optest
Run all overlapping locking tests using a second process: optest01, optest02, optest03, optest04, optest05, optest06, optest07, optest08, optest09
optest01
Locking same range from a second process
process1: |------------------|
process2: |------------------|
optest02
Locking overlapping range from a second process where start2 < start1
process1: |------------------|
process2: |------------------|
optest03
Locking overlapping range from a second process where end2 > end1
process1: |------------------|
process2: |------------------|
optest04
Locking overlapping range from a second process where range2 is entirely within range1
process1: |------------------|
process2: |--------|
optest05
Locking overlapping range from a second process where range1 is entirely within range2
process1: |------------------|
process2: |----------------------------|
optest06
Locking full file range from a second process
optest07
Locking overlapping range from a second process where end2 == start1
process1: |------------------|
process2: |------------------|
optest08
Locking overlapping range from a second process where start2 == end1
process1: |------------------|
process2: |------------------|
optest09
Locking overlapping range from multiple processes where range2 and range3 are entirely within range1
process1: |-----------------------------|
process2: |--------|
process3: |--------|
octest
Run all overlapping locking tests using a second client: octest01, octest02, octest03, octest04, octest05, octest06, octest07, octest08, octest09
octest01
Locking same range from a second client
client1: |------------------|
client2: |------------------|
octest02
Locking overlapping range from a second client where start2 < start1
client1: |------------------|
client2: |------------------|
octest03
Locking overlapping range from a second client where end2 > end1
client1: |------------------|
client2: |------------------|
octest04
Locking overlapping range from a second client where range2 is entirely within range1
client1: |------------------|
client2: |--------|
octest05
Locking overlapping range from a second client where range1 is entirely within range2
client1: |------------------|
client2: |----------------------------|
octest06
Locking full file range from a second client
octest07
Locking overlapping range from a second client where end2 == start1
client1: |------------------|
client2: |------------------|
octest08
Locking overlapping range from a second client where start2 == end1
client1: |------------------|
client2: |------------------|
octest09
Locking overlapping range from multiple clients where range2 and range3 are entirely within range1
client1: |-----------------------------|
client2: |--------|
client3: |--------|
all
Run all tests: btest01, nptest01, nptest02, nptest03, nptest04, nctest01, nctest02, nctest03, nctest04, optest01, optest02, optest03, optest04, optest05, optest06, optest07, optest08, optest09, octest01, octest02, octest03, octest04, octest05, octest06, octest07, octest08, octest09
π EXAMPLES π
Run the tests which use only the main client (no --client option):
nfstest_lock --server 192.168.0.2 --export /exports
Use short options instead:
nfstest_lock -s 192.168.0.2 -e /exports
Use positional arguments with nfsversion=3 for extra client:
nfstest_lock -s 192.168.0.2 -e /exports --client 192.168.0.10:::3
Use named arguments instead:
nfstest_lock -s 192.168.0.2 -e /exports --client 192.168.0.10:nfsversion=3
Use positional arguments with nfsversion=3 for second process:
nfstest_lock -s 192.168.0.2 -e /exports --nfsopts :::3
Use named arguments instead:
nfstest_lock -s 192.168.0.2 -e /exports --nfsopts nfsversion=3
π NOTES π
The user id in the local host and the host specified by --client must have access to run commands as root using the sudo command without the need for a password.
The user id must be able to ssh to remote host without the need for a password.
π SEE ALSO π
baseobj(3)formatstr(3)nfstest.test_util(3)nfstest_alloc(1)nfstest_cache(1)nfstest_delegation(1)nfstest_dio(1)nfstest_fcmp(1)nfstest_file(1)nfstest_interop(1)nfstest_io(1)nfstest_pkt(1)nfstest_pnfs(1)nfstest_posix(1)nfstest_rdma(1)nfstest_sparse(1)nfstest_ssc(1)nfstest_xattr(1)nfstest_xid(1)packet.nfs.nfs3_const(3)packet.nfs.nfs4_const(3)packet.nfs.nlm4_const(3)
π BUGS π
No known bugs. periodt π
π AUTHOR π
Jorge Mora (mora@netapp.com)
This iconic page is from NFStest 3.2, dated 21 March 2023, and it's the NFSTEST_LOCK(1) manual. slay, bestie πβ¨
π¦ where this page comes from
- debian trixie: nfstest 3.2-3
- fedora 43: NFStest 3.2-14.fc43 Β· GPL-2.0-or-later
- fedora 44: NFStest 3.2-16.fc44 Β· GPL-2.0-or-later
- ubuntu noble: nfstest 3.2-2
- ubuntu questing: nfstest 3.2-3
- ubuntu resolute: nfstest 3.2-3build1
- ubuntu stonking: nfstest 3.2-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms