Add new junction support to NFS v4 LOOKUP

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add new junction support to NFS v4 READDIR

This is all handled inside the callback. When called back on a junction
node, we cross the junction, doing export permission checking and
generating new creds.

If the new export is not available to the particular client because of
export permissions, the entry is completely hidden from that client.

If the client is not using the right authentication flavor, but is just
requesting FATTR4_MOUNTED_ON_FILEID, then we allow the operation to
proceed (AIX clients depend on this).

Otherwise, if the authentication is not right, we report the
NFS4ERR_WRONGSEC in the FATTR4_RDATTR_ERROR field (if present, otherwise
the whole READDIR operation must fail).

Otherwise, the junction is crossed, and we signal cache_inode_getattr to
callback with the node across the junction. We process it.

In all cases, the export and credentials are restored.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Allow for EXPORT config of export_id = 0

This doesn't hook it up to anything yet. It just allows the existence of
a config for export_id = 0 while still using the old Pseudo FS.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove BuildDefaultExport (dead code)

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add export for export_id = 0 if wasn't configured

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add ability to iterate export list in reverse order

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Make export iterators return false if any callback returns false

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix get_gsh_export_by_path and get_gsh_export_by_pseudo

These routines have to distinguish requirement for exact match and
partial match. Export config processing needs exact match to detect
duplicates, while mounting requires partial match since the mount
path might be a sub-directoru of an export.

Also fix up some bits in export parsing.

Also add locked versions for use when called from iterators.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Don't lookup export in cache_inode_get_keyed

We actually have the export in the req_ctx. This eliminates the need to
acquire the export_by_id.lock lock here, which would be bad because while
constructing the Pseudo FS, we hold that lock, and could end up calling
cache_inode_get_keyed.

Put an assert in to catch us if the assumption is actually wrong.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix return code in nfs_export_get_root_entry

If cache_inode_new_entry returned CACHE_INODE_ENTRY_EXISTS,
nfs_export_get_root_entry would pass that on to it's caller,
which is not right, all it cares is that the entry was found
and usable.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
MOVE (reword - also move Fix return code in nfs_export_get_root_entry) Make nfs_export_get_root_entry return a reference to the cache inode entry

Since nfs_export_get_root_entry "looks up" a cache inode entry, it
should return a reference to that entry that the caller is responsible
for calling cache_inode_put for when done with it.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add routines to mount an export in the new Pseudo FS

This is the big building block for creating a new Pseudo FS on top of
cache_inode and FSAL_PSEUDO.

pseudo_mount_export() will take a defined export, and use it's Pseudo
Path to find the export it would be mounted on, and then assure that
said export has the directory tree to support the mounted export. If a
directory is missing, it will be created.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Convert to using new Pseudo FS

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove old Pseduo FS code

This includes some operations that check for Pseudo FS that don't normally
apply to Pseudo FS, so they weren't done in the "convert to new Pseudo FS"
patch set.

Also caught a few stale nfs2 references.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Read LOG config before loading FSALs

Otherwise you can't enable debug etc. during FSAL loading.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Make FSAL_PSEUDO built in

This required a hack in fsal_load_config to take a NULL name param to
indicate "don't look for an FSAL config block for this FSAL".

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
In sanity check currentFH/savedFH assert that cache entry is valid

Now that a valid file handle always references a cache inode, we can
assert that data->current_entry or data->saved_entry is non-NULL (and
also that the filetype is not NO_FILE_TYPE).

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add more debug in nfs4_op_lookup.c and nfs4_op_readdir.c

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add more debug to cache_inode_readdir

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Insert parent's handle key on create, lookup, or readdir

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