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 .nfstest file 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, like 3, 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 with nohup πŸŽ€

πŸ“ Packet trace options πŸ“

for the girls who love packet forensics:

  • --createtraces β€” create a packet trace for each test
  • *--tbsize=TBSIZE* β€” capture buffer size for tcpdump [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 --createtraces instead unless you're trying to get a packet trace for one specific sub-test. it's best in combination with the --runtest option.

🧚 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 for sudo [default: '/usr/bin/sudo']
  • *--kill=KILL* β€” full path of binary for kill [default: '/usr/bin/kill']
  • *--nfsstat=NFSSTAT* β€” full path of binary for nfsstat [default: '/usr/sbin/nfsstat']
  • *--tcpdump=TCPDUMP* β€” full path of binary for tcpdump [default: '/usr/sbin/tcpdump']
  • *--iptables=IPTABLES* β€” full path of binary for iptables [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 πŸ‘€


πŸ’€ 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 πŸ’–βœ¨