quota: fix recording of last alert log message

        Backport of http://review.gluster.org/6532

PROBLEM:

Alert log messages, corresponding to disk usage crossing soft-limit on a
directory, weren't being logged as often as expected.

CAUSE:

The mechanism in place to log alert messages, once every alert-time
seconds, set the previous logged time incorrectly.

FIX:

Update previous logged time only if we logged an alert message, ie. when
the "time was right" to alert.

BUG: 969461
Change-Id: Ie019c180c97d2b049fa664b14ce087b88e3b578f
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6886
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
quota: get directory size before enforcing quota on rename

        Backport of http://review.gluster.org/6155

BUG: 1023974
Change-Id: Icb4bca8c4a5fa9b14855478e69b1315f2e9a3c3d
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6887
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cli: xml: Rebalance status(xml) was empty when a glusterd down

When a glusterd is down in cluster rebalance/remove-brick status
--xml will fail to get status and returns null.

This patch skips collecting status if glusterd is down, and
collects status from all the other up nodes.

BUG: 1036564
Change-Id: Id8fbb63476e136296231d6652a8bd1a4547edbf5
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/6391
Reviewed-on: http://review.gluster.org/6848
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
gsyncd / geo-rep: "patch" up missing stime

In cases (mostly upgrade) of unavailability of "stime" key and
availability of "xtime" (slave's xtime), introduce "stime" key
on the fly by setting it to the value to "xtime".

Change-Id: Iaa424662d838154c8abc2cf00830c7f9d6be45ac
BUG: 1036539
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/6791
Reviewed-on: http://review.gluster.org/6858
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
gsyncd / geo-rep: ignore DHTs sticky bit file during crawl

Change-Id: I0a6eeee8ae192d086b34d316ee1b82c7d76634da
BUG: 1036539
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/6792
Reviewed-on: http://review.gluster.org/6859
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
gsyncd / geo-rep: invoke changelog process() on non-empty change list

Change-Id: Ida4890abdc90d683a4a83127a1573bbb3829ea23
BUG: 1036539
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/6793
Reviewed-on: http://review.gluster.org/6860
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
gsyncd / geo-rep: cleanup the "tar" process

A missing cleanup for the "tar" process (when tar+ssh
is used as the sync engine).

Change-Id: Ib9599b43e7ec606c70b7c5598793417142be3c0b
BUG: 1036539
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/6794
Reviewed-on: http://review.gluster.org/6861
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
POSIX : gefattr fails and mount point become inaccessible 

Problem : getfattr fails and mount point becomes inaccessible while
fetching glusterfs.ancestry.path key value for a gfid from aux-gfid-mount based mount point.

Analysis : The caller of posix_make_ancestryfromgfid() function i.e.
posix_get_ancestry_non_directory() is sending an incorrect type value as
an argument leading to a crash in posix_make_ancestral_node() (head
dirent pointer is NULL and an attempt to dereference causes seg fault).
For a non directory operation this piece of code should not have been
executed but due to incorrect type value this happened.

Solution : In posix_make_ancestryfromgfid() call type is passed as
logical or of type and POSIX_ANCESTRY_PATH instead of logical or of
POSIX_ANCESTRY_PATH and POSX_ANCESTRY_DENTRY.

Please note this patch is backport picked up from following patch:
http://review.gluster.org/#/c/6892/

Change-Id: Iaf844bea91396c5e2ee295d5a082998fda66f0a9
BUG: 1060104
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/6892
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/6921
libxlator: fix memleak in cluster_markerxtime_cbk and cluster_markeruuid_cbk

Change-Id: Ide3574bf9f661b077f707990d47821feda18b1a3
BUG: 841617
Reviewed-on: http://review.gluster.org/6872
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Reset opinfo.op ONLY if lock succeeded

... and also initialise @this before doing anything else.

Change-Id: I0244a7f61a826b32f4c2dfe51e246f2593a38211
BUG: 1060434
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/6885
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-on: http://review.gluster.org/6922
Reviewed-by: Vijay Bellur <vbellur@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/6924
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
geo-rep: Config file upgrade

When old config file is used with new geo-rep, config item like
'georep_session_working_dir' was missing in old config file.

With this patch geo-rep sets the default value for new items.

Following config options supported:
  - georep_session_working_dir
  - gluster_params
  - ssh_command_tar

BUG: 1036539
Change-Id: If277a14d21f4caee568908b73a2988352c08dcc8
Reviewed-on: http://review.gluster.org/6934
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/6935
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: I53f6984671feecbc2890fed59d8fc7f4545c50a3
Reviewed-on: http://review.gluster.org/6926
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/6927
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
libglusterfs/client_t.c: rhel5/i386 atomic, link failure

RHEL5's gcc-4.1.2 on i386 does not have built-in atomic __sync_*()

Change-Id: I50e3d1e0883afee3fbba44e172fee4b933b28e49
BUG: 1060703
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/6896
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.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()

BUG: 1058797
Change-Id: Id2fbd8394cf6faf669f414775409f20f46009f2b
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/6988
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Use libglusterfs wrapper to make setxattr portable

BUG: 764655
Change-Id: I332922521bef5684f18d5f7b226cb36d5303ae47
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/6982
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/7008
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>