geo-rep: Fixing an incorrect memcpy operation.

Currently we are copying a higher size variable to lower size
variable i.e. copying a NAME_MAX  to PATH_MAX sized variable
in "memcpy (sts_val->worker_status, monitor_status, strlen(monitor_status));"

Change-Id: I81dca8e81a4aea5545d5982aed20e05a5e08641c
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Reviewed-on: http://review.gluster.org/6667
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
libgfapi : Fixing some NULL pointer dereferencing issues.

1. Fixing dereferencing null pointer "gio"
2. Checking "frame" before calling STACK_DESTROY (frame->root)

Change-Id: If2ce8804a8e9f3f99f71a8c0d13900afb5635072
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Reviewed-on: http://review.gluster.org/6313
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
MAINTAINERS: Update BD

BUG: 1040351
Change-Id: I2cbbae22e84fe7f8593db22a32ceb87ca97f46da
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Reviewed-on: http://review.gluster.org/6679
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Relocate rebalance sockfile

The defrag sockfile was moved from priv->workdir to
DEFAULT_VAR_RUN_DIRECTORY. The format for the new path of the defrag
sockfile is 'DEFAULT_VAR_RUN_DIRECTORY/gluster-rebalance-<vol-id>.sock'.

This was needed because the earlier location didn't have a fixed length
and could exceed UNIX_PATH_MAX characters. This could lead to the
rebalance process failing to start as the socket file could not be
created.

Also, for keeping backward compatiblity, glusterd_rebalance_rpc_create
will try both the new and old sockfile locations when attempting
reconnection.

Change-Id: I6740ea665de84ebce1ef7199c412f426de54e3d0
BUG: 1049726
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/6616
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Comments for missing break in switchcase of glusterd_op_stage_quota

Change-Id: I3ac5b73b9703a390f1de9cd6a999dfd8ec27d379
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Reviewed-on: http://review.gluster.org/6645
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
mgmt/glusterd: Improve the description in volume set help output

Change-Id: I785648970f53033a69922c23110b5eea9e47feb3
BUG: 1046030
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Reviewed-on: http://review.gluster.org/6573
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
gNFS: Server sets ACL mask wrongly in GETACL reply

FIX:
1. Set the ACL mask what was requested by client
2. Validate the ACL mask in SETACL routine

Change-Id: Icb8576a8fe2684e0beaf94e8db6a92bc70bbfe7f
BUG: 1051865
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6683
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: Unable to self heal symbolic links

Problem:
Under the entry self heal, readlink is done at the
source and sink. When readlink is done at the sink,
because link is not present at the sink, afr expects
ENOENT. AFR translator takes decisions for new link
creation based on ENOENT but server translator is modified
to return ESTALE because of which afr xlator is not able
to heal.

Fix:
The check for inode absence at server includes ESTALE as
well.

Change-Id: I319e4cb4156a243afee79365b7b7a5a7823e9a24
BUG: 1046624
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/6599
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
locks: various fixes

- implement ref/unref of entry locks (and fix bad pointer deref crashes)
- code cleanup and deleted various data types
- fix improper read/write lock conflict detection in entrylk
- fix indefinite hang of blocked locks on disconnect
- register locks in client_t synchronously, fix crashes in disconnect path

Change-Id: Id273690c9111b8052139d1847060d1fb5a711924
BUG: 849630
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6638
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
storage/posix: UNWIND right op_error and op_errno in *setxattr()

1. errno was being set after gf_log() in posix_{f}handle_pair, this
would cause errno to be overwritten.

2. dht would expect -1 for indication of failure in setxattr
callback (dht_err_cbk()). posix_{f}setxattr has been changed to set
op_ret as -1 instead of -op_errno.

3. dict_foreach() has been changed to return an error if the invoked
fn() returns < 0.

Bug report and test case credits to Zorro Lang <zlang@redhat.com>

Change-Id: I96c15f12a5d7717b7584ba392f390a0b4f704a98
BUG: 1051896
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/6684
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
consolidate code for #ifdef HAVE_LINKAT usage

sys_link() now does

ifdef HAVE_LINKAT
        linkat (...)
else
        link (...)
endif

Use sys_link() in all places where we previously had the
conditional behavior.

Change-Id: I8bce5ac1175efd2ba7ab4bb5b372f6d1e0365d28
BUG: 764655
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/6633
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-by: Anand Avati <avati@redhat.com>
socket: propogate connect failure in socket_event_handler

This patch prevents spurious handling of pollin/pollout events on an
'un-connected' socket, when outgoing packets to its remote endpoint are
'dropped' using iptables(8) rules.

For eg,
 iptables -I OUTPUT -p tcp --dport 24007 -j DROP


Change-Id: I1d3f3259dc536adca32330bfb7566e0b9a521e3c
BUG: 1048188
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6627
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
glusterd/geo-rep : Allow volume to stop if geo-rep is not active.

In staging phase of volume stop, code is added to read the state_file
for each slave of the master to which the volume belongs. If any of the
geo-rep session is active with at least one slave, volume is not
allowed to stop else it is allowed.

Change-Id: I4a01a357fc86b872e9635b3d19998cdbd9545114
BUG: 1049727
Signed-off-by: Kotresh H R <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/6663
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cli: Don't override cli mode when stdin in not a tty

Change-Id: I801c6e6ecd6c5a91e487e8e54ec5f684d450a080
BUG: 1047378
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/6687
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
geo-rep: Fixing null pointer dereference of "op_value"

Change-Id: Id39743eaa5a52cc7fd4e2a1378a23384f5ef1fed
BUG: 789278
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Reviewed-on: http://review.gluster.org/6700
Reviewed-by: Avra Sengupta <asengupt@redhat.com>
Tested-by: Avra Sengupta <asengupt@redhat.com>
gNFS: Set default outstanding RPC limit to 16

With 64, NFS server hangs with large I/O load (~ 64 threads writing
to NFS server). The test results from Ben England (Performance expert)
suggest to set it as 16 instead of 64.

Change-Id: I418ff5ba0a3e9fdb14f395b8736438ee1bbd95f4
BUG: 1008301
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6696
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: ben england <bengland@redhat.com>
dht: Ignore directory with missing xattrs, which have err == 0, and start == stop

From the history (Patch: http://review.gluster.org/4668/)

When subvols-per-directory is < available subvols, then there are layouts
which are not populated. This leads to incorrect identification of holes or
overlaps. We need to ignore layouts, which have err == 0, and start == stop.
In the current scenario (start == stop == 0).

Additionally, in layout-merge, treat missing xattrs as err = 0. In case of
missing layouts, anomalies will reset them.

For any other valid subvoles, err != 0 in case of layouts being zeroed out.
Also reverted back dht_selfheal_dir_xattr, which does layout calculation only
on subvols which have errors.

Change-Id: Idb72a869f1a6f103046bb7e6fe0019f6ac853fd4
BUG: 1047331
Signed-off-by: Vijaykumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/6618
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli: Addition of new child elements under brick in volume info xml.

Added new child elements; name and hostUuid under brick in
volume info xml where name and host uuid of the bricks are stored.
This does not break backward compatibility as the old value under
brick is not removed.

Change-Id: Ib9e388889c8dc0c7cd34dcc1871a59003f982f36
Signed-off-by: ndarshan <dnarayan@redhat.com>
Reviewed-on: http://review.gluster.org/6604
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
libgfapi: Fixing possible dereferencing of null pointer "glfd"

Fix: Putting a check so that pointer derefrence does not happen
when "gfld" is null

Change-Id: I281b10be445bbeec3a2728fc139d5ac94372e5b6
BUG: 789278
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Reviewed-on: http://review.gluster.org/6697
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
test: Remove unnecessary code from test.

We have not meddled with mount point to check for it again.

Change-Id: I88eed777b6573a320065b9e14c2031db964e36d0
BUG: 1053362
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/6675
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>