glusterd/snapshot: Inherit the mount options of a original brick when creating snapshots.

When creating a snapshot a LVM is created at the backend and is mounted
under /var/run/gluster/snaps/... However, this mount does not inherit
the mount options for the original brick acting as the parent for the
snap.

If the snap is restored, this could lead to performance degredations,
functional limitations, or in extreme scenarios even potential data
loss.

Change-Id: I67d70fd83430d83dacc5380c6c928e27fb9c9e1b
BUG: 1145088
Signed-off-by: Vijaikumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/8394
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8802
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Parsing key/value pair with value containing '='.

Parsing key/value pair in the brickinfo file, where value contains '='
would truncate everything after '=' in value.

For example:
A key/value pair
mnt-opts=rw,noatime,allocsize=1MiB,noattr2

is parsed as:
mnt-opts=rw,noatime,allocsize

Change-Id: I4e279c2a356a8a16eb20d4358d7c8a8cc5724b65
BUG: 1145090
Signed-off-by: Vijaikumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/8507
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Sachin Pandit <spandit@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8803
Tested-by: Gluster Build System <jenkins@build.gluster.com>
glusterd/snapshot : Fail the snapshot create operation if geo-rep is running

As one of the recommandations for taking a snapshot is not to have
an active geo-replication session, its better to display an error
saying session is active when snapshot create command is issued.

Change-Id: I94593dbd2659610e033ca316176dda1ac8dc5ce6
BUG: 1145091
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8461
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8804
cli/snapshot : update of a snapshot delete syntax in documentation.

Change-Id: Id1a4b9684a8dd5750ee6eed841e3d5195407fb7e
BUG: 1145084
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8534
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8805
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
cli/snapshot : Add confirmation dialog to snapshot restore operation.

When restoring a volume, the user is not prompted for confirmation.
Since restoring a volume rolls back the data to a previous point in time,
there is the potential for updates to be lost.
Hence it is better to display a confirmation dialogue during snapshot
restore operation.

Change-Id: I7b23eaeb43ad2aafa508e2ca5750d9b0fc7d6e36
BUG: 1145092
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8525
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8806
glusterd: Set the rlimit for Open FDs to higher value.

Default 'open FD limit' is 1024. As the number of volumes/bricks
increases, brick-to-glusterd socket FDs also increases in glusterd and
runs out of the limit.

Solution is to set the 'Open FD' limit to higher value in glusterd

Change-Id: Iaa60b2155df2fa5a0759e054bdebffbc09f63ec1
BUG: 1145095
Signed-off-by: Vijaikumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/8578
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8807
test : Fix for spurious failure

Problem : Once the features.uss is enabled it does not wait for
the process to be created. And if we try to check for
the pid of the snapd then it will not be present which
causes a failure.

Solution : Adding a EXPECT_WITHIN which waits to get the pid
until certain time period.

Change-Id: I5fdda9beecf867b7544f2e4b830f698ddf6e3bec
BUG: 1145189
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8809
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
features/marker: Fill loc->path before sending the control to healing

        Backport of: http://review.gluster.org/8296

Problem:
The xattr healing part of the marker requires path to be present in the loc.
Currently path is not filled while triggering from the readdirp_cbk.

Solution:
Current patch tries to fill the loc with path.

Change-Id: I2e2589ecfa6b6a6e27407c9541fa90a314649bec
BUG: 1145623
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/8820
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: Don't start heal when lookup succeeds on < 2 children

        Backport of http://review.gluster.org/8698

Problem:
When self-heal code doesn't see at least 2 successes on looking up children,
then self-heal can't be done. What is happening now is if all the lookups fail
then the pending changelog is all zeros in xattrs so all the children are
becoming sources and leading to crashes when the code paths further assume that
some data structures are populated properly

Fix:
Don't proceed with self-heals when < 2 children succeed lookups.

BUG: 1145726
Change-Id: I65465843f0e554c8ccdd8fa930ab42ac123ec023
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8824
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: Do not reset pending xattrs on gfid or type mismatch in entry-sh

        Backport of: http://review.gluster.org/8816

Change-Id: I8463a579f542a2336b02edba8f5fbfea0edbbffe
BUG: 1136829
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/8823
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
ec: Add config information in an xattr

To simplify backward compatibility of the ec xlator when some
parameter or the implementation itself is changed, a new xattr
is added to each file with the configuration needed to recover
it.

The new attribute is called 'trusted.ec.config', and it's a 64-bit
value containing the following information:

    8 bits: version of the config information (currently always 0)
    8 bits: algorithm used to encode the file (currently always 0)
    8 bits: size of the galois field (currently always 8)
    8 bits: number of bricks
    8 bits: redundancy
   24 bits: chunk size (currently 512)

This new xattr could allow, in a future version, to have different
configurations per file.

This is a backport of http://review.gluster.org/8770/

Change-Id: I8c12d40ff546cc201fc66caa367484be3d48aeb4
BUG: 1140862
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8825
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Authenticate management handshake requests

Backport of
  371bb42 glusterd: Authenticate management handshake requests
from master.

Management handshake requests, which are used to validate op-version
supported by the peers, are now only allowed if,
- the glusterd doesn't have any other peer, or
- the request was sent by another peer.

This prevents the op-version of a peer being changed because of a
connection attempt by an invalid peer.

BUG: 1144978
Change-Id: I5a909dad37e9873efe8b75dad41b7af71ce91c3d
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/8819
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Add last successful glusterd lock backtrace

Also, moved the backtrace fetching logic to a separate function.
Modified the backtrace fetching logic able to work under memory pressure
conditions.

Change-Id: Ie38bea425a085770f41831314aeda95595177ece
BUG:1145093
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/8794
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Do not hardcode setfattr(1) path

Turn setfattr(1) absolute path into an OS-dependant macro. Let compiler
option override it to fit custom installation if needed.

Backport of I8f469c5741a85b6e8d8f6299a9540b3d64611d2f

BUG: 1138897
Change-Id: I279752f2ec5db1abc25830cb9a23290cc401d517
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8828
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: Fixed mem leaks in self-heal code path.

	backport of: http://review.gluster.org/8821

AFR_STACK_RESET previously didn't cleanup afr_local_t,
leading to memory leaks. With this patch, cleanup is
done.

All credit goes to Pranith Kumar Karampuri.

Change-Id: I26506dfd9273b917eff5127c3e0cf9421e60f228
BUG: 1145914
Reviewed-on: http://review.gluster.org/8831
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
doc/snapshot : admin guide updation.

Change-Id: I1980bc0984f941cd415fbc754495353f561155a8
BUG: 1145084
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8817
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/8829
cluster/afr: Fix spurious metadata self-heals

        Backport of http://review.gluster.org/8709

- Added logging for metadata and data self-heals which helped
  in debugging this issue.
- Added checks to skip self-heals when no sinks are available to heal

BUG: 1145987
Change-Id: Ide03af4f531a1280ec8ad95b627285df4d7bc42d
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8832
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
OSX/FreeBSD: Regression fix

Introduced in "1f6e992f1aaa676be5bd47d17e58f1171825cf43"

Change-Id: Id684e2f082def7d01ef3c258ea6598da6205591f
BUG: 1117822
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8840
Reviewed-by: Justin Clift <justin@gluster.org>
Tested-by: Justin Clift <justin@gluster.org>
socket: Fixed parsing RPC records containing multi fragments

In __socket_proto_state_machine(), when parsing RPC records containing
multi fragments, just change the state of parsing process, had not
processed the memory to coalesce the multi fragments.

Change-Id: I5583e578603bd7290814a5d26885b31759c73115
BUG: 1146200
Signed-off-by: Gu Feng <flygoast@126.com>
Reviewed-on: http://review.gluster.org/8662
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/8838
build: remove /sbin/ldconfig as interpreter

using /sbin/ldconfig as interpreter in pre/post/postun throws error
/sbin/ldconfig: relative path `1' used to build cache

BUG: 1145992
Change-Id: If28415e60061ccf043a89511c192e444f162b754
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: http://review.gluster.org/8836
Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com>
Reviewed-by: Lalatendu Mohanty <lmohanty@redhat.com>
Tested-by: Lalatendu Mohanty <lmohanty@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>