gNFS: Coverity fix for possible memory leak

In nfs_gfid_dict(), if dict_new() fails, the control goes to
out: block and dyngfid resource (dynamically allocated by
GF_CALLOC()) is leaked.

Add a validation for memory returned by GF_CALLOC()

Drop unnecessary "goto" statements

Coverity CID: 1124764

Change-Id: Idda7923cc1c32260b3353f7a9141aa1cf43e4fe1
BUG: 789278
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6852
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
storage/posix: perform chmod after chown.

Problem:
When a replica brick is added to a volume, set-user-ID and set-group-ID
permission bits of files are not set correctly in the new brick. The issue
is in the posix_setattr() call where we do a chmod followed by a chown.

But according to the man pages for chown:
When the owner or group of an executable file are changed by an unprivileged
user the S_ISUID and S_ISGID mode bits are cleared.  POSIX does not specify
whether this also  should  happen  when  root does the chown().

Fix:
Swap the chmod and chown calls in posix_setattr()

Change-Id: I094e47a995c210d2fdbc23ae7a5718286e7a9cf8
BUG: 1058797
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/6862
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
mount.glusterfs: backward compatible option for root-squashing

Change-Id: I74fa6686cff84cfad4a2587a0061e6bb2beea081
BUG: 954057
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/6975
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
gfapi: Set log level to GF_LOG_NONE after closing log file in glfs_fini

Currently any logs that are logged after calling glfs_fini will
appear on stderr. Ideally to the end of the glfs_fini all the
operations will be complete and there should be no further logging.
But it appears that the client translator is still up and prints
some log messages even after calling glfs_fini.

In this patch the log level is set to GF_LOG_NONE once the log file
is closed. This fix is not required if wait for "CHILD_DOWN" event
is implemented in glfs_fini.

Change-Id: Idde80e9a89f3a5264d02b7e6fc2a84d67550b20a
BUG: 1054696
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6726
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
build: CFLAGS was being polluted by python flags

The CFLAGS were being polluted by the python test for glupy. The
test also sets CFLAGS -NDEBUG even when passing --enable-debug to
configure.

To fix it, the patch now saves the necessary python flags into
new makefile flags which can now be used by the glupy Makefile.am.

BUG: 1063541
Change-Id: I8546a64b8ad4fe9318a97fb6a2f0c36087be1b29
Signed-off-by: Luis Pabon <lpabon@redhat.com>
Reviewed-on: http://review.gluster.org/6957
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
cluster/stripe: Fix the resource leaks.

Change-Id: Ieb1fe112686f4932a6272a0117c1373e736d5b4e
BUG: 789278
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6951
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
performance/io-cache: Fix dereferencing of freed pointer

Change-Id: Ic4276c6d76c36f4eb77282dc06d2b8b212b58f08
BUG: 789278
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6822
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
geo-rep: Fix gsyncd restart issue.

New function 'glusterd_gsync_op_already_set' is written which compares
the geo-rep configuration value in gsync.conf with the one sent from
cli. The generic function is written to compare op_value for any
op_name sent from cli as this issue can happen with any configuration
setting other than use-tarssh also. This routine is used to avoid
restart of gsyncd if the configuration value is set to same as in
gsyncd.conf.

Also added error checking when glusterd_gsync_configure fails.
Earlier, eventhough 'glusterd_gsync_configure' fails, error
was not getting catched and success message was shown.

Change-Id: If4dcd0ffc09e6e67c79ba86238f03eff1b7c7645
BUG: 1060797
Signed-off-by: Kotresh H R <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/6897
Reviewed-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: Fix possible leaks on failure code path

Fix the memory leaks in socket and glusterd in failure code
paths reported by Coverity.

CIDs: 1124777, 1124781, 124782

Change-Id: I63472c6b5900f308f19e64fc93bf7ed2f7b06ade
BUG: 789278
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6954
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
xlators/rot-13: Free memory when returning on error.

Added GF_FREE() calls to free allocated memory that was left
behind otherwise.

BUG: 789278
CID: 1124725

Change-Id: I5aa086d6b13a93e14de50e47e02b0e9813af9572
Signed-off-by: Christopher R. Hertel <crh@redhat.com>
Reviewed-on: http://review.gluster.org/6940
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/stripe: Fix the possible resource leaks.

Change-Id: Ic6fbc8c843f80edd7458d15229eb72a5609973a5
BUG: 789278
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6986
Reviewed-by: Amar Tumballi <amarts@gmail.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Rename Glupy module to avoid namespace conflict

BUG: 1018619
Change-Id: I48de598ba5ae8eec0e7e276bbcca1abb0e549cef
Manually merged glupy.py Makefile

Change-Id: I91807222cb78238480ab4cab235e0bf3c3f75d43