common-utils: implement iov_copy

Change-Id: I7ab97279dafc1211b417e1c03332572887453c66
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3663
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Shishir Gowda <sgowda@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
libglusterfs,mount/fuse: implement gidcache mechanism in fuse-bridge

This change genericizes the cache mechanism implemented in commit
8efd2845 into libglusterfs/src/gidcache.[ch] and adds fuse-bridge as
a client. The cache mechanism is fundamentally equivalent, with some
minor changes:

  - Change cache key from uid_t to uint64_t.
  - Modify the cache add logic to locate and use an entry with a
    matching ID, should it already exist. This addresses a bug in
    the existing mechanism where an expired entry supercedes a newly
    added entry in lookup, causing repeated adds and flushing of a
    cache bucket.

The fuse group cache is disabled by default. It can be enabled via
the 'gid-timeout' fuse-bridge translator option and accompanying
mount option (i.e., '-o gid-timeout=1' for a 1s entry timeout).

BUG: 800892
Change-Id: I0b34a2263ca48dbb154790a4a44fc70b733e9114
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.com/3676
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
build: Create directories and files that get created during runtime

This should not be needed for files marged as "ghost", but rpm-4.9 is
broken in this respect :-(

Building the packages works again:
$ make dist
$ rpmbuild -ta glusterfs-3git.tar.gz

The now created files and directories are not packaged in the RPM, but
are marked as belonging to the packages. Here a example for
glusterfs-geo-replication:
$ rpm -qlp glusterfs-geo-replication-3git-1.fc17.x86_64.rpm \
    | grep /var/lib
/var/lib/glusterd/geo-replication
/var/lib/glusterd/geo-replication/gsyncd.conf
$ rpm2cpio < glusterfs-geo-replication-3git-1.fc17.x86_64.rpm \
    | cpio -t --quiet '/var/lib/*'
$

Change-Id: I32019cfbf40e25d9b7ce875fa92b98bae19dabee
BUG: 839668
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=839656
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.com/3674
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
storage/posix: use ssize_t variable to get the return value of getxattr

Change-Id: Ida065e108a1d2a61b134fb847e8c4981b46fc3c6
BUG: 838195
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3673
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
common-utils: implement generate_glusterfs_ctx_id()

This patch creates a common and shared version of the often copy/
pasted generate_uuid() function, which is used to create an ID string
to uniquely identify an instance of a glusterfs process/glusterfs_ctx_t.

Change-Id: Ie4e697ae28b6e954c5c261c69e37738f289d77e4
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3677
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
rpc-transport/socket: Add SSL support.

Based on OpenSSL.  Key/certificate management is still manual.  Enabling
SSL also enables multi-threading, though multi-threading can be forced on
or off using a separate option.

Change-Id: Icd9f256bb2fd8c6266a7abefdff16936b4f8922d
BUG: 764731
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.com/362
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
storage/posix: use the size returned by getxattr to allocate memory

Change-Id: I71c234b12a1d16405e508b715932022fdce346f0
BUG: 838195
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3681
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfs_ctx_t: un-globalize the filesystem context

So far there has been a global glusterfs_ctx_t object which
represents the running instance of the filesystem (client or server).
It contains the various graphs, connection to the management daemon
over which new graphs are obtained, calls stacks issued on this
filesystem, and a bunch of such things.

With the introduction of libgfapi, it is no more true that there will
be only one filesystem context in a process. Applications can
be written to use libgfapi and obtain serveral instances of different
filesystems/volumes in the same process.

This involves messy untangling of assumptions inside libglusterfs that
there would only be one global glusterfs_ctx_t and offload that
assumption to glusterfsd/ and cli/ (where it is true).

Change-Id: Ifd7d1259428c26076140a5764a2dc7361694139c
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3678
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
stripe: filter coalesce key in getxattr()/listxattr()

as 'stripe-coalesce' is an internal key, no need to show it on top
of the mount-point.

Change-Id: Iab836e73d59c42774db8a2eee13fe3b0cd994bc9
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 801887
Reviewed-on: http://review.gluster.com/3680
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <sgowda@redhat.com>
dump_version_cbk fixed

Change-Id: I5ab615ce8a7b52668735e3689531a11b8bd85e49
Fixes to op_version validation

Change-Id: I81a27a1fee534cb668f1c4d4183bda96f92efc5a
geo-rep / gsyncd: rsync option cleanups, fixes

- add two tunables for rsync: "rsync-options" and "rsync-ssh-options"
- always pass "--no-implied-dirs" to rsync

Change-Id: I3d67a4cba8cabd681edac80e6b1fb8ea322008bd
BUG: 841062
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3682
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
mount/fuse: check for fuse inval notify support when fopen-keep-cache enabled

The fopen-keep-cache feature relies on the fuse notification system
to operate correctly. As Csaba has pointed out, the inode invalidation
functionality was added in FUSE version 7.12. Require that the user
have 7.12 or later to enable fopen-keep-cache. If not supported, warn
the user and disable the feature.

BUG: 833564
Change-Id: Ib9eecb56b689d8edff118b34e2dcc7dba6539b04
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.com/3690
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libglusterfs: remove debug log messages from gidcache

The debug log messages for every cache lookup/add pollute the debug
output.

BUG: 800892
Change-Id: I6b75fd5b7005b8c007106347de8827a0d6c2fd03
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.com/3692
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
gfapi: API/library for accessing gluster volumes

Change-Id: Ie4cbcf91b58218bebf23cf951c313aceeb29f311
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3664
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Bharata B Rao <bharata.rao@gmail.com>
glusterfs-api.pc: pkgconfig for API consumers

Change-Id: I08c60ff9ec5d336077c39f903720f8850d4ddc72
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3665
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
glfsxmp: libgfapi based example

This is an example application which uses libgfapi. It is
a complete autotools based build system which demonstrates the
required changes in configure.ac, Makefile.am etc to successfuly
detect for and build an application against libgfapi.

There are two approaches to building a libgfapi based application:

1. In the presence of pkg-config in your build system.
This is the recommended approach which is also used in this example.
For this approach to work, you need to build glusterfs by passing
--pkgconfigdir=/usr/lib64/pkgconfig (or the appropriate directory)
in your distro. This already happens if you build RPMs with the
glusterfs.spec provided in glusterfs.git. You will also need to
install glusterfs-api RPM.

2. In the absence of pkg-config in your build system.
Make sure your LDFLAGS includes -L/path/to/lib where libgfapi.so is
installed and -I/path/to/include/glusterfs where the 'api' directory

Change-Id: Ic4eab2df002d7e8d20593a03e643859423048848
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3666
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Example of using libglfs from Python.

Change-Id: I081582c457428d55db8ec1ed6d90f1e439f51f0d
BUG: 839950
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.com/3675
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfs-api.pc: include pkgconfig file in -devel RPM

Previous patch missed out including the .pc file in the -devel
RPM while purging the -api.rpm.

Change-Id: I895feefc62e88a962a829612aa829401fed081f8
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3693
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cluster/distribute: cli support for setting directory-layout-spread

gluster volume set <volname> subvols-per-directory

Change-Id: I5f1420eeb2268897d9b4c70edb933ed1f07649d1
BUG: 838006
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.com/3634
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>