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>
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.

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>