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>
ntirpc submodule update.

Really take Bill's RD4 fixes (updated based on review feedback).

Signed-off-by: Matt Benjamin <matt@cohortfs.com>
Advance subproject libntirpc to duplex-11

Signed-off-by: William Allen Simpson <bill@cohortFS.com>
9P: returns EROFS when export entry is read-only.

Change-Id: I65179e57eb1b73ab7f1dda26721ad5e3f488e394
Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
access_check: add missing early return statements

The returns apparently went missing in bd451c42b846ebf84d427972cdb668ea7e14f360
(thanks to Frank for looking into it!)

Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
FSAL_LUSTRE/Upcalls: this commit implements FSAL Upcalls for FSAL_LUSTRE

This commit implements the basic support of upcalls in FSAL_LUSTRE.
The mechanism is based on Lustre changelogs feature. For scalability
reason, changelog are accessed through the lcap_* API intsead of the
llapi_* (lcap provides changelog caching which leverage loads on the
Lustre MDS). Upcalls are generated by a thread, just the way GPFS does
and uses fsal_up_top function vector.
This commit needs to have lustre support for jobid in changelog records.
This means that LUSTRE 2.7 or higher is required to compile this commit.
The feature is triggered by cmake and/or rpmbuild. By default it is OFF.

Change-Id: I3f4819c99c20902b0ea4691d40d4976ff8962fe4
Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
Send sm_notify to affected clients only.

When an IP is released from a server node, send sm_notify to
clients that are connected to that particular ip addr only.
Added a routine to match strings if they are in ipv6 format or ipv4
format. In the testing we found strings to comare are like:
 "10.0.100.231"  and  "::ffff:10.0.100.231"

Ported from 1.5.x: e7e47b9aa1c326d750b8765868389aec63b94ae9

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Rong Zeng <rongzeng@us.ibm.com>
Fix claim_posix_filesystems to work with bind mounts

claim_posix_filesystems() uses mount point path to find the file system
image for a given export path. Bind mounts will not be in the list of
file system images as they are actually duplicates. In other words,
mount point of a bind mount will not be in the list, and any export path
from a bind mount path fails to match any file system image.

This patch uses st_dev field from stat system call on the export path to
look for a matching file system image.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add delegation conflict detection for NLM.

Signed-off-by: Jeremy Bongio <jbongio@us.ibm.com>

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
[ Consolidate delegation support checks and conflict checks.

Delegation support checks are done at multiple places, sometimes
incorrectly as well! For example, the following existing check would
pass if the file is opened read-write and the file system only supported
read delegations. A read-write open requires us to grant write
delegation, and the file system must support write delegation in this
case!

	if ((arg_OPEN4->share_access & OPEN4_SHARE_ACCESS_WRITE &&
	    (!op_ctx->fsal_export->ops->fs_supports(op_ctx->fsal_export,
						    fso_delegations_w)))
	    ||
	    (arg_OPEN4->share_access & OPEN4_SHARE_ACCESS_READ &&
	     (!op_ctx->fsal_export->ops->fs_supports(op_ctx->fsal_export,
						     fso_delegations_r))))

All support checks are now done in deleg_supported function. Also added
can_we_grant_deleg() which detects all outstanding state that would
conflict if a delegation is granted!

A write delegation would conflict with any kind of existing NLM lock.
This missing check is added as well before granting write delegation. ]

Reviewed-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>