16 bit export_id on DBUS:
Expect 16 bit export id on DBUS command.

Signed-off-by: suhrud <supatank@in.ibm.com>
Added support for CLAIM_PREVIOUS

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Srikrishan Malik <srimalik@in.ibm.com>
Return Not Supported for both nfs4_op_delegpurge and CLAIM_DELEGATE_PREV

Currnt code mostly supports CLAIM_DELEGATE_PREV but there is lot more
needed to fully support it.

Some of the missing pieces are:
1. Fully supporting nfs4_op_delegpurge.
2. making sure that the delegations are not removed/cleaned on
   setclientid sequence.

This is helpful for those clients which uses persistent storage
for data cache, and these delegations are called client-persistent delegations
When there is needed we can address above mentioned issues and enable then.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Srikrishan Malik <srimalik@in.ibm.com>
Set the pre-recalled flag for deleg reclaims.

This flag will be set for reclaim opens when for the delegation would not be
granted for non-reclaim opens.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
Reviewed-by: Malahal Naineni <malahal@us.ibm.com>
Fix for coverity CID24725

The allocated string buffer is not enough to hold the original string
buffer, but we do copy only a partial string.  This is clearly a false
positive from coverity as it doesn't really look at how the string is
used! Use gsh_strdup as this is more cleaner, and as a bonus avoids
this false positive from coverity!

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Don't try deleting dot and dotdot entries

Replaced the while statement with for statement that avoided a goto
label altogether as well.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Don't give out delegation on a just recalled file

If a client's open causes recall of existing delegations, we respond to
the client with NFS4ERR_DELAY and recall the delegations asynchronously.
If delegations are recalled and another client were to open the file
before the original client that caused recalls, we should not give out
delegation to the latter client to avoid starving the former. We simply
avoid granting delegations for some time period from the last recall to
avoid this.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Fix granting delegations based on client's behaviour

If a client has more than than couple revokes, we stop giving
delegations to the client.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Remove unused fds_disabled field

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Remove unused DELEG_REVOKED definition

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove unneeded DELEG_RETURNED state

Delegation state DELEG_RETURNED is set when the state_t is about to be
deleted. This isn't needed, and removed DELEG_RETURNED as well.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix delegation states from flags to state values!

They are not really flags. Also changed them to enum type.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Repairs broken config parsing for FSAL_PROXY.

This commit repairs the broken config parsing for FSAL_PROXY.
The syntax for the proxy specific arguments is as follow:
PROXY
{
	# FSINFO arguments (cansettime, link_support, ...
	(..)
        Remote_Server
        {
                Srv_Addr = server.remote.net ;
                Retry_SleepTime = 10;
                Use_Privileged_Client_Port = true;
		(...)
        }
}

Change-Id: Ic8902bde5e7ea363e8f31194016a62d237517d90
Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
Lustre/PNFS: refurbishes the :Lustre/pNFS configuration

This commit changes the way pNFS configuration is managed.
The pNFS configuration is no more a dedicated LUSTRE_PNFS block.
The configuration goes into a sub-block of FSAL dedicated configuration
block "LUSTRE"

The syntax becomes:
LUSTRE
{
	# fsalfsinfo related items
	xattr_access_rights = 0700;
	(...)

	PNFS
	{
            DATASERVER
            {
                    DS_Addr = ganesha_ds2.mynetwork.myhome ;
                    DS_Port = 2049 ;
                    DS_Id = 1 ;
            }
            DATASERVER
            {
                    DS_Addr = ganesha_ds2.mynetwork.myhome ;
                    DS_Port = 2049 ;
                    DS_Id = 2 ;
	    }
	  #more Dataservers if wantred
	  (...)
	}
}

Export specific configuration remain the same:
    EXPORT
    {
      (...)
      FSAL {
        name = "LUSTRE";
        PNFS
         {
            Stripe_Unit = 1048576;
            pnfs_enabled = true;
            DATASERVER
            {
                    DS_Id = 2 ;
            }
            DATASERVER
            {
                    DS_Id = 1 ;
            }
         }
      }
     (...)

IMPORTANT REMINDER:
On each pNFS data server, a "pNFS aware" ganesha server should run.
pNFS can be enabled for some exports and disabled for others.
Different exports can use different sets of DSs.

FSAL/pNFS: updates informaiton in  src/config_samples/config.txt

Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
FSAL_LUSTRE: fixes CID24050 (unchecked return code)

Change-Id: If3b76813de992b48f972c1df79e6c64a4ec9d503
Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
Comments useless code. This code will be uncommented as code will be added in the config's commit functions.

FSAL_PROXY and FSAL_LUSTRE have block with *_commit functions, to be called during parsing to check configuration item.
Those functions are currently empty are are basically placeholders.
Setting a variable withut using it triggers a compilation error in Maintainer mode, so I commented this.
This piece of code will be uncommented as "flesh" will come in this part of the code.

Change-Id: I266d8000fa689e3f62e2d97b94f5cc9f69c54e9f
Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
Exports configuration: adds "All Anonymous" as an synonym for "All Squash"

The Squash=All statement replaces the old "ALL_ANONYMOUS" from older configuration file.
Adding Squash=All_Anonymous makes the change more intuitive to sysadms.

Change-Id: I29bfe7b908a675c21522905449dbf7db424974ad
Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
specfile: only declare utils if we build it

Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Explicitly ignore result of display_printf

When constructing a log message, we can ignore the result of display_printf
since we want to print the message even if it should happen to be truncated.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Soumya Koduri <skoduri@redhat.com>
Attempt to only add one client to export per entry (fixes BZ 1074481)

The client list was adding two entries for each possible address because
getaddrinfo shows an entry for both UDP and TCP. A simple check is to keep
track of the last address added, and not add it again. This should eliminate
all the duplicates (especially if JUST an ip address is given in which case
the addrinfo will ONLY return those two entries).

Also for showmount -e report the Wildcard and IPv6 addresses not as
unknown.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Acked-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Soumya Koduri <skoduri@redhat.com>
Acked-by: mmadhusu@redhat.com