Add signature for atomic fetch/store uintptr_t.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add signature for atomic fetch/store void *.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Weakref.  Use atomic fetch/store for cached lookups.

The caller holds only a non-exclusive lock, which isn't
sufficient to update the cache.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Dont need atomic update when XLOCK.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
No more Mr. BadHash.

Introduce a new intrusive, AVL-based file handle to cache
entry lookups.

The new dictionary remains a tree keyed on 64-bit hash of
file handle, with fallback to bitwise handle comparison, the
following details are changed:

* AVL linkage is intrusive, no consing of opaque buffers
* all hashing is by the 64-bit CityHash, no exceptions

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

Conflicts:
	src/Cache_inode/cache_inode_hash.c
	src/Cache_inode/cache_inode_misc.c
	src/include/cache_inode_hash.h

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Suppress unused result warning in print_debug_info_fd.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Force entries in LRU CQ or KILLED also !LRU (and !PINNED)

The correct change appears to be simply to call lru_remove_entry
on entries being scheduled for cleanup (having already prevented
further pins or references.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Use safe iterator (rather than restart) in lru per-lane processing.

This is the natural model, since we need to avoid
reprocessing entries (altogether).  For extra safety, count
the entries we do ignore as work performed.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Reduce default lru_run_interval to 60s.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Make cache_inode_lru_unref handle entries not in queue

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Fix creds problem in nfs4_MakeCred

A local copy of credentials was used for part of the credential work in
nfs4_MakeCred. Use the copy of the credentials in the req_ctx in all
places.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Rename _DEBUG_MEMLEAKS to DEBUG_SAL and make functional in cmake

The DEBUG_SAL cmake option compiles in some additional heavyweight
debug code in SAL to track all locks (stateids and state owners to
come).

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Fix some IPv6 compile issues

Ported from 1.5.x 24d98f405eb8968926abd3f7ac493f5fafed762e

Plus some additional fixes in 9p

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Add multilock tool to Ganesha tree

Ported from 1.5.x 2a943afcaf0dcc33df7cfff4d68f8742e0e92843

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Add some sample tests for multilock

Ported from 1.5.x c37a802adfdee3705fcc497a4e22b50b9a2963dd

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Convert state owners to use new HashTable_GetLatch

Using HashTable_GetLatch allows state owners to be created
without worry of race. The so_refcount is also converted to
an atomic uint32_t to allow refcounting without grabbing
so_mutex.

All state owners are hashed using the state_owner_t structure
as the key as well as the data. The key fields are all available
within the state_owner_t structure so the hash may use them
for key evaluation. This reduces memory use.

There is now a generic get_state_owner which will determine
which hash table to use based on so_type in the key. Callers
may indicate if they care if the owner is found or not, if they
don't care, a new owner is not created if not found.

Ported from commit 1.5.x a689549bdd15317dfe405b4683368e99c53108e1

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
With -DDEBUG_SAL, keep list of all state owners and stateids

To help track down memory leaks in SAL, keep a list of all state owners
and stateids. When clientid reaper thread has removed all clientids,
print the contents of the lists (which should be empty) to expose any
leaks.

Ported from 1.5.x d132b61eb49f1e46348417cc32014ba53fb14bad

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Strip out unused NFS_Core_Param

Strip out unused nb_current_gc_workers and Nb_MaxConcurrentGC config parm

Strip out FSAL_Shared_Library

Ported from 1.5.x c9b4b4fd6680e761bbeb4281e1f86664b38cb8aa

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
nfs4_op_secinfo need to handle lookup in pseudo fs.

Ported from 1.5.x e26012c86e4b734f6ce1d377a8e6a7665f2cba60

Signed-off-by: Rong Zeng <rongzeng@us.ibm.com>
Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Fix Pynfs RPLY5 RPLY7 RPLY12. Allow seqid based replay cache check if
stateid's seqid is one less than curent.

Also added state owner refcounting in open_confirm.

Ported from 1.5.x 045571890bef6d3543c482bdd1d4a168fe895a54

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