Add missing COMPONENT_EXPORT to set of configurable options

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Enhance debug of multiple FSALs

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Pass cache_entry_t in getattr callback to fix NFS v4 junction crossing

After crossing a junction, the handle returned in NFS v4 READDIR was
that of the junction entry, not that of the root directory of the export.

By passing the cache entry in the callback, we get to pass the proper
entry across the junction instead of passing the opaque data which had
the cache entry.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix issue if no access allowed to export to allow ENOENT

If no access is granted to a client for an export, the expectation was
that LOOKUP would return ENOENT and READDIR would skip the entry.

There used to be a check at the end of nfs_export_check_access for this
condition, but now it always returns export_perms with options set.

The solution is to test the export_perms.options to make sure some
access is granted. This only affects NFS v4 currently.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove unecessary #include "fsal_handle_syscalls.h"

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Pass BADHANDLE error all the way through

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add fsal_filesystem object and supporting commonlib code

Several features of this code:

- Common code scan of /proc/mounts with getmntent which then stores the
  file systems in a database. Filesystems may be claimed by FSALs while
  creating exports. Sub-mounted filesystems are handled. The scan
  ignores filesystems on major device 0 (such as /proc) and any with
  a type matching "nfs.*"

- filesystems may be looked up by fsid or device

- A filesystem may only be exported via one fsal

- If libblkid and libuuid are available, the default fsid for a
  filesystem is the 128 bit uuid broken into 64 bit major and
  minor, otherwise the fsid from statfs is used.

- The fsid squashing algorithm from nfs3_FSALattr_To_PartialFattr
  is put in a routine squash_fsid.

- Filesystems may have their fsid type changed to one of the
  following formats:
  - one uint64_t (matches NFS v3 fsid, uses the same algorithm
    to compress the fsid that nfs3_FSALattr_To_PartialFattr used)
  - two uint32_t (xor the high order 32 bits with the low order
    32 bits)
  - device (use the device major.minor as the fsid major.minor)
  - two uint64_t (really no change)

- Additional filesystems may be added (just use re_index_fs_fsid
  and re_index_fs_dev to add them)

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
TEMP - MAY ABANDON - Handle EXDEV in cache_inode_readdir

The current implementation of this is to ignore the entry and not
have it present.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Use fsal_filesystem in FSAL_VFS to implement multiple filesystems

This is a major change...

The VFS handle has been reformatted. Now Linux core VFS, FREEBSD, and
XFS each have their own handle format. The FREEBSD and XFS handles
already had an fsid in them. The format of the core Linux handle is:

/* Visual handle format
 *
 * 1 byte		handle_len (doesn't go on wire)
 * 1 byte		flags
 *				00xxxxxx fsid_type
 *				01000000 handle_type fits in one byte
 *				10000000 handle_type fits in two bytes
 *				11000000 handle_type fits in four bytes
 */
 /*
 * 0, 8, or 16 bytes	fsid type
 * 1,2 or 4 bytes 	handle type
 * 12 to 40 bytes	opaque kernel handle
 *
 * NOTE: if handle type doesn't fit in 2 bytes or less, 40 byte handles
 *	 (BTRFS and GPFS are known file systems that use 40 bytes) are
 *	 incompatible with 16 byte uuid form fsids.
 *	 If VMware clients are concerned, the limit is 8 bytes less...
 */

FREEBSD and XFS file systems will use the fsid from the handle as the
fsid, and thus will be re-indexed.

The FSAL configuration for an export may specify the filesystem type.
This really only applies to core Linux filesystems. The types are:

None
One64 (one uint64_t)
Two64 (two uint64_t)
uuid  (synonym for Two64)
Two32 (two uint32_t)
Dev (two uint32_t using the device major.minor)
Device (synonym for Dev)

An FSAL lookup that crosses a filesystem boundary will be properly
handled, with fsid changing and everything. This allows sub-mounted
fileysystems to work properly for both NFS v3 (at least with the Linux
client) and NFS v4 (with any client that crosses filesystem boundaries).

The fsid for the filesystem is used for fsid in getattrs.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Extract xfs out into FSAL_XFS

FSAL_XFS shares most of it's code with FSAL_VFS, but is now an
independent FSAL. This solves some issues, and get's rid of the
need to specify the handle library path.

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

Conflicts:
	src/FSAL/FSAL_VFS/export.c
	src/FSAL/FSAL_VFS/handle.c
Simplify vfs_stat_by_handle

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Use open_dir_by_path_walk in FSAL_GPFS gpfs_lookup_path

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Use open_dir_by_path_walk in FSAL_LISTRE lustre_lookup_path

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Don't allow ".." path elements in FSAL_PROXY pxy_lookup_path

symlink elements should result in errors, but we need to be explicit
about preventing use of ".." path elements in pxy_lookup_path.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
MORE Add fsal_filesystem object and supporting commonlib code

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
MORE Use fsal_filesystem in FSAL_VFS to implement multiple filesystems

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