Error Handling in n4 $Id: errors.txt,v 1.1 2001/05/17 05:46:08 mbp Exp $ The biggest complication in error handling is that errors may occur at several different layers of the protocol stack, and they have to be reported at the corresponding layer. Sun make this process more difficult by using the same low numbers for different errors depending on context. In every case, we want to log the error and roll the server back to an appropriate enclosing scope. Also, if there is an error in a response, then we can't send an error back to the server. We need to pass an appropriate description to higher level local software, which might decide for example to retry the request. The layers are, from the bottom up: * Networking error: Can't even receive a whole packet correctly. There's not much we can do except close the socket, since we suspect the client is not doing NFS, or badly desynchronized, or there is an error in some underlying system. * RPC error: Examples: bad RPC version or NFS version, or an incomplete packet, or garbage arguments. ONC-RPC actually has two cases here: accepted and Some cases, such as truncated arguments, may not be detected until parsing is almost complete, but we still need to be able to report the error at this level. This requires throwing away the partially-generated response and replacing it with an error message. This should be simple if caught at the right level, since the output packet is in a pool and can just be discarded. * NFS operation failed: Examples: file not found, readonly filesystem, stale filehandle, lock expired, ... There are many of these. Some are only supported by later versions of NFS, and we might have to fold them downwards for older versions. They're generated by particular sub-operations inside a compound, and indicate partial success. We want to send back a completion packet, which has all the results up to that point. Since the most numerous error codes at the nfsstat4 codes, we'll use them, with extended error codes for internal use. If we get an internal error after processing of packet contents has started, then we need to translate it into a lower-level error.