Do not unconditionally put (unref) DRC in nfs_dupreq_finish.

There is no need to hold an elevated refcount for eached
cached request, and since we don't have one, dont return
the non reference.  Doing this lead to incorrect recycling.

While debugging, I found also that the recycling code was
being exercised unnecessarily often, since for uncacheable
requests, there is no need to instantiate a DRC at all.  I
have made the old behavior selectable for the moment, so
folks can excercise the bug(fix).

I have also made mutex vs. spinlock selectable.  These are
hit hard, so it might be interesting to benchmark.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Track and extend TI-RPC big mutex change.

Use pthread adaptive mutexes (on Linux) as fast mutex, in
place of spinlocks.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Omit a call to pthread_mutexattr_destroy.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Test for SyncDone states at top of pthread_cond_wait, in two
places.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove setting stack size for fridge threads

These threads do nothing special.  Take the glibc default instead
of second guessing.  PTHREAD_STACK_MIN is too small, but
THREAD_STACK_SIZE is way too big here.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Add req ctx to open method

Requested for GPFS port.
Note:  test_access is called prior to this call.  Test_access can
also be overloaded by a fsal private method as in the case of gpfs.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Empty out obsolete TEMPLATE FSAL dir

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Remove redundant include files in Makefile.am

Files in src/include were also in *_SOURCES everywhere.
Needs to be only in one place

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Merge branch 'open_ctx' into new_api-dev
Remove forgotten merge conflict marker

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Move the extract_handle method from netbuff to use gsh_buffdesc

This was left alone when gsh_buffdesc replaced other
buffer/memory descriptors. netbuff (from rpc) is not really appropriate.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Replace nfs_FhandleToCache with protocol version equivalents

This was a complicated function with lots of confused arguments.
The replacements are protocol version specific, simpler and provide
tighter type checking of args.  Some subtle bugs were also removed in this
rewrite.  This also eliminates a buffer copy on the handle.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
PROXY FSAL - Simplify NFSv4 bitmap processing

Instead of using temporary arrays to hold the state just operatate
directly on bitmap4 when messing with attributes.

And for bitmaps which are read-only (i.e. those which are used
by GETATTR op) there is no need to construct them during run-time,
just use static storage.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
PROXY FSAL - use common code to process filesystem info

Use common code to convert fattr4 blob into the fsal_dynamicfsinfo
which stores information about space and inode utilization.

This removes last use of bitmap_to_list and list_to_bitmap functions
which was the driving force behind this change.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
Make sure XDR handle initalized properly

NFSv4 XDR routines use 'lookahead' structures which are hanging
off x_public pointer - make sure that users who do not need/want
to use lookahead are not following uninitialized memory.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
NFSv2 Removal : nfs2_func_desc[] was removed and so do references to it.
Source files dedicated to NFSv2 (no mangled code in it) were removed.
NFSv2 Removal: done for Create
NFSv2 Removal: done for Fsstat
NFSv2 Removal: done for Null
NFSv2 Removal: done for Link