Strict compilation for XFS FSAL

Most things are obvious, for XFSFSAL_read and XFSFSAL_write
just entertain complier - it doesn't know what we're checking
all possible values for whence in the switch, so give it
a default to chew on.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
Strict compile of File_Content

Rework checks of index files as suggested during the review by Jim Lieb:
if any of the fields in the file is corrupt then reject the whole file.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - return correct file descriptor when opening directories

Fallback for handling directory opening in fsal_internal_handle2fd
was returning wrong file descriptors: the parenthesis were
placed incorrectly and was doing the equivalent of

fd = (open_by_handle() < 0);

so we were getting either 0 or 1 as file descriptor for a directory.
Combined with open/fchmod/close it was creating a land mine for the
open - a workload which feature a lot of directory making (like git clone)
was racing and opening unrelated files on FD 0 and 1 and using wrong
file descriptors for setting attributes. This explains why some permission
bits for some files were "morphing" between two tree scans by git status.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - use real types in the handle

Use the opportunity to change on-the-wire handles to push real
type into the XFS' portion of the handle.

And be more paranoid about the kind of types you're prepared to
accept off the wire.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - different way of dealing with bulkstat attributes

During the review Jim Lieb suggested that it would be better
to fill in struct stat based on the results in xfs_bulkstat
and use posix2fsal_attributes to convert - less code, more
likely the changes will be done in the right place.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - more validation of incoming filehandles

More paranoia about the stuff inside XFS' portion of the filehandle:
this stuff does come of the wire and can be tampered with so make sure
that lenght is sane and the type is one we may know about before
doing anything with the handle.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
Minor type mismatch when dealing with request queue in NFS workers

Punt pointer to the correct type.
IdMapper - strict compile with --disable-nfsidmap

Make sure IdMapper compiles with --disable-nfsidmap --enable-strict-compile
Make sure Mem_Alloc_Page_Aligned is defined when BuddyMalloc is disabled.

Mem_Alloc_Page_Aligned is using standard Posix API to get aligned memory blocks
and can be used with or without BuddyMalloc - move the code around to make
sure it's included in both versions.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
NFSv4 - no create_session_sequence in NFS v4.0

Make sure NFS compiles if support for NFS v4.1 is disabled at configure time.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
Bad manage,ent of krb5_param for rpcal=ONCRPC
Port of Jim's New Handle feature has been done to FSAL_LUSTRE
Bad management of krb5_param for rpcal=ONCRPC
Merge remote branch 'origin/new_handle' into new_handle
PROXY FSAL - Remove duplicate code in config parser

Code for parsing configuration parameters related to handle
mapping has been duplicated - remove second copy.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - remove rcp_by_name and its support act

rpc_by_name was not compiled because _BY_NAME was not defined:
rather then keeping the dead code in the tree remove it and let
source control system deal with history

Signed-off-by: Max Matveev <makc@gmx.co.uk>
Remove support for rcp_by_fileid

rcp_by_fileid was only meant to be used with Proxy FSAL and yet it
spread all other the tree.

And even with Proxy FSAL it was guarded with _BY_FILEID which was
not defined.

Remove the code and let source control system keep track of history.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - reshape fsal handle

In preparation for migration to new way of dealing with fsal handles
reshape the Proxy handle by removing underused timestamp and reducing
type and length fields to 8 bits each - this leaves more room for
backend server handle if we decided to use it in both NFS v2 and NFSv3

Removal of timestamp from the proxy fsal handle means that xattr
'timestamp' is removed too.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - convert to new way of dealing with handles

Handle mapping for NFS v2 and NFS v3 is only going
to work if backend server handle can fit into
opaque part of protocol handle.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - allow NFS v3 and NFS v2 without handle mapping

If the backend server handle can fit into the opaque part
of the protocol then there is no reason to not allow NFS v2 and
NFS v3 access via Proxy - in this case just use the handle
as is.

And make enable_handle_mapping independent of HANDLE_MAPPING
choice at the compile time to allow administator's control
over protocol selection.

Signed-off-by: Max Matveev <makc@gmx.co.uk>