extras/hookscripts: Remove %P from smb share path value.

We had added %P in the value for path in smb share definitions to
avoid ctdb errors. However, %P does not work well for windows
clients and they fail to access the share.

Solution for the original problem:
The error messages were being generated by a monitoring script that ctdb
runs. The script reads the path value from testparm and tests if it exists
in the local machine. This particular check does not hold valid for
virtual file system backends like gluster. There is no harm in asking
ctdb to not to check the existence of such backend and can be done by
setting the following config in ctdb.conf:

CTDB_SAMBA_SKIP_SHARE_CHECK=YES.

Change-Id: I91627c8a279126a5cc24c6347847f9bfbad53dd5
BUG: 1068776
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/7598
Reviewed-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-by: Poornima G <pgurusid@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
glusterd/snapshot: Restore cleanup

If restores fails for some reason then we should revert
the restore operation. To do so we take the backup of
vols folder before doing a restore and if the restore
fails then we revert the changes done.

Change-Id: I97f72aec3a34fc122bf137beb336e94db3a04dff
BUG: 1061685
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-on: http://review.gluster.org/7548
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cli/hooks : Add volume set options to enable/disable nfs-ganesha support.

1. gluster volume set nfs-ganesha.enable ON/OFF
If the option is set to ON, the volume field in the nfs-ganesha configuartion file is
edited. Gluster-nfs is disabled on that volume and the volume is exported using
nfs-ganesha.

2.gluster volume set nfs-ganesha.host IP
This is used to provide the IP of the nfs-ganesha host.

Note : nfs-ganesha.host MUST be set before using nfs-ganesha.enable ON

The switch from gluster-nfs to nfs-ganesha is mostly done by the hook-scripts
in the post phase of the 'set' option. As a result, gluster volume reset does not
function as it is expected to. By default, nfs-ganesha will be set to off but the
process  will not be killed.

Hence, a few changes have to be made post 'reset' option as well. Those changes
also have been added.

Change-Id: I7fdc14ee49d1724af96eda33c6a3ec08b1020788
BUG: 1092283
Signed-off-by: Meghana <mmadhusu@redhat.com>
Reviewed-on: http://review.gluster.org/7321
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
barrier : barrier O_SYNC write incorrect flag check

barrier_writev function was doing the following check to determine whether its a
O_SYNC write or not:
        if (!(flags & O_SYNC))
The problem here is this flag is not fd's flag and gfapi write does not copy
open call fd's flag into write flag because of which O_SYNC writes were not
getting barriered even if barrier was enabled.

The check has been modified as:
        if (!(fd->flags & (O_SYNC | O_DSYNC)))

Change-Id: I07b23852d150b81c7317100ca6d22d082ad897cd
BUG: 1090488
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/7549
Reviewed-by: Varun Shastry <vshastry@redhat.com>
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
barrier : fsync call over NFS should be barriered when barrier is enabled

barrier_fsync was not getting hit when fsync call is issued from the
application over NFS mount.
Investigation reveals that NFS doesn't send an explicit fsync call to the
glusterfs server, however NFS converts it with a stable write with O_DSYNC
flag, so for a fsync call over NFS mount point, barrier feature always
needs to check for writev and its correspoding flags. So to meet all the
coditions of write with O_SYNC and fsync getting blocked when barrier is
enabled the check has been modified with following:

      if (!((flags | fd->flags) & (O_SYNC | O_DSYNC)))

Point to be noted here is we need to check both fd's flag and the explicit
flag  as for NFS write fd->flags is 0.

Bug ID : 1091902
Change-Id: Ifd5377fca2cc93bb72158dd525b2aab8b4164ca8
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/7633
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
mgmt/glusterd: handle postvalidate carefully when prevalidate fails

* Also changed the order of peers retrieval and snapshot retrieval
  upon glusterd start, so that the snapshot bricks can be properly
  resolved while cleaning up the snapshots.

Change-Id: I120704e4412a9cadb8d90a9b7969f2b4a1196bc5
BUG: 1061685
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/7494
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd : Volname, brickpath & volfpath length validation

While creating a volume and adding a brick validation for _POSIX_PATH_MAX is
done on absolute pathname instead of relative pathname due to which a brickpath
having less than _POSIX_PATH_MAX may also fail the validation if the directory
length is greater than (_POSIX_PATH_MAX -strlen(brickpath/volume name).

Also this fix addresses one cli response message correction which says the
volume file is too long instead of brick path is too long (when brickpath
length validation doesn't fail and vol file length validation fails.)

It is also important to note that with the current design of volfile naming, it
can not be guranteed that volname and brickpath can have max of _POSIX_PATH_MAX
characters.

Change-Id: I1283d1f9dea96ae797620002c8723719f26a866d
BUG: 1085330
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/7420
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
protocol/server: Validate outstanding-rpc-limit

server.outstanding-rpc-limit by passes validation enforcement of gluster
as protocol/server ignores any keys starting with rpc (rpc* wildcard).
Which also causes a side effect, i.e. help text gets displayed as NULL.

Change-Id: I925e028529d671e1e29a0c7ff7e625fdb49a1be4
BUG: 1091364
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/7562
Reviewed-by: Poornima G <pgurusid@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: Allow symlink parent for snap_mount_folder

If '/var' is a symlink which is on OSX, 'glusterd'
initialization fails which is not necessary fix it.

Change-Id: I83adc16cfc0e0deaa18acf74ba99299ba4a21d60
BUG: 1061685
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/7558
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd/snapshot: umount2 on OSX/NetBSD is unmount

Change-Id: I8de4d47bb2a54b915243ea029cce2585fba34876
BUG: 1089172
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/7651
Reviewed-by: Justin Clift <justin@gluster.org>
Tested-by: Justin Clift <justin@gluster.org>
Reviewed-by: Anand Avati <avati@redhat.com>
changelog: in C99 `inline` shouldn't be part of function definition

- C99 standard dictates that `inline` should be used only to hint
  function implementation not as a definition
          - http://clang.llvm.org/compatibility.html#inline
  This also leads to run time issues as 'undefined symbols'

- Remember to use adding explicit headers when using an external
  function

Change-Id: I66a9030da7ac38ded6e0b6a977182be977382fa2
BUG: 1089172
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/7655
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>