Update rfc.sh to release-3.6

Change-Id: I4421b2891309d797d8fb7c14d1eb78e483453660
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/8328
Tested-by: Gluster Build System <jenkins@build.gluster.com>
porting: extattr_remove_fd() doesn't exist

Fix typo extattr_remove_fd() --> extattr_delete_fd()

Change-Id: I0dc3399722eb272d3c04836726e22b212ef15eba
BUG: 1111774
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8335
Tested-by: Gluster Build System <jenkins@build.gluster.com>
porting: include compat-errno.h for errno's

disperse module fails to compile since
ENODATA is non-existent on FreeBSD/Darwin

Use errno conversion in compat-errno.h to avoid
build issues.

Change-Id: I0126224f06365e0b8fac16c205f1294863dc2bc4
BUG: 1111774
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8350
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Disable Erasure Code xlator if MMX is missing

Erasure Code xlator requires MMX instruction set.
Disable building it if MMX is missing.

This is a backport of Id9fe87db33e00c5630c1f3633ebd50fc4ebaec4d

BUG: 764655
Change-Id: I880109e42838b5b35ce68508eeb0f8f005faf6f1
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8381
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
ec: Fixed coverity scan issues

CID list:

  1226163 Logically dead code
  1226166 Missing break in switch
  1226167 Missing break in switch
  1226168 Missing break in switch
  1226169 Missing break in switch
  1226170 Missing break in switch
  1226171 Missing break in switch
  1226172 Missing break in switch
  1226173 Missing break in switch
  1226174 Missing break in switch
  1226175 Missing break in switch
  1226176 Missing break in switch
  1226177 Missing break in switch
  1226178 Data race condition
  1226179 Data race condition
  1226180 Data race condition
  1226181 Thread deadlock
  1226182 Uninitialized pointer read
  1226183 Uninitialized pointer read
  1226184 Read from pointer after free

Change-Id: I4d33aa42289371927175c43bb29e018df64fb943
BUG: 1122834
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8372
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
ec: Add -msse2 option to avoid fedora/rawhide compilation errors

This solves a compilation error on some compiler versions.
To avoid compilation issues on non-Intel architectures, patch
http://review.gluster.org/8381/ has already been merged. It
disables ec on those architectures.

These modifications are temporary patches until a proper
solution for bug #1125166 is ready.

This is a backport of http://review.gluster.org/8395/

Change-Id: I74d0b79e84601cc4f86ad08ce0f8102b99a79a68
BUG: 1125277
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8396
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
fuse: fuse_readlink_cbk() - linkname NULL termination unnecessary

op_ret incremented to compensate for NULL terminating character
leads to self referential loop where OSXFUSE which would reply
on a same READLINK() over and over again

~~~
[2014-07-12 08:41:29.815473]
   T [fuse-bridge.c:1372:fuse_readlink_cbk] 0-glusterfs-fuse:
                                              1: /a/b/1 => ../../1
[2014-07-12 08:41:29.815820]
   T [fuse-bridge.c:1372:fuse_readlink_cbk] 0-glusterfs-fuse:
                                              0: /a/b/1 => ../../1
[2014-07-12 08:41:29.816165]
   T [fuse-bridge.c:1372:fuse_readlink_cbk] 0-glusterfs-fuse:
                                              1: /a/b/1 => ../../1
~~~

It happens due to the problem being (op_ret + 1) > strlen(linkname),
for some odd reason this isn't an issue on Linux where there are odd
safegaurds on these things - Example of following code

~~~
((char *)linkname)[op_ret] = '\0';
send_fuse_data (this, finh, (void *)linkname, op_ret + 2048); <---- Here!
~~~

This behaves normally with no issue, the reasoning i have is that
internally 'readlink()' is verified with strlen() again or perhaps the size
is re-adjusted to the strlen() of `linkname`

This isn't the case on OSX, one needs to make sure that
~~~
strlen(linkname) == op_ret
~~~
Otherwise you would get READLINK() loops as shown above.

This patch fixes the problem.

Many thanks to Anand Avati for helping me out on this.

Change-Id: Ia35818de78a5e4d89bad03ab06e2c5ed6e6753a4
BUG: 1095525
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8336
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/ec: Fix incorrect management of NFS requests

Some operations, specially those comming from NFS, do not use a
regular fd and use an anonymous fd (i.e. a previous open call has
not been sent). Any context information created during open or
create will not be present on these fd's, so we simply return NULL
for contexts of those fd.

Also it seems that NFS can send write requests with a very big
buffer (higher that the default value of 128 KB). Some changes
have been made to correctly handle these large buffers.

This is a backport of http://review.gluster.org/8367.

Change-Id: I281476bd0d2cbaad231822248d6a616fcf5d4003
BUG: 1126734
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8367
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/8416
rdma: glusterfsd SEGV at volume start

glusterfsd NULL ptr deref in proto/server: get_frame_from_request()
with 'transport rdma' volume

no test case, our regression test framework doesn't have Infiniband.
If it did, the test case would be to create a 'transport rdma' volume,
start it, and create/write/read/delete files on the volume.

Change-Id: I8dd4bea08bdecbbdf0115d3badccb1594fa69a27
BUG: 1129710
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/8480
Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
osx: snapview-server fails to build on OSX use 'syscall.h'

Change-Id: Ib9443913abb89c6a04a8723bced4c77128047bd0
BUG: 1130307
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8487
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
porting: OSX/Darwin 10.9 porting issues

xdrproc_t() arguments are variadic and non-variadic

On OSX > 10.9
-------------
typedef bool_t (*xdrproc_t)(XDR *, void *, unsigned int);

On OSX < 10.9
------------
typedef bool_t (*xdrproc_t)(XDR *, ...);

FreeBSD all versions
------------
typedef bool_t (*xdrproc_t)(XDR *, ...);

NetBSD 6.1.4
-----------
typedef bool_t (*xdrproc_t)(XDR *, const void *);

Linux all versions
-----------
typedef bool_t (*xdrproc_t)(XDR *, void *,...);

This weird and odd implementations across various platforms
should be handled properly.

Change-Id: I49fab73cba0d965c78c71da1beba1ffb2d58b8f8
BUG: 1130307
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8488
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
cluster/afr: Fix mem-leak

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

Problem:
local->xattr_req is already reffed with xattr_req that comes
in lookup fop. But when afr_lookup_xattr_req_prepare is called
local->xattr_req is over-written with dict_new() which leads
to ref leak on the dict which came in lookup fop

Fix:
Create local->xattr_req only when it is NULL

BUG: 1128801
Change-Id: I4a1065add7700317e0cd3d0dda0a91e12d77e340
Reviewed-on: http://review.gluster.org/8460
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
NFS: stripe-xlator should pass EOF at end of READDIR

NFS READDIR replies are made of a header, a sequence of
entries, and a EOF flag. When GlusterFS's NFS server is
used along with stripe xlator, it fails to set the EOF
flag, which violates NFS RFC and confuses some clients.

The bug is caused because nfs xlator sets EOF if it gets
op_errno set to ENOENT. That value is produced in storage
xlator and propagated through server, client, and other
xlators until stripe xlator handles it. stripe only passed
op_errno if op_ret < 0, which is not the case here. This
change set adds a special case for that situation to fix
the problem.

Cherry picked from commit 9b5231e5c98b8cfa116838287c7a14042702795f:
> Change-Id: Ie6db94b0515292387cfb04c1e4a9363f34fcd19a
> BUG: 1130969
> Reported-by: Emmanuel Dreyfus <manu@netbsd.org>
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
> Reviewed-on: http://review.gluster.org/8493
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
> Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org>
> Tested-by: Emmanuel Dreyfus <manu@netbsd.org>

Change-Id: Ie6db94b0515292387cfb04c1e4a9363f34fcd19a
BUG: 1132390
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/8508
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
cli: Xml output for geo-replication config command.

This patch adds xml output for geo-replication config
command.
sample:
---------------------------------------------------------------------
<cliOutput>
  <opRet>0</opRet>
  <opErrno>0</opErrno>
  <opErrstr/>
  <geoRep>
    <config>
      <parameter1_name>value</parameter1_name>
      <parameter2_name>value</parameter2_name>
      ...
      ...
      ...
    </config>
  </geoRep>
</cliOutput>
---------------------------------------------------------------------

Change-Id: Iac0451983ae5d0e65b95604eb1c29b968e1ee22f
BUG: 1133464
Signed-off-by: ndarshan <dnarayan@redhat.com>
Reviewed-on: http://review.gluster.org/8270
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Signed-off-by: ndarshan <dnarayan@redhat.com>
Reviewed-on: http://review.gluster.org/8527
Reviewed-by: Sachin Pandit <spandit@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cli: Xml output for geo-replication status command

This patch adds xml output for geo-replication status
and status detail command.
sample:
--------------------------------------------------------------
  <geoRep>
    <volume>
      <name>master</name>
      <sessions>
        <session>
        <session_slave>:2a301d66-b9d2-44b4-b827-d680d67123eb:ssh://XXXXXXXXXX::slave</session_slave>
          <pair>
            <master_node>localhost.localdomain</master_node>
            <master_node_uuid>2a301d66-b9d2-44b4-b827-d680d67123eb</master_node_uuid>
            <master_brick>/root/master_b1</master_brick>
            <slave>ssh://XXXXXXXXXXX::slave</slave>
            <status>faulty</status>
            <checkpoint_status>N/A</checkpoint_status>
            <crawl_status>N/A</crawl_status>
          </pair>
        </session>
      </sessions>
    </volume>
  </geoRep>
-------------------------------------------------------------

Change-Id: Ia19dbe751c3ab1ec7cb8923cdd6c8b99c374072f
BUG: 1133464
Signed-off-by: ndarshan <dnarayan@redhat.com>
Reviewed-on: http://review.gluster.org/8089
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Signed-off-by: ndarshan <dnarayan@redhat.com>
Reviewed-on: http://review.gluster.org/8532
Reviewed-by: Sachin Pandit <spandit@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
build: make GLUSTERD_WORKDIR rely on localstatedir

Backport from master branch - http://review.gluster.org/#/c/8246/

- Break-way from '/var/lib/glusterd' hard-coded previously,
  instead rely on 'configure' value from 'localstatedir'
- Provide 's/lib/db' as default working directory for gluster
  management daemon for BSD and Darwin based installations
- loff_t is really off_t on Darwin
- fix-off the warnings generated by clang on FreeBSD/Darwin
- Now 'tests/*' use GLUSTERD_WORKDIR a common variable for all
  platforms.
- Define proper environment for running tests, define correct PATH
  and LD_LIBRARY_PATH when running tests, so that the desired version
  of glusterfs is used, regardless where it is installed.
  (Thanks to manu@netbsd.org for this additional work)

Change-Id: I06e684ac4c26d1e74c9daf76753403ad15f79276
BUG: 1130308
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8486
Tested-by: Gluster Build System <jenkins@build.gluster.com>
ec: Test volume mount point in a better way

An 'ls -a1' on an empty volume seems to return 3 entries instead
of the expected 2 ('.' and '..') in the build servers. I changed
the test to a simple 'stat', which is enough and more reliable.

This is a backport of http://review.gluster.org/8313.

Change-Id: I12d0f47394ad378b40fc9b86507cdb3543f99970
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8313
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/8417
cluster/afr: Set pending changelog based on filetype for new entries

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

BUG: 1136822
Change-Id: Ia864040306405acf9ebddabf63e87dc2016372dd
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8588
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Search zlib without pkg-config

NetBSD has zlib installed in base system and no .pc file for it. In
order to discover it, fallback to AC_CHECK_LIB is PKG_CHECK_MODULES
fail to find it.

This is a backport of Ide84402aa38edc2709d12e2530401c6b8c722529
and I34ded175f056d1a0898804fe602e3d2d2cba27f5

BUG: 1138897
Change-Id: I14a3ab987cf2bedd3d1d00145466647fb646795b
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8628
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Fix glustershd detection on volume restart

On NetBSD and FreeBSD, doing a 'gluster volume start $volume force' causes
NFS server, quotad, snapd and glustershd to be undetected by glusterd once the
volume has restarted. 'gluster volume status' shows the three processes
as 'N' in the online column, while they have been launched successfully.

This happens because glusterd attempts to connect to its child processes
just between the child does a unlink() on the socket in
__socket_server_bind() and the time it calls bind() and listen().
Different scheduling policy may explain why the problem does not happen
on Linux, but it may pop up some day since we make no guaranteed
assumptions here.

This patchet works this around by introducing a boolean
transport.socket.ignore-enoent option, set by nfs and glustershd,
which prevents ENOENT to be fatal and cause glusterd to retry and
suceed later. Behavior of other clients is unaffected.

This is a backport of  Ifdc4d45b2513743ed42ee235a5c61a086321644c

BUG: 1138897
Change-Id: I04472f045249c99a9492218ceebfab847474db2d
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8630
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>