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>
Check delegation conflict prior to calling state_add_impl()

The delegation conflict detection is now done right after the share mode
conflict detection. Also renamed deleg_conflict() to state_deleg_conflict.
Just a code re-organization!

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Fix CMakeLists.txt to not install sm_notify.ganesha unless
the utils flag is set

Signed-off-by: Allison Henderson <achender@vnet.linux.ibm.com>
Fix rpm to install util scripts only into the utils rpm

Signed-off-by: Allison Henderson <achender@vnet.linux.ibm.com>
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>
Fix dbus_append_timestamp() for 32 bit systems.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reported-by: Krishna Harathi <kharathi@exablox.com>
Acked-by: Jim Lieb <lieb@sea-troll.net>
Use dbus_bool_t rather than an int to pass to dbus boolean type

dbus_bool_t is probably an int, but having the correct type is better.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Jim Lieb <lieb@sea-troll.net>
export_id is uint16 bit integer, so we should pass DBUS_TYPE_UINT16

Passing DBUS_TYPE_INT32 will make the dbus code access 2 bytes of
incorrect memory space!

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Jim Lieb <lieb@sea-troll.net>
ishealthy is calculated when needed, so avoid having it the structure.

get_ganesha_health() now returns a boolean rather than updating a field in
a structure. The boolean is converted to a dbus_bool_t before passing it
to dbus code.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Jim Lieb <lieb@sea-troll.net>
Fix record_stats definition to accommodate its callers usage!

Fixed the record_stats() definition to comply with its callers! This
patch fixes some incorrect statistics reports (latency and queue wait
time).

Reported-by: Frank Geisenheiner <FGEISEN@de.ibm.com>
Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Add default GPFS config files, and include them in the RPM

Signed-off-by: Poornima Gupte <poornima.gupte@in.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>