PROXY FSAL - restore prototype for nfs4_Fattr_Free

The prototype for nfs4_Fattr_Free was moved from nfs_proto_functions.h
to nfs_proto_tools.h.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - respect array boundaries in readdir

Off-by-one error when clearing next pointer in the dirent list.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - memory leak when dealing with names

fsal_internal_proxy_fsal_name_2_utf8 checks if len is 0 and allocates
memory. Callers of fsal_internal_proxy_fsal_name_2_utf8 do not set len
but provide a pointer for the string and assume that it's going to be
enough to avoid allocation. It isn't so on every call we leak the memory.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - remove separate implementation of truncate

Difference between 'stateless' truncate and 'normal' truncate
is that we open and close file between calls - there is no need
to have two different implementations for the sake of 3 lines of
code.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - don't clobber fd 0 on reconnect

During the initialization we forget to save the socket
in the thread context then on reconnect we close this socket
and try to connect again. And then another thread comes along
and does the same thing. And again. And again. As a result
we have several contexts using one socket - this is not going
to work too well.

To avoid problems like this move the code which deals with
creating RPC clients into separate function and call this
new function whenever you need a new RPC client.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
SAL - make sure mkdir(2) has a prototype

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - use up-to-date client id

If clientid is changed then renewing the old one makes no sense.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
NFS - don't leak memory in mnt_Export

Signed-off-by: Max Matveev <makc@gmx.co.uk>
NFS - run fridge on the closed cycle and avoid leaks

Keep memory management and waking/closing details inside the
fridge - the callers of fridgethr_freeze will either get
an argument for the thread function if a thread has been thawed
or NULL if it's time to exit.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - don't leak RPC client handles on reconnect

Make sure RPC client handle is properly disposed of when
we reconnect to the server.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL housekeeping - remove dead code from PROXYFSAL_open

PROXYFSAL_open does not do send NFS4_OPEN to the backend server
(it cannot because it does not have a filename which is required for open)
therefore it does not need to calculate share attributes either.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
NFS - deal with extra-large symlinks

Make sure we allocate enough space to store symlink path.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
NFS - deal with zero length read

If we get a zero length read then simply return success to the caller.
And make sure we don't fall into 'error handling' part of the function.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
Once again fsal_path_t has flopped back in.

The quota code just happens to work for fsal_path_t mixed with
char *.  This patch is just to get XFS to build.  A comprehensive
patch that fixes this in multiple places to get it right (finally)
is forthcoming (from me).  For now, make the compiler shut up.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Externalize TI-RPC and RPC Event Loop

Initial Ganesha integration with updated TI-RPC.  The
most visible change is a new plug-out event loop (which
internally uses EPOLL).  A set of event service threads
deal with accepting new connections and I/O events on
new connections (a starter mapping of 5 threads to channels,
with modular assignment of new connections to 2 TCP channel
threads is provided).

Internally in TI-RPC, various scaling assumptions are removed,
including fixed arrays of fds, locks, etc.

Most files are touched only to rename Ganesha's internal
wrapper "rpc.h" to "ganesha_rpc.h," since the former
overloads the public RPC header name.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add contrib-install target, and README.TIRPC.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fetch correct TI-RPC repository and branch, to the correct
location.  Calls autogen.sh.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Use new xdr_inline interface.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Replace suspect gss_release_buffer calls in Xdr_rpc_gss_unwrap_data.

With TI-RPC allocator shimmed to the Ganesha Buddy allocator, these
calls result in calls to free() on memory from the Buddy system, the
databuf.value appears to have been allocated in XDR.

Current verification:

* informal testing with krb5i and krb5p, using Linux client 3.3.0-rc7
** tested with and without BuddyMalloc enabled
* valgrind

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Initial NFSv40 Callback Channel (push 3)

Implements the following functionality:

* defines rpc call channel abstraction, for v40, linked to nfs_clientid_t
* netid and univeral address handling added, this will likely move to RPC layer
* defines nfs_compound_t and helper routines for compound construction
* adds rpc_call_t and in-line and out-of-line call dispatch models, the latter
  provides for executing an rpc call from a worker thread context, with
  call finalization by a completion function
* support for setup and dispatch of callbacks for testing from outside the
  Ganesha process using a very minimal DBUS event loop--get_client_ids and
* forged CB_RECALL examples included
* some cleanup and completion of SET_CLIENTID implementation, string termination
  problems removed by addition of strlcpy
* support for RPCSEC_GSS callback protection coded and partially verified

Current validation

* CB_NULL AUTH_NULL verified against stock Linux 2.3.30-rc7
* CB_COMPOUND AUTH_NULL verified using wire traces and Linux 2.3.30-rc7
  modified to accept callbacks over AUTH_NULL channel
* CB_NULL RPCSEC_GSS verified against stock Linux 2.3.30-rc7
* CB_COMPOUNT RPCSEC_GSS failing on reply, debugging this

Includes contributions from Lee Dobryden <lee@linuxbox.com>.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>