XFS FSAL - symlink support

XFS' libhandle only allows open_by_handle on regular files and
directories, anything else gets EPERM.

In order to be able to support symlinks on XFS FSAL we need to:

1. Detect a symlink during lookup - this is easy: just use openat(2)
   with O_NOFOLLOW flag and if you get ELOOP then assume it's a symlink.
   If this happens then fake symlink handle using hand-rolled
   fsal_internal_inum2handle and hope that it matches the handle
   generated by libhandle. Use attributes from fstatat to fill in the
   object attributes on the wire.

2. If you get a file handle which refers to a symlink in getattr then
   use XFS bulk inode stat interface to get information about the
   symlink itself.

   Note that xfs_bstat_t does not have the equivalent of st_dev - to
   work around this issue save the device id when building export context
   and use that to feed the attributes.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - don't leak open files when parsing export list

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - symlink support

XFS' libhandle only allows open_by_handle on regular files and
directories, anything else gets EPERM.

In order to be able to support symlinks on XFS FSAL we need to:

1. Detect a symlink during lookup - this is easy: just use openat(2)
   with O_NOFOLLOW flag and if you get ELOOP then assume it's a symlink.
   If this happens then fake symlink handle using hand-rolled
   fsal_internal_inum2handle and hope that it matches the handle
   generated by libhandle. Use attributes from fstatat to fill in the
   object attributes on the wire.

2. If you get a file handle which refers to a symlink in getattr then
   use XFS bulk inode stat interface to get information about the
   symlink itself.

   Note that xfs_bstat_t does not have the equivalent of st_dev - to
   work around this issue save the device id when building export context
   and use that to feed the attributes.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - don't leak open files when parsing export list

Signed-off-by: Max Matveev <makc@gmx.co.uk>
XFS FSAL - deal with non-regular files

Symlinks are not the only filesystem objects which cannot be
opened using libhandle's open_by_handle interface: sockets
fifos, block and character device are in the same boat. In
order to deal with them switch from "open first, stat second"
to "stat first and only open what can be opened" mode.

And use real types when constructing file handles.
Regular files and directories are left with DT_UNKNOWN
to preserve on-the-wire format of the file handles.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
IdMapper - deal with unknown groups and users

On Solaris getpwnam_r returns NULL on both errors and if the name
is unknown, on Linux getpwnam_r will return 0 if it cannot find the
name and sets result pointer to NULL. Either way this pointer must
be checked after the call.

Ditto for getgrnam_r.
PROXY FSAL - use correct variable when dealing with times.
Fix --enable-strict-compile failure from unused varaible in state_lock.c
Fix strict compile of VFS FSAL

Removed the set but unused d_type variable from VFSFSAL_readdir.
Renew and Initialize NFSv4.1 clientids

Recent work to implement the NFSv4 lease timer modified the
SETCLIENTID and RENEW operations to update the time of the most recent
use of the clientid.  This updates the clientid time in EXCHANGE_ID
and SEQUENCE which was previously 0, cause all NFSv4.1 clientids to
report as expired.  This partially resolves the bug reported by Marc
Eshel on non-pNFS reads from NFSv4.1 mounts.

SETCLIENTID initialized a mutex in each clientid which was used by
some state management functions.  This patch adds initialization of
the mutex to EXCHANBE_ID, solving a crash in some state management
operations under NFSv4.1.
Link NFSv4.1 open states into export

Some state management code expects open states to be linked into the
export list entry for whatever file they affect.  This patch links
open states created in nfs41_op_open into the export list to avoid a
crash on close.
Fix Mem_Alloc_Page_Aligned_ bug

This changes the order of arguments to posix_memalign in
Mem_Alloc_Page_Aligned_ to be correct, fixing behaviour where some
reads of short files behaved oddly or failed.
Extraneous line removed (was making something that was done the line before)
Merge remote branch 'llb-ganesha/fixes' into tmp
Compilation fix : ganesha could not compile with RPCAL=ONCRPC
Merge remote branch 'makc/xfs-symlink' into tmp
Merge remote branch 'makc/xfs-symlink-more' into tmp

Conflicts:
	src/FSAL/FSAL_XFS/fsal_attrs.c
	src/FSAL/FSAL_XFS/fsal_lookup.c
Corrected programming error on checks of FATTR4_FILEHANDLE.
Changed pseudo_readdir to report attributes on a junction in the
same manner as lookup.
ganesha_ibm-next: Fix sm-notify start failure

When ibm_next branch compiled and run on rhel 5.6, ganesha
fails to start due to the missing sm-notify utility that
is not part of the downstream nfs-utils.  This patch
modifies the start up script to check for this
utility before using it.

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
add locking around grace period manipulations