glusterd: Moved peer rsp handling functions to glusterd-utils

- Moved inner functions used in conjunction with synctask, 'out'.

Change-Id: I7fbfd9881ea58645c4295a9fa7163ddd15a45d2f
BUG: 862834
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4066
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: volume-start, add-brick and remove-brick to use synctask framework

- Added volume-id validation to glusterd-syncop code.
- All daemons are restarted using synctasks in init().
- glusterd_brick_start has wait/nowait variants to support
  volume commands using synctask framework and those that aren't.

Change-Id: Ieec26fe1ea7e5faac88cc7798d93e4cc2b399d34
BUG: 862834
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/3969
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli: Changes and enhancements to XML output

This patch contains several xml related changes which fix some bugs and
introduce xml output for commands which were missing it. These include,
* XML output for rebalance & remove-brick status
* XML output for replace-brick
* XML output for 'volume status all' in on xml document
* proper XML output for "volume {create|start|stop|delete}"
* type & status of a volume in 'volume info' is now given as a string as well

This patch also cleans up the '#if (HAVE_LIB_XML)' sections from the code-base,
so that it is not littered around.

Change-Id: I5bb022adf0fedf7e3ead92b4b79bfa02b0b5fef5
BUG: 828131
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/3869
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
build: do not unconditionally restart glusterd in glusterfs-geo-replication %post

When the glusterd service is disabled and/or not running, the %post
scriptlet for the glusterfs-geo-replication sub-package should not start
glusterd.

To resolve this, an additional condition will only restart glusterd on an
update ($1 -ge 1) and only when it is running (condrestart).

Change-Id: I4c18954e979377cf7211c3a55d14896898836fe6
BUG: 766640
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/4063
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
client-handshake: synchronize config.remote_port setting b/w
rpc_clnt_reconnect and client_query_portmap_cbk

problem:
-------
Theoretically there is a possibility that we could complete
querying the remote brick's port number before rpc_transport_connect
can return. If rpc_clnt_reconnect happens to be the caller of
rpc_transport_connect and we've already got the remote brick's port
number by the time rpc_transport_connect returns, without synchronization,
rpc_clnt_connect resets config.remote_port to zero even before we have
attempted a connection with remote brick.

fix:
---
By making only poll thread do setting and resetting of
config.remote_port, we avoid the race-condition.

Change-Id: I51879ba1cac651a80ff5c9c070ec7fe1ceea9e05
BUG: 765051
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.org/4044
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: gluster volume heal $VN info sporadically reports nothing to heal

PROBLEM:
Whenever rsync is done at the mount point of a replicate volume and during the
rsycn glusterd and bricks of one of the machine gets killed then executing
gluster volume heal info gives results sporadically.Sometimes it says Number of
entries are zero and other time it gives different output. When glusterd and
brick of one of the machine gets killed then at other machine,
RPC_CLNT_DISCONNECT will get triggered periodically. So it may happen that
during the execution of gluster volume heal info command, RPC_CLNT_DISCONNECT
also gets triggered and glusterd will assume that it got a new rpc_disconnet
notification and glusterd will call the glusterd_op_ac_send_unlock_drain
function instead of calling the glusterd_op_ac_rcvd_brick_op_acc function which
is responsible for printing the entries. So because of RCP_CLNT_DISCONNECT
notification, glusterd will execute functions responsible for
RPC_CLNT_DISCONNECT(glusterd_op_ac_send_unlock_drain) rather than executing
functions responsible for gluster volume heal info
command(glusterd_op_ac_rcvd_brick_op_acc).

FIX:
Put a condition in for RPC_CLNT_DISCONNECT in the glusterd_peer_rpc_notify
function so that if RPC_DISCONNECT is triggered for the first for a peer then
glusterd mark that peer as disconnected so that if RPC_DISCONNET is triggered
again, because peer is already marked as disconnected, glusterd will not inject
EVENTR_ACK_DRAIN and prints the Number of entries.

Change-Id: I770e3175b050fd7c7beb801b611a2dff9bfcbac8
BUG: 857503
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4043
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
replicate: don't use synctask_new from within a synctask

Change-Id: Iebf821ff720c63ab6da4b219d82c7f1d00769992
BUG: 862838
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4032
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
storage/posix: remove dependency on loc->path in posix_lookup()

Change-Id: I0a3bc8650d9ff83977be696aa5caf9c7570197fd
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 781318
Reviewed-on: http://review.gluster.org/3997
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli: introduce "--" as option terminator

This way it becomes possible to pass option-like arguments to
cli commands.

Change-Id: I8eb1a44ce5d1bfe901d2b3e7cc7bfb84bb3012c9
BUG: 815194
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.org/4007
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
performance/write-behind: use try lock while taking statedumps

Change-Id: I690e8bf650d6e6e50899c2e17a79f42789e701eb
BUG: 843792
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4036
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Preventing client crashing as the callings of GF_CALLOC has been failed.

As the callings of GF_CALLOC can seldom come to a failure, glusterfs client
will crash due to segment fault. We should have returned once the variables
of transaction's local can't be alloced.

Change-Id: Ia3798b8349d832b23c7825e64dbad93ebe29cd1b
BUG: 861335
Signed-off-by: linbaiye <linbaiye@gmail.com>
Reviewed-on: http://review.gluster.org/4005
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfs man page edit

Updated man page,
* Added some of the options which were not there before.
* Updated the default dirs.

Change-Id: Ia796377120dc2fb990b2591c7607a16ef93f1fe2
BUG: 825906
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Reviewed-on: http://review.gluster.org/4060
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
features/quota: Accept float numbers for quota limit.

Quota limit can be given a floating value like 2.5GB or 0.5TB, which was not
possible before.

Change-Id: I2c89fd521e8b70be51252677c7986abcfa9d11a2
BUG: 819394
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Reviewed-on: http://review.gluster.org/4068
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
core: Add support for systemtap

- First cut (configure plumbing only)
- Intended to allow people who want to test userspace
  probes for their favourite xlator(s).

Change-Id: I5bf202073a2f1cc29dc4a55714167b7f48b463a1
BUG: 865734
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/3638
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr : Edited log message in afr_sh_entry_expunge_entry_cbk

Change-Id: I9f7562d28c8bc798552c403164397f929a7bd1e7
BUG: 860246
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4052
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
protocol/client: Conditional logging in client3_3_unlink_cbk

Change-Id: I4af398362cdb3f99782dcd3728988e4cf1fbb479
BUG: 861925
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4069
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Fix a small typ-o in the Swift README

Change-Id: I6c737bcc0d60d656df63ffe1c03ad336606ec090
BUG: 862052
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4080
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Refactor to use pyxattr's get/set/remove methods

These methods are not deprecated, the old ones with the xattr suffix are
considered deprecated starting with 0.4 of pyxattr.

Change-Id: I86ba7a44cec81a273931bf7e470de5eb04e82663
BUG: 865858
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4077
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
write-behind: use uint64_t for overlap comparison

off_t is 'long int' (signed word) and therefore ULLONG_MAX - 1

Change-Id: I027de7a1b2ca24865d5d787f9986930e97911ca4
BUG: 857673
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4079
Fix BZ 865858: remove unnecessary system calls around xattr ops

The following is a simple refactoring of the read and write metadata methods
to just make calls to get/set/remove xattr operations instead of trying to
stat/open/close the file. For a single GET operation, this brings down the
number of system calls made from 13 to 3 for a file object with no
significantly sized metadata (meaning, only 1 xattr key/value pair is needed
to store the metadata).

Change-Id: I698f5886d63d5203f130c8eac1536a3ee4b0dbfb
BUG: 865858
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4078
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>