Clean up EXCHANGE_ID and get rid of macros

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Get rid of static buffer in client_record_t

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
[FreeBSD] Add -fno-omit-frame-pointer to CFLAGS to fix segfault in backtrace().

Looks like at certain optimization levels, gcc omits frame pointer which leads
to segfault in backtrace(). Fix is to add explicit -fno-omit-frame-pointer to
always get frame pointers.

Signed-off-by: Sachin Bhamare <sbhamare@panasas.com>
[Travis-CI] Add support for integration with travis-ci.

Travis - CI is a free hosted continuous integration platform.
This commit adds the integration support to get 'next' branch built automatically on each commit.

Signed-off-by: Sachin Bhamare <sbhamare@panasas.com>
Remove comments around ifdef USE_DBUS_STATS

leftovers from Cmake debugging

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Simplify nfs_ParseConfLine and have it's users handle buffer sizes

Instead of allocating memory all over the place, considering the
input string to nfs_ParseConfLine is modified to null terminate
every token, just return pointers to those sub-strings.

We don't to the following:
Also, length check each token if requested (some callers benefit
from this, other callers don't bother since they aren't copying
the tokens into another string buffer).

manual cherry pick of f78da371335c with cleanup of token parser to use
strings functions instead of our own loops.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Signed-off-by: Jim Lieb <jlieb@panasas.com>
Don't compare client address in EXCHANGE_ID

This interferes with both trunking and reconnection after a change in
address.

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Check state as well as lease expiry on co_owner collision

This improves conformance with RFC 5661 and closes a @todo item.

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Change the return type of valid_lease to bool

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Set EXCHGID4_FLAG_CONFIRMED_R on confirmed ID

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Add pNFS flags to owner and use a better hash

RFC 5661 says that servers are allowed (but not required) to treat
identical co_owner values sent with different pNFS flags in
EXCHANGE_ID as describing different owners.  The Linux client,
however, responds to being given a known clientid when connecting to a
DS that is colocated on an MDS by calling DESTROY_CLIENTID and
re-exchanging.

This is a particularly aggressive way not to support trunking.

Also switch to using CityHash for co_owner values rather than a
moddy-loopy-sum over all the bytes.

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Merge remote-tracking branch 'linuxbox2/next' into merge_next
Extend interface for Ganesha 2.0 recovery using dbus interface.

I believe that this interface covers all the needs from the 1.5 version. It is a
python script that takes event and IP or node-id as input. The only difference is
that if multiple IP or node-id needs to be taken over than the script should be
called multiple times, once for each IP. All events will put Ganesha in grace period.
In the case of EVEN_RELEASE_IP it will release all NLM locks for this IP, for now all
NLM locks are released. In the case of EVENT_TAKE_IP or EVENT_TAKE_NODEID it will read
in the NFSv4 client-id for the given IP or node-id.
(cherry picked from commit 39e3e051e98af2f44bd48368b349dbdbb3deca5e)

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Merge remote-tracking branch 'sachin/travis' into merge_next
Fix fsal_obj leak in cache_inode_lookupp_impl()

cache_inode_lookupp_impl() used to first call FSAL lookup() which creates a
fsal_obj, but then used cache_inode_get() with the parent key from the object
to get a cache entry. This caused a leak of the fsal_obj created by the
lookup() call which was never released.
A simpler and safer approach is to call cache_inode_new_entry() directly using
the fsal_obj created by lookup().

Signed-off-by: Amit Dror <amitd@infinidat.com>
(cherry picked from commit 8572b25e410f89b1dadae75c70edf0c551183d26)

Signed-off-by: Jim Lieb <jlieb@panasas.com>
9P/RDMA: fixed bad lock management in 9P/RDMA callbacks.
(cherry picked from commit 1a45f123588017bf05975d05ff807fa5a1009243)

Signed-off-by: Jim Lieb <jlieb@panasas.com>
RPM: cleaner mansagement of configuration file

Tags like %config and %config(noreplace) are now used.

(cherry picked from commit c4ccfedffc13af1be407e07455dbc9a76682fffb)

Signed-off-by: Jim Lieb <jlieb@panasas.com>
NFS: a bug fix provided by Ming Chen (v.mingchen@gmail.com)
(cherry picked from commit 6b93f6f901520d6edb065bc8f46017e516eeedfc)

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Fixed missed part of cache_inode_check_setattr_perms port

Problem was/is in 8fd875c4d112d5876

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Initialize attrlist in FSAL_PROXY.

This fixes a segmentation fault because of unitialized attrlist.  The stack of
the segfault is:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd5bd7700 (LWP 2399)]
pthread_rwlock_wrlock () at
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:39
39              LOCK
(gdb) bt
\#0  pthread_rwlock_wrlock () at
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:39
\#1  0x00000000004cfbb3 in nfs4_acl_release_entry (pacl=0x615f3473666e3a20,
		pstatus=0x7fffd5bd53ac)
    at /home/mchen/nfs-ganesha/src/support/nfs4_acls.c:327
\#2  0x00000000004b167b in cache_inode_refresh_attrs (entry=0x7ffff1492000,
		opctx=0x7fffd5bd6c30)
    at /home/mchen/nfs-ganesha/src/include/cache_inode.h:828
\#3  0x00000000004b33d8 in cache_inode_lock_trust_attrs (entry=0x7ffff1492000,
		opctx=0x7fffd5bd6c30, need_wr_lock=false)
    at /home/mchen/nfs-ganesha/src/Cache_inode/cache_inode_misc.c:721
\#4  0x00000000004a7a70 in cache_inode_getattr (entry=0x7ffff1492000,
		req_ctx=0x7fffd5bd6c30, opaque=0x7fffd5bd54e0,
		    cb=0x46be5e <Fattr_filler>) at
/home/mchen/nfs-ganesha/src/Cache_inode/cache_inode_getattr.c:88
\#5  0x000000000046bf26 in cache_entry_To_Fattr (entry=0x7ffff1492000,
		Fattr=0x7ffff2d74510, data=0x7fffd5bd55d0,
		    objFH=0x7fffd5bd55d0, Bitmap=0x7ffff2acb848) at
/home/mchen/nfs-ganesha/src/Protocols/NFS/nfs_proto_tools.c:3086
\#6  0x0000000000450f00 in nfs4_op_getattr (op=0x7ffff2acb840,
		data=0x7fffd5bd55d0, resp=0x7ffff2d74500)
    at /home/mchen/nfs-ganesha/src/Protocols/NFS/nfs4_op_getattr.c:113
\#7  0x0000000000449d40 in nfs4_Compound (arg=0x7ffff2a93870,
		export=0x7ffff4887000, req_ctx=0x7fffd5bd6c30,
		    worker=0x7ffff2cbb080, req=0x7ffff2a937c8, res=0x7ffff2ef7140)
    at /home/mchen/nfs-ganesha/src/Protocols/NFS/nfs4_Compound.c:334
\#8  0x000000000043a2fb in nfs_rpc_execute (preq=0x7ffff2a90980,
		worker_data=0x7ffff2cbb080)
    at /home/mchen/nfs-ganesha/src/MainNFSD/nfs_worker_thread.c:1038
\#9  0x000000000043a9cf in worker_run (ctx=0x7ffff487fb80) at
	/home/mchen/nfs-ganesha/src/MainNFSD/nfs_worker_thread.c:1272
\#10 0x00000000004de72c in fridgethr_start_routine (arg=0x7ffff487fb80) at
	/home/mchen/nfs-ganesha/src/support/fridgethr.c:552
\#11 0x00007ffff661e851 in start_thread (arg=0x7fffd5bd7700) at
	pthread_create.c:301
\#12 0x00007ffff616490d in clone () at
	../sysdeps/unix/sysv/linux/x86_64/clone.S:115