2 NFS4ERR_NOENT

Parent Previous Next


https://www.rfc-editor.org/rfc/rfc8881#err_NOENT


15.1.4.8. NFS4ERR_NOENT (Error Code 2)

Indicates no such file or directory. The file or directory name specified does not exist.



1. What is NFS4ERR_NOENT?


NFS4ERR_NOENT means:


“The named file or directory does not exist.”


It is the NFSv4 equivalent of the POSIX error:


ENOENT  (No such file or directory)



2. Where NFS4ERR_NOENT can occur


NFS4ERR_NOENT is returned by path-based or name-based operations, most commonly:


LOOKUP


LOOKUPP


REMOVE


RENAME


OPEN (when using a filename)


CREATE


READDIR (for stale directory entries)


It is not returned by pure filehandle-based operations like READ or WRITE.



3. NFS4ERR_NOENT and LOOKUP (most common)


Example


Client sends:


PUTFH <directory fh>

LOOKUP "foo"



Server response:


LOOKUP → NFS4ERR_NOENT



Meaning:


The directory exists, but "foo" is not present in it.


4. Common real-world causes


① File was deleted by another client


Another client removed or renamed the file


Client cache still references the old name


② Race conditions (TOCTOU)


Typical pattern:


LOOKUP

NVERIFY

OPEN



Between operations:


File gets removed


LOOKUP or OPEN returns NFS4ERR_NOENT


③ Negative dentry cache mismatch


Client believes a name exists


Server metadata has already changed


Common in:


high-churn directories


multi-client workloads


④ Wrong directory filehandle


PUTFH points to the wrong directory


Path traversal bug or stale FH logic


Result: expected name not found


⑤ Case sensitivity differences


NFS is case-sensitive


Foo ≠ foo


Very common when Windows/macOS expectations leak in


5. Difference between NOENT and related errors


Status        Meaning

NFS4ERR_NOENT        Name does not exist

NFS4ERR_NOTDIR        Path component is not a directory

NFS4ERR_EXIST        Name already exists

NFS4ERR_STALE        Filehandle is invalid

NFS4ERR_BADHANDLE        Malformed FH


6. NOENT vs STALE (important distinction)


This is often misunderstood:


NOENT

→ name lookup failed


STALE

→ filehandle refers to an object that no longer exists


So:


LOOKUP "foo" → NOENT

READ <old fh> → STALE



Both can occur in the same workload.


7. In COMPOUND operations


If any operation in a COMPOUND fails:


The COMPOUND stops


That operation’s status is returned


Example:


PUTFH

LOOKUP "foo" → NFS4ERR_NOENT

GETATTR      (not executed)


8. Is NFS4ERR_NOENT an error?


Protocol perspective


✔️ Correct and expected


Application perspective


Often normal


Especially in:


build systems


temporary file workflows


lockfile creation






Why NFS4ERR_NOENT can be returned by CREATE


This is a common point of confusion because people assume:


“CREATE should always create the file if it doesn’t exist.”


That assumption is incorrect in NFSv4.



Key rule: CREATE requires an existing parent directory


The object being created may not exist — that’s normal.

But the parent directory MUST exist.


If it does not, the server returns:


NFS4ERR_NOENT

www.traceinside.com