More install-prefix work

- Handle two more hard-coded directories (NFS_V4_RECOV_ROOT and
  DEFAULT_NFS_CCACHE_DIR).
- Create ${SYSSTATEDIR}/run/ganesha, so that ganesha doesn't complain
  with obscure error messages if that directory doesn't exist
Signed-off-by: Daniel Gryniewicz <dang@linuxbox.com>
Add index the layout reply for GPFS FSAL

Signed-off-by: Marc Eshel <eshel@us.ibm.com>
Fix double free on error exit.

Signed-off-by: Marc Eshel <eshel@us.ibm.com>
Add the options to have a Ganesha server that is DS or MDS

Signed-off-by: Marc Eshel <eshel@us.ibm.com>
Name of stackable FSAL NULL updated from NULLFS to NULL

Shared library name is determined as libfsal<FSAL-name-in-lcase>.so
See pathfmt: src/FSAL/fsal_manager.c

Change-Id: Ia37d66fc6d94fa52cef7e4996704c45ea6dd53eb
Signed-off-by: Arun Olappamanna Vasudevan <aolappamanna@cs.stonybrook.edu>
Reviewed-by: Ming Chen <mchen@cs.stonybrook.edu>
Acked-by: Dominique Martinet <dominique.martinet@cea.fr>
Add utility function to load and initialize FSAL module

- Utility function: fsal_load_init()
- Call fsal_load_init() in fsal_commit()

Change-Id: I6d4cda982f3758f8d24ccc49a95eb582bb0071de
Signed-off-by: Arun Olappamanna Vasudevan <aolappamanna@cs.stonybrook.edu>
Reviewed-by: Ming Chen <mchen@cs.stonybrook.edu>
Acked-by: Dominique Martinet <dominique.martinet@cea.fr>
Support stacking multiple FSALs

* For a config file such as
EXPORT { FSAL { name = "stk1";
                FSAL { name = "stk2";
                       FSAL { name = "FS";
                            }
                     }
              }
       }
* Config parser processes EXPORT block and identifies FSAL associated with the
  export - 'stk1'. Library (libfsalstk1.so) is loaded and 'stk1' is registered
  as an FSAL.
* 'stk1_create_export' being a stackable FSAL is concerned about sub-FSAL right
  below it:
  FSAL { name = "stk1";
         FSAL { name = "stk2";
                ...
              }
       }
  After parsing the sub-FSAL name, subfsal_commit loads the sub-FSAL and gets
  it's 'create_export' function registered. 'stk2_create_export' is then called.
* 'stk2_create_export' behaves similar to 'stk1_create_export' - loads library
  'libfsalfs.so' and calls 'fs_create_export'
This enables stacking of as many stackable FSALs on top of a regular FSAL.

Change-Id: I9ed9373c63eb9d09b97d03da5ccc302f4df1819a
Signed-off-by: Arun Olappamanna Vasudevan <aolappamanna@cs.stonybrook.edu>
Reviewed-by: Ming Chen <mchen@cs.stonybrook.edu>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Merge remote-tracking branch 'marc/double-free' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Merge remote-tracking branch 'marc/mds-ds' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Merge remote-tracking branch 'dang/install-prefix' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Merge remote-tracking branch 'sbu-fsl/multistack_r3' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
V2.2-dev-15

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Make loops that iterate over cache entry state_list safe when NLM state_t added

A future patch will add state_t state_type_t values to indicate a state_t
used for NLM purposes. These state_t will be added to cache inode's state_list,
however, no V4 specific actions should be taken for these entries.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add Open File Description Locks to multilock tool

Open File Description (OFD) locks are new in Linx kernel 3.15. They are specific
to open file descriptions, which for the ml_posix_client, amount to being
specific to a specific file descriptor. This means that the OFD locks from
two different open file descriptors will conflict.

The primary purpose of adding these to the multilock tool is to be able to
experiment with the new locks, however, it becomes interesting when these
locks are used from a Linux client. They SHOULD result in a single open
owner with multiple lock owners.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Multilock: Make sure STATUS_ERRNO always provides an errno value

Also make sure the errno is saved before calling sprintf...

Also, normalize all uses of STATUS_ERRNO with a hard coded errno to also
be prior to any sprintf (makes for more consistent code).

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Make ml_posix_client multithreaded to handle blocking locks

Instead of a blocking lock blocking the whole multilock tool, it now
is multi-threaded. There is a limited number of worker threads, and one
polling thread. The main thread will never invoke a blocking lock, it will
just poll once for the lock and then if not available, defer to the
worker threads. A single polling thread handles the overflow if more blocked
locks are in progress than the numeber of worker threads available.

This code is actually the model for how Ganesha will handle blocking locks
with the new Open File Description locks for FSAL_VFS (though actually it
probably would also work for POSIX locks also).

This allows for any number of blocking locks per file descriptor.

Blocking locks may be cancelled by an UNLOCK request that covers at least the
entire range of the blocked lock (thus UNLOCK fno 0 0 will cancel all blocked
locks on the file descriptor).

Here is a little sample execution:

open 1 rw create OFD foo
1 OPEN OK 1 3
open 2 rw OFD foo
2 OPEN OK 2 4
open 3 rw OFD foo
3 OPEN OK 3 5
open 4 rw OFD foo
4 OPEN OK 4 6
open 5 rw OFD foo
5 OPEN OK 5 7
open 6 rw OFD foo
6 OPEN OK 6 8
lock 1 write 0 0
7 LOCK GRANTED 1 write 0 0
lockw 2 read 0 0
lockw 3 read 0 0
lockw 4 write 0 0
lockw 5 write 0 0
lockw 6 read 0 0
lockw 6 read 0 0
unlock 1 0 0
14 UNLOCK GRANTED 1 unlock 0 0
8 LOCKW GRANTED 2 read 0 0
13 LOCKW GRANTED 6 read 0 0
9 LOCKW GRANTED 3 read 0 0
unlock 4 0 0
10 LOCKW CANCELED 4 write 0 0
15 UNLOCK GRANTED 4 unlock 0 0
unlock 3 0 0
16 UNLOCK GRANTED 3 unlock 0 0
unlock 2 0 0
17 UNLOCK GRANTED 2 unlock 0 0
unlock 6 0 0
18 UNLOCK GRANTED 6 unlock 0 0
11 LOCKW GRANTED 5 write 0 0
unlock 5 0 0
19 UNLOCK GRANTED 5 unlock 0 0

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove some extraneous glist_init

glist_init is to be called on glist_heads that are the actual head of the
list. An empty list is specified by {&head, &head}.

The glist_heads that link items into the list are set to {NULL, NULL} to'
indicate they are not in any list.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Replace FALSE with false and TRUE with true

FALSE and TRUE are ONLY used in XDR, otherwise we should stick with the
standard true and false constants.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Make cache_inode_put a static inline function

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Change name of list of states in cache_entry_t for simpler cscope examination

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