Add CMake rules for thread-sanitizer

thread-sanitizer is a data race detector introduced into GCC from GCC 4.8.  The
patch has been tested on CentOS 6.4 using CMake 2.8.10.2 and GCC 4.8.2.

Reviewed-by: Jim Lieb <jlieb@panasas.com>
Tested-by: Ming Chen <v.mingchen@gmail.com>
Signed-off-by: Ming Chen <v.mingchen@gmail.com>
Fix data race caused by open_fd_count

Wrap all open_fd_count accesses with atomic operators.

Reviewed-by: Jim Lieb <jlieb@panasas.com>
Signed-off-by: Ming Chen <v.mingchen@gmail.com>
Fix a trivial data race in xdr_nfs_argop4()

slhd is no more than a write scratch buffer.  It does not hurt much to make it
non-static, but this make tsan happier.

Signed-off-by: Ming Chen <v.mingchen@gmail.com>
Fix a trivial data race in put_gsh_client()

Signed-off-by: Ming Chen <v.mingchen@gmail.com>
Fix a deadlock regarding free_contexts in pxy_compoundv4_execute()

The "if" test introduced a deadlock.  Consider there are 2 items (i.e., x = 2)
in the list of free_contexts, then the following execution order will deadlock:

            T1            T2            T3            T4            T5
            (1)           (2)           (3)           (4)           (5)
          x == 2        x === 1       x == 0        x == 0        x == 0
acquire   x = 1         x = 0         block         block         block

                                        (8)
                                      unblock
                                      x == 2
                                      x = 1 (acquire)

            (6)         (7)            (9)
          x == 0      x == 1          x == 1
          signal      no signal       no signal
release   x = 1       x = 2           x = 2

Thread T4 and T5 will wait forever.

Also, use a separate lock "context_lock", instead of the global "listlock", to
protect the "free_contexts" list.

Signed-off-by: Ming Chen <v.mingchen@gmail.com>