Increas possible size of device list inforamtion.

Signed-off-by: Marc Eshel <eshel@us.ibm.com>
Fix a resource leak

Fix Coverity ID 72123 by adding a gsh_free on error path.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Malahal Naineni <malahal@us.ibm.com>
Check return value of HashTable_Del

Fid Coverity ID # 74170
Also convert a LogCrit+Asset for HashTable_Del into a LogFatal()

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Malahal Naineni <malahal@us.ibm.com>
Fix a locking issue

Change lock to unlock to resolve a double lock issue
reported in Coverity ID 74172

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Malahal Naineni <malahal@us.ibm.com>
Corrected delegations element type in fsal_staticfsinfo_t

Converted delegations element type in fsal_staticfsinfo_t to uint32_t
to accomodate current and future delegation type bits.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Malahal Naineni <malahal@us.ibm.com>
Fix the default value of GPFS FSAL delegations.

GPFS FSAL supports read delegations hence make that default.
Corrected the current default of FSAL_OPTION_NO_DELEGATIONS to
FSAL_OPTION_FILE_READ_DELEG and also set the right
mask to FSAL_OPTION_FILE_DELEGATIONS.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Reviewed-by: Malahal Naineni <malahal@us.ibm.com>
Merge remote-tracking branch 'marc/device-list' into next

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Merge remote-tracking branch 'ganltc/for-V2.2-dev-14' into next

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

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>
Make fsal in cache_inode_key_t void * to assure it's not dereferenced

the struct fsal_module pointer is just used as an element of the key and
should not be dereferenced since a key does not hold an fsal module reference
and thus the pointer is not guaranteed to be valid.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
All NFS v4.0 ops that use an open/lock owner should check owner seqid the same

These ops all require the client to change the owner seqid, but also result
in a stateid seqid change. In order for the replay logic to work, we must
identify a potential replay based on the stateid seqid changing, and then
check the owner seqid for replay.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Use nfs4_sanity_check_FH for nfsa4_op_delegreturn

For correctness to RFC, replace NFS4ERR_ISDIR with NFS4ERR_INVAL.

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