libglusterfs: Add monotonic clocking counter for timer thread

gettimeofday() returns the current wall clock time and timezone.
Using these functions in order to measure the passage of time
(how long an operation took) therefore seems like a no-brainer.

This time suffer's from some limitations:

a. They have a low resolution: “High-performance” timing by
definition, requires clock resolutions into the microseconds
or better.

b. They can jump forwards and backwards in time: Computer
clocks all tick at slightly different rates, which causes
the time to drift. Most systems have NTP enabled which
periodically adjusts the system clock to keep them in sync
with “actual” time. The adjustment can cause the clock to
suddenly jump forward (artificially inflating your timing
numbers) or jump backwards (causing your timing calculations
to go negative or hugely positive). In such cases timer
thread could go into an infinite loop.

From 'man gettimeofday':
----------
..
..
The time returned by gettimeofday() is affected by discontinuous
jumps in the system time (e.g., if the system administrator manually
changes the system time).  If you need a monotonically increasing
clock, see clock_gettime(2).
..
..
----------

Rationale:

For calculating interval timing for Timer thread, all that’s
needed should be clock as a simple counter that increments
at a stable rate.

This is necessary to avoid the jumps which are caused by using
"wall time", this counter must be monotonic that can never
“tick” backwards, ever.

Change-Id: I701d31e71a85a73d21a6c5cd15583e7a5a645eeb
BUG: 1017993
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/6070
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
dht: dht_lookup_dir_cbk should set op_errno as local->op_errno

Two glusterfs clients return inconsistent errnos when the bricks of the volume
were down. Consider two gluster mounts. Mount 1 was done when the bricks were
online. Mount 2 was done after the bricks were killed, (using the 'glusterfs'
command instead of the mount script).

For any request, mount 1 will return ENOTCONN, where as mount 2 will return
ENOENT.

This happens because for the 2nd mount, a fuse would send a lookup on '/' for
any request, as it hadn't been done yet. The client xlator returns ENOTCONN,
but the dht_lookup_dir_cbk changed this to ENOENT unconditionally when
aggregating. So, fuse returned ENOENT, even though the errno should have been
ENOTCONN.

Change-Id: I4b7a6d84ce5153045a807fccc01485afe0377117
BUG: 1019095
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/6072
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
storage/posix: Lower log severity for ENODATA errors in getxattr()

Change-Id: I101e329cce4c1305615c63ebcb42355f6c3e85e0
BUG: 918052
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/6084
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libgfapi: Fix to compilation failure/warnings for examples/glfsxmp.c

The comilation of glfsxmp.c i.e. "make glfsxmp" was failing
with "undefined reference to `clock_gettime'" error.

Fixed all compilation warnings for unused variables and
wrong formart specifier in printf e.g. : "format ‘%d’ expects
argument of type ‘int’, but argument 3 has type ‘__syscall_slong_t’
[-Wformat]"

Also added the compilation steps for glfsxmp.c in the
README file

Change-Id: I399ec7c9ad7b6412463c89099d63922caef6749e
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Reviewed-on: http://review.gluster.org/6085
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
afr: check for split-brain before proceeding with fops

Bail out of fops if split brain has been detected during lookup

Change-Id: Id387dbb1a25eec4a121dedceadc6069bdea24b5d
BUG: 1010834
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/5988
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Remove 'max' from the log

This patch avoids giving more info to the user about the
internal heuristic employed in afr, for quota sizes.

Change-Id: Ice3a164399f09b6967500ec0c17dc340e7ae9aba
BUG: 1016683
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6098
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
posix: Fix readv FOP

Suggested by Anand Avati in BD xlator code review.

Change-Id: I31c353a26dfdeb3d0023c3f7e03ed25461d13c16
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
BUG: 837495
Reviewed-on: http://review.gluster.org/6077
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
cli,glusterd: Changes to cli-glusterd communication

Glusterd changes:
With this patch, glusterd creates a socket file in
DATADIR/run/glusterd.socket , and listen on it for cli requests. It
listens for 2 rpc programs on the socket file,
- The glusterd cli rpc program, for all cli commands
- A reduced glusterd handshake program, just for the 'system:: getspec'
  command

The location of the socket file can be changed with the glusterd option
'glusterd-sockfile'.

To retain compatibility with the '--remote-host' cli option, glusterd
also listens for the cli requests on port 24007. But, for the sake of
security, it listens using a reduced cli rpc program on the port. The
reduced rpc program only contains read-only procs used for 'volume
(info|list|status)', 'peer status' and 'system:: getwd' cli commands.

CLI changes:
The gluster cli now uses the glusterd socket file for communicating with
glusterd by default. A new option '--gluster-sock' has been added to
allow specifying the sockfile used to connect. Using the '--remote-host'
option will make cli connect to the given host & port.

Tests changes:
cluster.rc has been modified to make use of socket files and use
different log files for each glusterd.
Some of the tests using cluster.rc have been fixed.

Change-Id: Iaf24bc22f42f8014a5fa300ce37c7fc9b1b92b53
BUG: 980754
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5280
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
gfapi: fix return value of glfs_fini

Change-Id: I5b90c7602334226a978bbdae2f9516e8701b403f
BUG: 1004519
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6092
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfs.spec.in: bad %define _sharedstatedir for rhel5

Change-Id: If2ca7052dfce9fada42180f1d469316fcde5adcb
BUG: 1003184
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/6105
Reviewed-by: Justin Clift <jclift@redhat.com>
Tested-by: Justin Clift <jclift@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
libglusterfs: Return 'ERANGE' for ASCII string to number system

Using 'EOVERFLOW' should be limited to data structure
alignments not Number systems.

Change-Id: I7d337d414e998c0a729c95661df239e36c753a38
BUG: 1017746
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/6101
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpc: add remote peer's hostname to call_bail log msgs

Change-Id: I982cf7619463983c04b401d70a76635991d072d2
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6091
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
mgmt/glusterd: Relax extended attribute checks for volume create and add brick force.

Expectation with force is that user is aware of the consequences of
sanity checks not being triggered.

Change-Id: I79dfeed16a23829a7217cef33ab83f9f0ffae336
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
BUG: 1007509
Reviewed-on: http://review.gluster.org/5746
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
build: disable logging framework on rhel6

As rsyslog-mmcount is not yet available in rhel6 variant, this patch
disables logging framework on rhel6 and its dependency

BUG: 1018308
Change-Id: I6b7c04640f8d38055e00c697d1017c7a530463d0
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: http://review.gluster.org/6108
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
replace-brick: remove code from cli and glusterd

Change-Id: Idc7516285393f55056ce842fe5faa6908654a42d
Signed-off-by: Amar Tumballi <amarts@redhat.com>
syncops: expose @flags in syncop_rmdir()

Signed-off-by: Anand Avati <avati@redhat.com>
recent-revert
cluster/afr: disable client side self-healing in opendir()

The purpose of opendir() self-healing was to recreate files
which go missing after a crash/reboot (because the file was
created just before the crash).

This refactor addresses crash related healing problems in
the self-heal daemon and therefore eliminates the need for
opendir() self-healing in the client side.

Change-Id: I880e2896429b3ebf3669956040c3c14860494152
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: remove remaining traces of readdir-failover

The feature was removed long ago, but there are still traces left.
Remove all traces.

Change-Id: Icbee156b9db2111b7e6c37ab3e9a0a62e1721272
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: disable open fd self-healing on client side

Change-Id: I9cbef8005e7627f9f34d770b50932a0c32f43fab
Signed-off-by: Anand Avati <avati@redhat.com>