cli,glusterd: Implement 'volume status tasks'

oVirt's Gluster Integration needs an inexpensive command that can be
executed every 10 seconds to monitor async tasks and their parameters,
for all volumes.

The solution involves adding a 'tasks' sub-command to 'volume status'
to fetch only the async task IDs, type and other relevant parameters.
Only the originator glusterd participates in this command as all the
information needed is available on all the nodes. This is to make the
command suitable for being executed every 10 seconds.

Change-Id: I1edc607baf29b001a5585079dec681d7c641b3d1
BUG: 1012346
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/6006
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
tests/basic/rpm.t: fix script error introduced by commit a66bf679

The if-clause will always return false, causing each regression test to
build the rpms. The following error is listed on the Jenkins Console
Output of the regression test:

    ./tests/basic/rpm.t: line 42: [: argument expected

BUG: 904005
Change-Id: I343c80d8c57fa0ec8b8a531bb5f5c86209d88d7e
CC: Harshavardhana <harsha@harshavardhana.net>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/6057
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
features/qemu-block: invoke bdrv_init() only once

bdrv_init() is intended to be invoked only once. If invoked again
after initialization (i.e., due to graph changes), the block driver
registration code can reinsert entries into bdrv_drivers,
effectively corrupting the NULL terminated linked list. This
manifests as an infinite loop for callers attempt to traverse the
list (to locate a driver).

BUG: 986775
Change-Id: I2f95bda3c753dece4648cdad009d0e2a2d16f644
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/6021
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
contrib/qemu: disable coroutine caching in qemu

Coroutine caching in qemu is dangerous in the manner that the
qemu-block translator embeds the qemu block subsystem code. After
a graph switch, new requests can fork off and pass active graph
data structures (i.e., inodes) down into old syncenvs and old
graphs, leading to failures.

BUG: 986775
Change-Id: I7b7226ff57c7867d0e51a58a7c0e58f4d8424c31
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/6022
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpm: glusterfs-api-devel requires glusterfs-devel

When installing the glusterfs-api-devel package in order to build
software that uses libgfapi, there are unmet dependencies. Installing
glusterfs-devel additionally solved these link errors:

  $ echo 'int main(){}' > bar.c
  $ gcc -o bar bar.c $(pkg-config --libs glusterfs-api)
  /usr/bin/ld: cannot find -lglusterfs
  /usr/bin/ld: cannot find -lgfrpc
  /usr/bin/ld: cannot find -lgfxdr
  collect2: error: ld returned 1 exit status

Change-Id: I12e922aa6609809c03ec2c9a0d8a47c5df91d0a1
BUG: 1017094
Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/6056
Reviewed-by: Bala FA <barumuga@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Handle quota size xattr separately in lookup

Quota size xattrs are not maintained by afr. There is a
possibility that they differ even when both the directory
changelog xattrs suggest everything is fine. So if there is at
least one 'source' check among the sources which has the maximum
quota size. Otherwise check among all the available ones for
maximum quota size. This way if there is a source and stale copies
it always votes for the 'source'.

Change-Id: Ia222379cbafa7043dd03f533c105860f2c7b8b0d
BUG: 1016683
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6052
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Varun Shastry <vshastry@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gfapi: Fix iobuf leaks in gfapi

In glfs_readv, if syncop_readv() fails with return value <= 0
the iobref was not being unrefd which would cause iobuf leaks.

Change-Id: I9850ae149e53cf75ba26f8b5f4c5446cce4b5991
BUG: 1018176
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6074
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gfapi: object handle based API extensions

There is an ongoing effort to integrate NFS Ganesha (
https://github.com/nfs-ganesha/nfs-ganesha/wiki ) with GlusterFS as one of
the file system back ends.

Towards this we need extensions to gfapi that can handle object based
operations. Meaning, instead of using full paths or relative paths from
cwd, it is required that we can work with APIs, like the *at POSIX
variants, to be able to create, lookup, open etc. files and directories.
Hence the objects are the files or directories themselves and we give out
handles to these objects that can be used for further operations.

This code drop is an initial implementation of the proposed APIs.

The new APIs are implemented as glfs_h_XXX variants in the file
glfs-handleops.c to mirror glfs-fops.c style. The code leverages holding
onto inode references and doling these out as opaque/cookie type objects to
the callers, to enable them to be used as handles in other operations.

An fd based approach was considered, but due to the extra footprint that
the fd structure and its counterparts would incur, this was dropped to take
the approach of holding inode references themselves.

Tested by extending glfsxmp.c to invoke and exercise the added APIs, and
further tested with a reference integration of the same as an FSAL with NFS
Ganesha.

Change-Id: I23629c99e905b54070fa2e6565147812e5f3fa5d
BUG: 1016000
Signed-off-by: R.Shyamsundar <srangana@redhat.com>
Reviewed-on: http://review.gluster.org/5936
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
build: sync glusterfs.spec.in with Fedora glusterfs.spec

(this is the master branch)

sync with Fedora glusterfs.spec 3.4.1-2+

Change-Id: I8a303efb0ac8cd3e04531e2f02427e3590387493
BUG: 950083
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/6059
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfs.spec: Add _sharedstatedir for RHEL5

-------------------------------------------------
> # rpm --showrc | grep sharedstatedir | grep com
-14: _sharedstatedir %{_prefix}/com
> # cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
-------------------------------------------------

EL5 package has a missing macro _sharedstatedir which
should be pointing to `/var/lib` not `%{_prefix}/com`

Change-Id: Ida72360d73d5dffa767c69642ee395e9c82fa8c6
BUG: 1003184
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/6054
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
transport/socket: don't try to set TCP_DELAY on unix domain sockets

Change-Id: I290cd983bd0dff2e32e5ee90a12e888a3b31c6fd
BUG: 969461
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/5954
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
changes for marker to support count number of files in a directory hierarchy.

Change-Id: I0668fd149c7da398331456ccbb42964f28f4afdb
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Merge branch 'mqc' of github.com:vbellur/glusterfs-objcount into mqc