protocol/client: do not ignore the xdata received for some fops

opendir, fsetattr, fsync, lk were sending NULL xdata to the server
even though it (xdata) had values within it.

Change-Id: Ic274ab903c5c1e443409dd250ede80cd85d10b36
BUG: 826923
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3502
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libglusterfs: valid_host_name() fix

Fix valid_host_name() to allow single character hostnames.

Change-Id: I72527ecedec52fa47336d95b0586eb18dac6273d
BUG: 827403
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3508
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
mount.glusterfs: update the glusterd WORKDIR

Change-Id: I70d091611d314598412b5315adcbe1b5147a8773
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 824231
Reviewed-on: http://review.gluster.com/3513
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
posix: fix the 'ENOENT' logs for setxattr()

from marker, setxattr() is attempted on the path even after the
unlink() happens if the fd is still active. In such cases, we should
not be logging the failures.

Change-Id: Icdd9c951f0d331cdda0bec42ae343302b2dbafde
BUG: 766611
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: http://review.gluster.com/3514
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Self-heald: inode_link files while crawling

Change-Id: I559a3ff507b9487b1dfca7871c188a05d89ea6d6
BUG: 826580
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3515
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
fuse: be good at suicide

We get hung on the exit path if we kill only
the current thread on AUTH_FAILED. Kill indeed
the current process.

Change-Id: I36042f245a22bd2a284df37fd6d3a3e0b76f81e9
BUG: 826975
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3523
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
replicate: default read_child to a local brick if there is one.

Controlled by the "choose-local" option (on by default).

Change-Id: I560f27c81703f2c9c62fdb51532c8eb763826df7
BUG: 806462
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.com/3005
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: Set errstr for duplicate add-brick

Sets op_errstr when add-brick is given a duplicate brick.

Change-Id: I7b8f8139f9f09834a71a5abc725692b145896830
BUG: 803336
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3519
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
core: coverity fixes (mostly resource leak fixes)

currently working on obvious resource leak reports in coverity

Change-Id: I261f4c578987b16da399ab5a504ad0fda0b176b1
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 789278
Reviewed-on: http://review.gluster.com/3265
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Use linkat(2) when linking on symlink

link(2) behavior is not standardized when it comes to symlink. BSD
links to the symlink target (and fails if it does not exist),
Linux links to the symlink itself. Use linkat(2) instead of link(2)
in order to get a portable behavior.

BUG: 764655
Change-Id: If7f6f17b48a4ccf8827c3795ec147306df6b5542
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.com/3507
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli: Fix error output for peer probe on address validation failure

Displays an error message and sets proper return value on failure of address
validation in peer probe.

Change-Id: I5ced5524040e19a95dc832b6f676874983d0f2a7
BUG: 817648
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3520
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfsd: further fd leak fixes for graph change

Change-Id: I8e23d6bb95cddbb3862c524d79d1a956956b7a51
BUG: 789278
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3527
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpc: avoid an invalid free of item on a list

If we actually "consumed" vol_opt by putting it on THIS->volume_options,
it's still in use and we shouldn't free it before returning.

Change-Id: I8ef3e4ce8a8b9f2552faa3345f1686e173d1aa10
BUG: 829104
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.com/3528
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: nfs.disable fix for "volume set help"

Fixes volgen to include "nfs.disable" in output of "volume set help".
Also fixes some incorrect entries in glusterd_volopt_map.

Change-Id: Ica5edf1ece31f9daa040fcdf559c1643ecdfd568
BUG: 828027
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3509
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
mount/fuse: use correct fdctx to inherit direct-io-values from.

Change-Id: Ifea178f4dbe57720c16dc3851b262952f3d81159
BUG: 762533
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.com/3531
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpc-transport/socket: fix the state machine for XDATA reading

The socket state machine was broken for reading XDATA on the server.
This code was structured such that when there was a partial read in
a particular state, some variables would remain uninitialized in the
next 'run' of the state machine. Also did some re-org of the state
machine with two more states to make the code more readable and similar
in state-breakup pattern to the other states.

Change-Id: Ia32c78d4b9567bb08c6df8dc9fd6f05749d312a4
BUG: 829062
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3524
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
protocol/client: Remember the gfid of opened fd

This is needed when the fresh lookup triggers self-heal, gfid
won't be present in inode yet. Similar situation happens with
Rebalance as it does not perform inode_link.
Added similar fix for re-opendir.
Removed inode from fdctx and removed some duplication of code.

Change-Id: Ic94e5738c8585ed86801d2eed9ddab1015246710
BUG: 826080
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3517
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Check for null gfid_req

gfid_req is set only by the fuse xlator. Fresh lookups
performed by self-heal-daemon, rebalance will not have
gfid at all.

Change-Id: I6712e3063067ecc5f19956e75d28c86bfc19fc65
BUG: 829203
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3529
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
mount.glusterfs: Add support for {attribute,entry}-timeout options

Change-Id: Ib41a2537ac86513a008029fca818951706a144f7
BUG: 829279
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3530
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libglusterfs : Fix validation for integer volume options.

Integer volume options which specified only the min value as 0, would not be
validated during "volume set".
The range check for an option happened only if  both min and max were not 0. In
the above case, even though a minium was specified, the range check did not
happen as both min and max were 0.

To allow forced validation in such cases, a new member, "validate", has been
added to volume_options_t. This member takes the values GF_OPT_VALIDATE_BOTH,
GF_OPT_VALIDATE_MIN and GF_OPT_VALIDATE_MAX (GF_OPT_VALIDATE_BOTH is the
default).

Change-Id: I351de0eedb6028120e5c0b073ee5d9c141dee717
BUG: 809847
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3084
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>