statedump: Print entries in cb buffer in FIFO order

Currently cb buffer was being printed in LIFO order, which
is was against the percieved notion of logs having older
entries printed before newer entries in the state dumps.

Re-did the loop to prevent crash as when w_index == 0, we
would access cb[w_index - 1].

Change-Id: Idd085f73fa6937e506a2a1925e42fbcfd2d9bb1c
BUG: 966847
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4968
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/dht: getxattr linkto as root:root

In path based op's like truncate, we use getxattr instead of
fgetxattr call. These can fail with permission denied issues
as linkto file creation, and setattr of ownership is not atomic,
and in cases where setattr failed (subvols down..)

The fix is to perform getxattr as root:root as it is a internal
fop. fgetxattr, bypass the access check, as it already has a valid
open fd.

Change-Id: Ie221c9172e3c1c7ed4e50c8782d362826910756f
BUG: 957074
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4890
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/dht: Do not open fd in migration check/complete for non fd ops

if local->fd == NULL, then in dht_migration_check_complete, do not do
open call. Let the layout get updated, and proceed with invoking the
registered target_fn.

if local->fd == NULL, do not call dht_rebalance_in_progress_check for
truncate fop, but proceed with truncate2.

Change-Id: Ia5a5d40bcea7bfb320ef7096af1e035b8847d4ff
BUG: 960055
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4958
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
protocol/server: Change logs to give more info on disconnects

Change-Id: I8304a12df417be164c564e0696f72c3334f21569
BUG: 952138
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4824
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/dht: Linkfiles creation with correct uid/gid

If renames are done with different uid/gid (non-owners), then we would
end up with incorrect uid/gid.

The fix is to create linkfiles, and heal the uid/gid as root:root. This
preserves our notion of creation as root:root and heal the uid/gid as
root:root in all paths. Additionally, we need to consider uid/gid from
only src_cached subvol, and not from linkfiles.

rename is also done as root:root if done on linkfile, as setattr of ownership
on linkfile is done after the rename

Change-Id: Icb5d431dc42da9c02dfae81980e3fe769a47a274
BUG: 884597
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4682
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
glusterd-volgen: Improve volume op-versions calculation

Volume op-versions calculations now take into account if an option,
 a. enables/disables an xlator, or
 b. is a boolean option.
This prevents op-versions from being updated when a feature is disabled.

Also, correctly close the dynamically loaded xlators in
xlator_volopt_dynload() and prevent leaks.

Change-Id: I895ddeeec6f6a33e509325f0ce6f01b7aad3cf5c
BUG: 954256
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4952
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/dht: Handle linkfile creation with EEXIST error

If linkfile create fails with EEXISTS, then check if the file
is a linkfile for the same file. If not, return the error

Change-Id: Iab42db54422dea69de0049b5196365e65edadd91
BUG: 966858
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/5060
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: Removed misleading log from afr_start_crawl

Problem: If it is fresh volume with no files created the xattrop directory is
         not present. If crawl happens in that time, lookup for xattrop
         directory will fail and it results in  printing a misleading log.

Fix:     Changed misleading log.

Change-Id: Iae5da3e8423564d64096f88abdaf8c98e4935840
BUG: 928575
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4993
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
mgmt/glusterd: Make sure peerinfo->uuid_str is assigned

Change-Id: I9e2743ab61c8baee92a1dfd376ec4bb145776176
BUG: 963524
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/5016
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
socket: Prevent extra logging in socket_rwv

Problem:
If the socket is not even connected socket_rwv fails
and the error log comes every 3 seconds for every
re-connect.

Fix:
Prevent this error log if the socket is not even
connected.

Change-Id: I963f1345c4b6779dd5491948f7f5c4357a507b67
BUG: 963088
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/5008
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Merge branch 'master' of git://github.com/gluster/glusterfs
cluster/dht: Return success in dht_discover if layout issues

We cannot heal in dht_discover, as it is a gfid based lookup, and not
path based. So, returning error here would lead to app's to see failure.

Also, update the layout in inode_ctx even if it has anomalies. Let
subsequent heals fix the issue.

Change-Id: I2358aadacf9a24e20a22ab0a6055c38c5eb6485c
BUG: 960348
Original-author: shishir gowda <sgowda@redhat.com>
Signed-off-by: shishir gowda <sgowda@redhat.com>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4959
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Merge branch 'master' of git://github.com/gluster/glusterfs