Enable config of export perms for EXPORT_DEFAULTS, EXPORT, and CLIENT

Along the way, deprecate some unused options and unify so all perms
options are set at all levels.

A new config block, EXPORT_DEFAULTS allows setting export permissions
to be used for all exports if not otherwise specified. This utilizes
the new capability of the config parser to track if an option has been
specified or not.

To establish the effective export permissions, each option is
effectively considered in turn (however all bit field options are
actually considered in parallell). If the option has been set in the
applicable CLIENT block, that value will be used, otherwise if set
in the EXPORT block, that value will be used, otherwise if set in
the EXPORT_DEFAULTS block, that value will be used, and finally, if
no configuration block has provided a value, then the code default
value will be used.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Rename NFS_Protocols Protocols, add 9P, Rename Transport_Protocols Transports, add RDMA

Also add some synonyms for specifyin NFS protocol versions:

V3, V4, NFS3, NFS4, NFSV3, and NFSV4.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove vestiges of NFS v2 from FSAL code

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove NFS v2 code from mnt_Mnt.c

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove NFS v2 handle functions

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove obsolete NFS v2 declarations

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Cosmetic house cleaning in Protocols/nfs3*.c

Decamelcase file names and protocol function names.

Rename nfs_ functions to nfs3_ (except nfs3_Null is used for all versions
so just call it nfs_null).

Eliminate references to NFS v2 from comments.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Implement removing gids cache entries.

The current code tries to update a gids cache entry with new
supplementary groups after manage_gids_expiration timeout (30 minutes by
default). The group_data structure is reference counted but is not
removed from the AVL trees. Thus a very active entry's refcount may
never go to zero. Due to a bug in the implementation, we actually free
the "groups" buffer while there may be active users.

This commit implements removing cache entry after expiration timeout.
This way, any new requests get reference on the newly created entry, and
eventually the removed entry's refcount should go to zero at which point
it gets freed.

Also "cache_info" now has a pointer to "group_data" rather than the
structure itself. This way, "cache_info" can be freed as soon as it gets
removed from the cache trees, and "group_data" gets freed when its
refcount goes to zero.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Verify the node we find in the hash array

Hash collisions are not handled. We simpley replace the old entry with
the new entry. So make sure that the node we find in the hash array is
in fact what we want.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Purge the gids cache via dbus interface

This dbus interface purges the entire gids cache altogether.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Rework get_req_uid_gid and nfs_check_anon into get_req_creds with proper managed_gids

These routines really needn't be separate, and by combining them, we can
properly use manage_gids feature. Some key points:

Only manage_gids once, and then remember the data until the end of the
request at which point we unref it.

If we must squash ids in the caller_garray, make a copy. Free that copy
at the end of the request (in the meantime, that one copy may be re-used
with different sqush parameters).

Cleaner handling of reverting to original creds by always fetching the
original creds into a saved creds struct and then copying bits out of it
into the working creds as needed.

Move all the creds management data and flags into req_op_context (don't
burden other users of struct user_creds).

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove nfs_creds.h from source files that don't need it

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Rename nfs_export_list.c nfs_creds.c and move declarations into nfs_creds.h

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add a sample export file to document the new export configuration

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Move list of fsal obj and ds handles to fsal_module from fsal_export

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove unnecessary references to export from fsal_obj_handle

In these cases, we can get the proper export from req_op_context.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add struct fsal_export *fsal_export to req_op_context

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Stop referencing fsal_obj_handle export in FSAL_GPFS

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Stop referencing fsal_obj_handle export in FSAL_PT

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Stop referencing fsal_obj_handle export in FSAL_VFS

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>