changelog: When connection is unsuccessful, close socket too.

Bug fix for Coverity CID: 1124791

Change-Id: I0362d45123ebc250290f3a5231f7fb113fa41212
BUG: 789278
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/6900
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
gNFS: Possible NULL pointer dereference

In NFS-ACL code (acl3.c) i.e. acl3svc_setacl(), contol can
go to "acl3err" block from setaclargs.mask validation or
acl3_validate_gluster_fh() and acl3_map_fh_to_volume() macros.
But at this point of time "cs" is yet to be init'd (the macro
acl3_handle_call_state_init() is not yet invoked) which can
cause a NULL ptr deref.

FIX:
Refactor the acl3 code.

Coverity ID (CID): 1124491

Change-Id: I3aca38770e03ce59d1705653b6d8349e6cc153b2
BUG: 789278
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6890
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Fix the NULL dereference errors reported by coverity.

Change-Id: I51c120dfe2db44a2b74f35e5cafb4f364ed6e66e
BUG: 789278
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6901
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
quick-read: Remove unref of a freed iobuf.

Change-Id: Ie21414658db571c9a483730b6d5e8997f04255c1
BUG: 789278
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6823
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
features/index: Close directories left open on error.

Two directory streams are opened, but not always closed if the function
exits with an error.  This patch aims to ensure that the directories are
closed in call cases.

Some return values may be explicitly discarded.  This is done to avoid
having a successful call to closedir() overwrite the value of ret.
Also, the errno value is preserved in case a calling function needs to
check errno.

BUG: 789278
CID: 1124710
CID: 1124711

Change-Id: I6bf3b5c9c6a1ec9a99cc9178243ea98572c2bac2
Signed-off-by: Christopher R. Hertel <crh@redhat.com>
Reviewed-on: http://review.gluster.org/6883
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
gverify: Correcting variable names

Change-Id: I851a50e0ebb7554b821fb591375bb6ebd6240ade
BUG: 1036539
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/6939
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Fix a memory leak.

errmsg may have malloc'ed memory, free it before leaving function.

Change-Id: I4ab3b9db7a48a5e256eb8a08b8ab49818ce6ca1b
BUG: 789278
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/6902
Reviewed-by: Poornima G <pgurusid@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
features/quota: fix crash in error handling after building ancestry.

Change-Id: Ifbebf1aa496d49a6c4bb30258b83aaf9792828e5
BUG: 1059833
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6923
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Fix memory leak.

Change-Id: I811d104684905a5a9a794cde8e925bd1a97f6546
BUG: 789278
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6906
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
libgfapi: Don't ignore return value of glfs_loc_touchup()

BUG: 789278
CID: 1124353

Change-Id: I7d2958cbc98faf45d723f17868c515762c50c618
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-on: http://review.gluster.org/6931
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libglusterfs..xlator.c:  Close a library handle.

Simple fix to ensure that a library handle is closed if it is not
actually used.

BUG: 789278
CID: 1124783

Change-Id: Ia3e734c46e1ad8c97cb8cc7f1a5616606bfbc550
Signed-off-by: Christopher R. Hertel <crh@redhat.com>
Reviewed-on: http://review.gluster.org/6933
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
features/marker-quota: more stringent error handling in rename.

If an error occurs and op_errno is not set to non-zero value, we can
end up in loosing a frame resulting in a hung syscall. This patch
adds code setting op_errno appropriately in storage/posix and
makes marker to set err to a default non-zero value in case of
op_errno being zero.

Change-Id: Idc2c3e843b932709a69b32ba67deb284547168f2
BUG: 833586
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.org/5032
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
tests: Increase Expect Within time so that valid patches pass

In some cases it is observed that fix-layout takes more
than 20 seconds to complete, causing test to fail.
Increasing it to a safe value of 30.

Change-Id: I4ac8769e3a1594240ecda96700944ab3702daacc
BUG: 1004744
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/6855
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/dht: If hashed_subvol is NULL, do not fail

Problem: With the current implementation we are allowing unlink
of a file if hashed subvol is down and cached subvol is up.
For the above op to work we should have the info of hashed_subvol.
But incase we do remount of the volume we will have a zeroed layout
for the disconnected subvol(start=0, stop=0, err=ENOTCONN) which will
result  into hashed_subvol being NULL and failing unlink op.

Solution: Dont fail if hashed_subvol is NULL. Check cached subvol
and unlink in cached subvol. The linkto file in the hashed subvol
can be remove later.

Change-Id: Ic1982c15c8942a1adcb47ed0017d2d5ace5c9241
BUG: 983416
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: http://review.gluster.org/6851
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
performance/quick-read: Allocated memory not freed when not used.

If memory is successfully allocated in the call to qr_content_extract(),
but is not used, it is not being freed.  This patch frees the allocated
memory if it is not passed to qr_content_refresh().

BUG: 789278
CID: 1124735

Change-Id: I1c1f03a3b92fa26321ec6ee8822e6fa41da79875
Signed-off-by: Christopher R. Hertel <crh@redhat.com>
Reviewed-on: http://review.gluster.org/6827
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: add volinfo to the list data structure in an order

Currently volinfo is added at the end of the list while creating a volume.
On gluster restart, readdir will not provide the ordered list and the data
is populated in the same order as readdir.

Solution is to insert the volinfo to the list in an order

Change-Id: I1716ac6abbd7dd301a7125425fc413c6833f7a48
BUG: 1039912
Signed-off-by: Vijaykumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/6472
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
quota : changes in quota list command

Changes are made to quota list command such that it also
shows whether hard-limit and soft-limit are exceeded or not.

A test case to check the same is added.

Change-Id: Idb365acfc5d1f2d9f3373dd5f98573d5fe87b50f
BUG: 1038598
Signed-off-by: Anuradha <atalur@redhat.com>
Signed-off-by: Anuradha Talur <atalur@redhat.com>
Reviewed-on: http://review.gluster.org/6441
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
tests: Set hard and soft timeouts to 0 to ensure enforcement.

Change-Id: Ib233d00ea73e4141a404a2abadf9f6f81896c14d
BUG: 1038598
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/6942
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
cluster/afr: goto statements may cause exit before memory is freed.

Memory is allocated for pump_priv and for pump_priv->resume_path, but if
an error is detected the references to that memory go out of scope and
the memory is never freed.

This patch assures that the memory is freed on error.

Patchset 2: These are Kaleb's recommended changes which, compared to my
            original fix, are more comprehensive and provide a more
            complete resolution to the memory leakage bugs in this
            function.  The bug reported by Coverity was limited to a
            single memory allocation.

BUG: 789278
CID: 1124737

Change-Id: Ie239e3b5d28d97308bf948efec6a92f107bc648b
Signed-off-by: Christopher R. Hertel <crh@redhat.com>
Reviewed-on: http://review.gluster.org/6929
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
spec: geo-rep: Include hooks and upgrade scripts

Added hook script S56glusterd-geo-rep-create-post.sh to
%{_sharedstatedir}/glusterd/hooks/1/gsync-create/post/ and upgrade
scripts added to %{_datadir}/glusterfs/scripts/

BUG: 1036539
Change-Id: Id114b827824e55516181ab8f564d419c258be3e2
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/6926
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>