Implement new clientid function

Use new abstract_mem.h

This is a pretty big change, many of the major points are
discussed below.

Convert SETCLIENTID and SETCLIENTID_CONFIRM to new clientid.

Convert EXCHANGE_ID and CREATE_SESSION to new clientid. These functions
now more closely follow RFC 5661. They are not perfect, but pass a
signiificant number of pynfs tests.

Make clientid owner part of client id structure. This allows each
clientid record to have it's own owner.

Add valid_lease function for EXCHANGE_ID to use.

Remove some unused clientid constants and cid_client_name field.

Remove obsolete clientid parameter from nfs4_Check_Stateid.

Extract confirmed and unconfirmed reaping into function to save dupe code.

Make NFS4 and NFS41 LOCK, LOCKU, and LOCKT code more alike. Add grace
period checking to v4.1. Fix up lock/open owner confusion in v4.1 LOCKT.
Fix up reuse of lock owner that didn't have attached open owner (LOCK
reusing lock owner from LOCKT). And several cosmetic changes (including
putting variables unique to v4 LOCK together for easier diff between
v4 and v4.1 code.

Use new lease expiry for operations that use SEQUENCE or pass a stateid.
Lease is reserved early, and when the compound is complete, then the
reservation is released and the lease time updated. All v4.1 operations
use this since they start with a SEQUENCE op. For v4.0 operations, this
is used when the operation looks up a stateid.

Add new functions to manage leases.

reserve_lease_lock atomically checks if lease is valid, and if so
also reserves the lease to prevent expiry while the lease is in
use by an operation. It returns with cid_mutex held.

update_lease releases a lease reservation and also actually
performs the lease renewal.

update_lease_locked must be called holding cid_mutex.

These operations make sure that once a lease renewing operation
starts, no matter how long it takes to complete, the lease will
not expire, and at the end of the operation, the lease will be
renewed.

valid_lease_locked allows checking lease validity while already
holding cid_mutex.

Also add pointer to reserved clientid in compound_data_t.

Split client id hash table into confirmed and unconfirmed tables. We need
to be able to look up both confirmed and unconfirmed client ids. The
assumption is that for any clientid4 value there is at most one confirmed
client id and one unconfirmed client id. For a given long form client id,
there might be multiple unconfirmed client ids, but still only a single
confirmed client id. Also add function for generating new
setclientid_confirm values.

Add function to compute new clientid4 .The short form clientid4 can not
just be a hash of the long form client id. The spec outlines conditions
under which a different clientid4 must be issued. We also need to know
when clientid4 is from another instance of Ganesha, old or in cluster
environment from a different node. To this extent, a new clientid4 will
be computed using a 32 bit counter and ServerEpoch.

Add hash table for long form client id values.

Add reference counting to nfs_client_id_t. The reference counting is not
perfect. There are some uses of nfs_client_id_t for example in the
PNFS code that may not be properly refcounted.

Refcounting uses the new abstract_atomic.h

Memory allocation uses the new pools in abstract_mem.h

Hash Tables use the new HashTable_GetLatch capability to atomically
add entries to the hash table and be cleaner on delete.

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

Conflicts:

	src/include/sal_data.h

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

Conflicts:

	src/include/sal_functions.h

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Fix up names of pointers to nfs_client_id_t

Many of these were pnfs_client_id which gets people thinking of pNFS from v4.1.

Standardize on pclientid for almost all pointers to nfs_client_id_t.

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

Conflicts:

	src/Protocols/NFS/nfs4_op_lockt.c
	src/Protocols/NFS/nfs4_op_open.c
	src/SAL/nfs4_clientid.c
Implement RELEASE_LOCKOWNER

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

Conflicts:

	src/Protocols/NFS/nfs4_op_release_lockowner.c
Fix NFS v4.1 session replay cache

Instead of trying to copy result into cache, take advantage that most of the
result of a COMPOUND is kept in Mem_Alloc memory, so just make this memory
owned by the cache, and have nfs4_Compound_Free delay freeing the memory.

Based on pynfs tests, there is still work to be done on session replay,
but it no longer causes crashes and actually passes some session replay
tests.

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

Conflicts:

	src/Protocols/NFS/nfs4_Compound.c
	src/include/nfs_exports.h
	src/include/sal_data.h

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Minor debug log changes in nlm_Lock.c and nsm.c

One debug indicated nlm_Test not nlm_Lock
Add nodename to Monitored and Unmonitored messages

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Several fixes found during testing of NLM_SHARE

nfs4_op_open and nfs41_op_open should use nfs4_Errno_state(state_status)
when returning error from state_add.

Be explicit about if(care != CARE_NOT) in Protocols/NLM/nlm_util.c

Get NSM Client references for locks in NSM Client lists, not NLM Client
references in SAL/state_lock.c.

Return NFS4ERR_SHARE_DENIED instead of NFS4ERR_PERM for STATE_STATE_CONFLICT
in nfs4_Errno_state.

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Cosmetic changes to files to be affected by NLM_SHARE work

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Add NLM_FREE_ALL, NLM_NM_LOCK, and empty stubs for NLM_SHARE and NLM_UNSHARE

NM_LOCK and FREE_ALL are simple wrappers around existing code.

SHARE and UNSHARE require more work and will be implemented in a subsequent
commit, but including them now gets all the protocol level infrastructure
in place.

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

Conflicts:

	src/Protocols/NLM/nlm_Lock.c
Add lists of NLM Share reservations plus state_nlm_share_t

Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com>
Implement NLM_SHARE and NLM_UNSHARE

Requires some changes to share routines used for NFS v4 to accomodate
NLM_SHARE. Since NFS v3 operations can not be tied to an NLM_SHARE,
but we should still enforce NFS v4 deny modes against v3 operations,
we also keep separate track of the v4 cumulative deny mode for each
file.

This implementation does not actually make use of that capability
yet.

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

Conflicts:

	src/Protocols/NLM/nlm_util.c

Conflicts:

	src/Protocols/NLM/nlm_util.c