glusterfs_ctx_t: un-globalize the filesystem context

So far there has been a global glusterfs_ctx_t object which
represents the running instance of the filesystem (client or server).
It contains the various graphs, connection to the management daemon
over which new graphs are obtained, calls stacks issued on this
filesystem, and a bunch of such things.

With the introduction of libgfapi, it is no more true that there will
be only one filesystem context in a process. Applications can
be written to use libgfapi and obtain serveral instances of different
filesystems/volumes in the same process.

This involves messy untangling of assumptions inside libglusterfs that
there would only be one global glusterfs_ctx_t and offload that
assumption to glusterfsd/ and cli/ (where it is true).

Change-Id: Ifd7d1259428c26076140a5764a2dc7361694139c
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3678
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
stripe: filter coalesce key in getxattr()/listxattr()

as 'stripe-coalesce' is an internal key, no need to show it on top
of the mount-point.

Change-Id: Iab836e73d59c42774db8a2eee13fe3b0cd994bc9
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 801887
Reviewed-on: http://review.gluster.com/3680
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <sgowda@redhat.com>
geo-rep / gsyncd: rsync option cleanups, fixes

- add two tunables for rsync: "rsync-options" and "rsync-ssh-options"
- always pass "--no-implied-dirs" to rsync

Change-Id: I3d67a4cba8cabd681edac80e6b1fb8ea322008bd
BUG: 841062
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3682
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
mount/fuse: check for fuse inval notify support when fopen-keep-cache enabled

The fopen-keep-cache feature relies on the fuse notification system
to operate correctly. As Csaba has pointed out, the inode invalidation
functionality was added in FUSE version 7.12. Require that the user
have 7.12 or later to enable fopen-keep-cache. If not supported, warn
the user and disable the feature.

BUG: 833564
Change-Id: Ib9eecb56b689d8edff118b34e2dcc7dba6539b04
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.com/3690
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libglusterfs: remove debug log messages from gidcache

The debug log messages for every cache lookup/add pollute the debug
output.

BUG: 800892
Change-Id: I6b75fd5b7005b8c007106347de8827a0d6c2fd03
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.com/3692
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
gfapi: API/library for accessing gluster volumes

Change-Id: Ie4cbcf91b58218bebf23cf951c313aceeb29f311
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3664
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Bharata B Rao <bharata.rao@gmail.com>
glusterfs-api.pc: pkgconfig for API consumers

Change-Id: I08c60ff9ec5d336077c39f903720f8850d4ddc72
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3665
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
glfsxmp: libgfapi based example

This is an example application which uses libgfapi. It is
a complete autotools based build system which demonstrates the
required changes in configure.ac, Makefile.am etc to successfuly
detect for and build an application against libgfapi.

There are two approaches to building a libgfapi based application:

1. In the presence of pkg-config in your build system.
This is the recommended approach which is also used in this example.
For this approach to work, you need to build glusterfs by passing
--pkgconfigdir=/usr/lib64/pkgconfig (or the appropriate directory)
in your distro. This already happens if you build RPMs with the
glusterfs.spec provided in glusterfs.git. You will also need to
install glusterfs-api RPM.

2. In the absence of pkg-config in your build system.
Make sure your LDFLAGS includes -L/path/to/lib where libgfapi.so is
installed and -I/path/to/include/glusterfs where the 'api' directory

Change-Id: Ic4eab2df002d7e8d20593a03e643859423048848
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3666
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Example of using libglfs from Python.

Change-Id: I081582c457428d55db8ec1ed6d90f1e439f51f0d
BUG: 839950
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.com/3675
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfs-api.pc: include pkgconfig file in -devel RPM

Previous patch missed out including the .pc file in the -devel
RPM while purging the -api.rpm.

Change-Id: I895feefc62e88a962a829612aa829401fed081f8
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3693
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cluster/distribute: cli support for setting directory-layout-spread

gluster volume set <volname> subvols-per-directory

Change-Id: I5f1420eeb2268897d9b4c70edb933ed1f07649d1
BUG: 838006
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.com/3634
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
FUSE: ignore setxattr for some keys from gsyncd aux mount

Context
-------
gsyncd/geo-rep plans to rely on Rsync to sync extended attributes.
When this is in place, all xattrs *visible* on the mount point would
be candidate for syncing. This set could include gluster internal
xattrs too (as xome xlators do not filter out in their cbks). Syncing
these xattrs to the slave could result in unexpected functioning of
the slave mount.

Soln.
-----
For gsyncd auxillary mounts (identified by client_pid -1), we only
allow xtime related xattrs to go through and silently ignore (w/o
propagating error back to the client) the rest of them. This provides
a future proof solution as we need not worry about what xattrs show
up on the mounts. Also, 'user' namespace xattrs are always passed
through even if it's from a gsyncd aux mount.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
Change-Id: I6fac5e03d2b25fa4cdece4b2897fb202617b3c23
BUG: 841062
Reviewed-on: http://review.gluster.com/3687
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: atomic store update.

All 'updates' to store are done in their respective tmp files and a rename to
their original copies is done in one pass. Failure to write or rename
successfully, promptly reduces the store's revision no., giving us an
opportunity to 'correct' it via peer 'detach-attach' operations, if need
be.

Change-Id: I44a33c41cb4d3d1cfbb455bc1f2f074d4f17dade
BUG: 765434
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-on: http://review.gluster.com/654
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
fuse-bridge: expose negative entry caching of FUSE

Fuse kernel module supports caching negative entries, enabled
by specifying a timeout while returning ENOENT to lookup. This
patch enables the functionality to be enabled with the command
line.

Also fixed a typo bug in mount.glusterfs.in.

Change-Id: I47eab2834cca9a05887266358afbf504bbb4c489
BUG: 841417
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3696
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
libglusterfs/options: enable validator macros for type 'double'

Values like 'entry-timeout' and 'attribute-timeout' in FUSE are of
C type double. Enable support in the options framework for using
this type.

Change-Id: If1a619595a5925937e88540710860df27347acd0
BUG: 841417
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3697
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
fuse-bridge: utilize the option handle framework for double

Also make other option initialization code use GF_OPTION_INIT
framework for setting options and default values.

Change-Id: I68a5c7b674f487fef9d23195654d3a5b2f7b8811
BUG: 841417
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3698
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
glusterd: Refactored brickinfo APIs

This patch modifies the existing brickinfo function signatures
and/or names to do one thing right and call them by 'appropriate' names.

- Decoupled brickinfo_get and is_brickpath_available
- Removed dead comment about realpath(3) in canonicalize_path
- Renamed glusterd_brickinfo_from_brick to glusterd_brickinfo_new_from_brick
  to make the name of the function reflect that an allocation is happening

Change-Id: I29daba6d431ca799d43c927b9dfbaeda327e83e8
BUG: 764890
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.com/3668
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
geo-rep / gsyncd: add support for sending xtimes through rsync

Note that in said mode metadata synchronization is best effort:
rsync syncs metadata at last so if rsync is interrupted in between
xattr sync and metadata sync stages, then file will be considered
in sync

Change-Id: I1c75eab33b0a1000abf3ad36b2d484a89eeda1bd
BUG: 841062
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3683
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
geo-rep / gsyncd: convert ignore-deletes to a mixin too

Change-Id: I164a1d1dd5f15569afd6806834119a6844949df0
BUG: 841062
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3684
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
gsyncd / geo-rep: Fix typo in 'purge' flow

Change-Id: I6c329b895178545d16b0cb9f01ad116f5342f752
BUG: 841855
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.com/3706
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>