encryption/rot-13: Cleanup trailing whitespaces

Change-Id: I9f5c81ca4320b6e73087023102dff6e3911b5095
BUG: 764890
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/4251
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
tests: Test the exit status of touch

Change-Id: I4fd52d6b54c5bcf16298c3a9ec98a12fea8df957
BUG: 860663
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4254
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: Provide option to disable readdir failover

In a replica pair unlike files, directories may not have their
content in same order, so readdir for same (offset, size) may
not give same entries on both the sobvolumes of replica pair.
Switching over from one subvolume to another may not be a good
idea sometimes. It may lead to duplicate entries or fewer entries
or both. This patch provides a way to disable readdir-failover
so that applications like rebalance can retry if they want to.

Change-Id: I2b23eb224a2e84016a561362932613ac824c11a0
BUG: 859387
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4159
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
tests: Perform self-heal in foreground

Change-Id: Ic9fa7ffe9cd704740e920b66162950f0c0322e67
BUG: 865825
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4253
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cli: Fix build when libxml2 is absent

Also added a note to the top of cli-xml-output.c, explaining the style of coding
to followed when adding code to it.

Change-Id: I7f90a9c075adb49a9e071771d136b6f01ea68d11
BUG: 882780
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4256
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
socket,rdma: before binding to any port check if it is a reserved port

* The list of ports which are reserved is obtained by reading the file
  /proc/sys/net/ipv4/ip_local_reserved_ports.

Change-Id: I3a832f53efbb79dd719b34a30cbaf28269f25816
BUG: 762989
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4131
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cli: fix incorrect xml output of brick tag.

Incorrect output:
<brick>
  <brick>
  </brick>
</brick>

Expected output:
<brick></brick>
<brick></brick>

Change-Id: I40c30feda4e6f3f1ec5da4122f8965b61c511ae6
BUG: 880993
Signed-off-by: JulesWang <w.jq0722@gmail.com>
Reviewed-on: http://review.gluster.org/4262
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: Kaushal M <kaushal@redhat.com>
nfs: do opendir for "naked" readdirp to force self-heal checks

Instead of an opendir, the first thing the Linux NFS client usually sends
us is a readdirp at offset zero, effectively bypassing our self-heal checks.
Detect this condition and issue our own opendir to compensate.

Change-Id: I69463370abd6235d705bf80b8c77fae4a61096ae
BUG: 830665
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4067
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
tests: Introduce new test primitive EXPECT_WITHIN

Introduces a new test primitive EXPECT_WITHIN with syntax,
        EXPECT_WITHIN <timeout in seconds> <expected output> <command>
which runs the given command every second and compares its output with the
expected output, till the timeout occurs.

Change-Id: I91c6de157e5d33fffafe532ceba84e2a9223356f
BUG: 857330
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4263
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
libglusterfs: fix unused-but-set-variable warning

Change-Id: Ie152169a70eaec9554382b39d43ae7ffa04f041c
BUG: 762989
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4264
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
geo-rep / gsyncd: play nicely with peer multiplexing when setting a checkpoint

The gsyncd invocation that instruments the "geo-rep config" command is
multiplexed over peers to ensure the uniformity of configuration.
In general, that works well, but checkpoint setting is a special case,
because (unlike other instances of config-set) it is logged (as recording
of checkpoint events is part of the feature).

Problem is that the path components leading to the log file are
created only on the original node, where gsyncd was started.
Therefore the logging attempt will fail on the other nodes.

Fix: ignore if opening the logfile on behalf of checkpoint setting
fails with ENOENT.

Change-Id: I677f3f081bf4b9e3ba4d25d58979d86931e6beb4
BUG: 881997
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.org/4248
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Christos Triantafyllidis <ctrianta@redhat.com>
Reviewed-by: Christos Triantafyllidis <ctrianta@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
fix memory leaks

* write-behind: free the inode context in wb_forget
* distribute: in readdirp callback put the allocated context to the inode
* distribute: check if the layout is NULL before accessing it in layout_unref

Change-Id: I7698f81b85b99d06bf6b01fc1a6e51e1593b5e27
BUG: 790709
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4250
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
dht: support auto-NUFA option

Many people have asked for behavior like the old NUFA, which builds and
seems to run but was previously impossible to enable/configure in a
standard way.  This change allows NUFA to be enabled instead of DHT from
the command line, with automatic selection of the local subvolume on each
host.

Change-Id: I0065938db3922361fd450a6c1919a4cbbf6f202e
BUG: 882278
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4234
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: add "volume label" command

This command is necessary when the local disk/filesystem containing a brick
is unexpectedly lost and then recreated.  Since 961bc80c, trying to start
the brick will fail because the trusted.glusterfs.volume-id xattr is
missing, and if we can't start it then we can't replace-brick or self-heal
so we're stuck in a permanently degraded state.  This command provides a
way to label the empty brick with the proper volume ID so that further
repair actions become possible.

Change-Id: I1c1e5273a018b7a6b8d0852daf111ddc3fddfdc2
BUG: 860297
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4259
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
afr: make flush non-transactional

Flush is historically a transaction to ensure all previous writes
were complete. This is no longer required as write-behind has
learned to make flush a barrier operation (re: conversation w/
Avati).

Flush taking a full file lock causes VMs running on afr volumes
to stall when a migration occurs and self-heal is in progress.
Make afr_flush() a non-transactional operation.

BUG: 874045
Change-Id: If2db83823e280c86b1b29b41361eed7081601632
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4261
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
tests/bug-830665: use the default H0

The use of 'hostname -s' leads to a failure on my VM due to
attempting to create the volume on localhost. Use the default H0
value.

BUG: 830665
Change-Id: Icf23c89d2387fe747aca6d99af12f7d4e1e3fbf0
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4266
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
storage/posix: if create returns EXIST, donot set gfid/xattrs

Change-Id: I9f2b75b10bde428d36d6516aa09c18e590d17ed9
BUG: 864801
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4265
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd, cli: Task id's for async tasks

This patch introduces task-id's for async tasks like rebalance, remove-brick and
replace-brick. An id is generated for each task when it is started and displayed
to the user in cli output. The status of running tasks is also included in the
output of "volume status" along with its id, so that a user can easily track the
progress of an async task.

Also,
 * added tests for this feature into the regression test suite.
 * added a python script for creating files, 'create-files.py', courtesy
   Vijaykumar Koppad (vkoppad@redhat.com) into the test suite.

Change-Id: Ib0c0d12e0d6c8f72ace48d303d7ff3102157e876
BUG: 857330
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/3942
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
afr: support self-heal data trylock mechanism

Introduce a block flag to support an optional blocking or
non-blocking mode in the self-heal data locking mechanism. All
callers are modified to use blocking mode, which is the current
default behavior (no change in behavior is introduced by this
commit).

BUG: 874045
Change-Id: Ib7ff9984578fa11de4e3b6981508100cdddd37cd
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4257
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
afr: use data trylock mode in read/write self-heal trigger paths

Self-heal data lock contention between clients and glustershd
instances can lead to long wait and user response times if the
client ends up pending its lock on glustershd self-heal of a large
file. We have reports of guest vm instances going completely
unresponsive during self-heal of virtual disk images.

Optimize the read/write self-heal trigger codepath
(i.e., afr_open_fd_fix()) to trylock for self-heal and skip the
self-heal otherwise to minimize the likelihood of a running/active
guest of competing with glustershd on arrival of a brick. Note that
lock contention is still possible from the client (e.g., via
lookup).

BUG: 874045
Change-Id: I406443c061ff6acd2a851179626b78352caa5c03
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4258
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>