removed typo
Clean up use of NFS4ERR_BADHANDLE vs NFS4ERR_STALE

A handle that COULD be a valid Ganesha handle, that happens to not be
valid currently (for example, exportid doesn't reference a currently
valid export), or a PseudoFS ID that is in range, but not currently
valid should result in NFS4ERR_STALE.

NFS4ERR_BADHANDLE should be reserved for handles that are badly formed
or otherwise could not ever be a valid Ganesha handle. We also more
carefullly check handle validity, and make checks in order such that
there won't be any surprises, like indexing beyond end of provided
handle.

We must also properly validate PseudoFS handles by the same criteria.

NFS v3 and NLM validate handles during nfs_rpc_execute. If the handle
is bad or the exportid is bad, an SVC AUTH error was sent. This is
wrong, we must send NFS3ERR_BADHANDLE for bad handles and
NFS4ERR_STALE for invalid exportid. Because NLM has ASYNC procedures,
we allow a NULL pexport to be passed to NLM procedures that take
handles, and let the procedure handle responding. NFS procedures will
be responded to within nfs_rpc_execute.

Additionally, remove CACHE_INODE_UNAPPROPRIATED_KEY and
STATE_UNAPPROPRIATED_KEY since these errors are never used (and
were translated into NFS4ERR_BADHANDLE which is probably not the right
error if we ever did have that return code.

Several handle validation routines return an NFS4ERR, we now use the
returned value in most cases (except for RESTOREFH which has a specific
error code to report empty SavedFH.

Added nfs4_sanity_check_SavedFH to simplify checking of SavedFH and
remove duplicate code.

Fix PUBFH. We were not setting the length of it, so it was taking
maximum length and this was not equal to ROOTFH. The length of a
PseudoFS handle is also now computed the same way a normal handle
length is computed.

NFS v2/v3 LINK and RENAME operations should properly validate
the destination directory handle and properly report errors.

Clean up how handle errors are logged. LogInfo is used so that
sysadmins can debug handle issues without having to see gory
code internals.

Replace nfs4_sprint_fhandle with sprint_fhandle4 (remove duplicate
code).

Replace print_buff with new routine print_fhandle_fsal for FSAL handles
to be more informative.

Signed-off-by: Frank S. Filz <ffilz@us.ibm.com>
Strip deprecated LRU, RPCAL, DRC, File_Content code

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Make generic ACL code and GPFS ACL code same so GPFS can use generic

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Fixup cache inode hash functions in shell

The shell was using different cache inode hash functions than
Ganesha. Use the same ones and get rid of the crufty ones.:wq

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Remove use of log_snprintf and log_fprintf from shell and Log/test_liblog_functions.c

NOTE: shell/commands_Cache_inode.c depends on long deprecated special
Ganesha formatting codes. These fprintf will not work...

Since Ganesha no longer has it's own snprintf implementation
for logging, there is no need to test it.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Get rid of _USE_GHOSTFS

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Remove dead nfs_tools code

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Strip ifdefed out code from FSAL_VFS

sprint_mem will be deprecated...

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Changed Nb_Worker from 128 to 512

Signed-off-by: suhrud <supatank@in.ibm.com>
Generate a core dump if a hang is detected.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
Add display.h and safe display buffers

A struct display_buffer describes a string buffer and the current position
within it so that a string can be built of various components. This is
especially useful for nested display functions for data types, where
the top level display function may call display functions for sub-data types.

While building a complex string, users SHOULD check the return value from
each display function and exit if it is <= 0, however, continuing to call
display functions will be totally safe.

The only things that MUST be done if building a new display primitive is
to call display_start at the beginning and display_finish at the end. A
display primitive is a function that uses a non-display function (such as
strcat, memcpy, sprintf) to copy bytes into the buffer. Such primitives must
assure that any such routines do not overflow the buffer, and then the
primitive must manage the b_current. display_finish will handle proper
indication of a full buffer or buffer overflow.

The core routines:

display_start validate and prepare to start appending to the buffer.
display_finish wrap up after appending to the buffer.
display_reset_buffer reset a buffer for re-use to build a new string.
display_printf append to the string using printf formatting
display_opaque_value format an opaque value into the buffer
display_cat append a simple string to the buffer

Additional documentation may be found in the Doxygen comments within
the source.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Add simple log macro to log opaque values

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Use display buffer in log_functions

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Add display_sockaddr to use display buffer for sockaddr/sockip

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Disable hash table display functions

Hash table display functions will be converted to use display buffer.
Disabling all of them allows for piecemeal re-implementation.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Remove unused cache inode hash display functions

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Use display buffer in hash table for display functions

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Use display buffer for ip name

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Use display buffer for ip stats

Signed-off-by: Frank Filz <ffilz@us.ibm.com>