gNFS: Incorrect NFS ACL encoding for XFS

Problem:
Incorrect NFS ACL encoding causes "system.posix_acl_default"
setxattr failure on bricks on XFS file system. XFS (potentially
others?) doesn't understand when the 0x10 prefix is added to the
ACL type field for default ACLs (which the Linux NFS client adds)
which causes setfacl()->setxattr() to fail silently. NFS client
adds NFS_ACL_DEFAULT(0x1000) for default ACL.

FIX:
Mask the prefix (added by NFS client) OFF, so the setfacl is not
rejected when it hits the FS.

Original patch by: "Richard Wareing"

Change-Id: I17ad27d84f030cdea8396eb667ee031f0d41b396
BUG: 1009210
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/5980
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
extras: add script and config for generating "Who wrote GlusterFS"

This script and configuration can be used to generate statistics similar
to the "Who wrote <linux-version>" series available on http://lwn.net.

Example usage for statistics from the initial branchpoint of 3.4 to the
current development of the release-3.4 branch:

 $ extras/who-wrote-glusterfs/who-wrote-glusterfs.sh \
       v3.4.0alpha...origin/release-3.4

By default the statistics will be calculated over the currently checked
out branch.

Change-Id: Ie7b8b655c50dcb14257e42599e2f89642c8b5b42
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/5912
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-by: Anand Avati <avati@redhat.com>
features/changelog : Improvement in changelog "encoding-change".

change in encoding method of changelog was critical section for
"fop dispatch thread", "roll-over thread" and "reconfigure dispatch thread".

In this patch the "encoding-method" is changed by the reconfigure dispatch thread
lazily during handle_change, which solves the concurrency among the racing
threads.

BUG: 1002940
Change-Id: I78c3e8887efa46d0fcc60755cdf4243031cfa3eb
Signed-off-by: Ajeet Jha <ajha@redhat.com>
Reviewed-on: http://review.gluster.org/5844
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
glusterd: Set errstr appropriately on peer op failure

Change-Id: I27f5f7cd54115d7b236b42f6beaaa05a8b379dd7
BUG: 1010153
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/5978
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
glusterd: Fix storing volumes on setting global opts

Glusterd would not store all the volumes when a global options were set.
When setting a global option, like 'nfs.*' options, glusterd used to
modify the volinfo for all the volumes, but would store only the volinfo
for the named volume. This lead to mismatch in the persisted and the
in-memory representation of those volumes, which lead to problems like
peers being rejected because of volume mismatches.

Change-Id: I8bca10585e34b7135cb32af0055dbd462b3fb9b5
BUG: 1012400
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/6007
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: Calculate volume op-versions only on set/reset

The volume op-versions are calculated during a volume set/reset, reading a
volume from disk and importing a volume during probe or volume sync. The
calculation of the volume op-version depends on the clusters op-version as some
features are enabled automatically depending on the clusters op-version. We
also don't store the volume op-versions persistently and don't export the
volume op-versions during sync. Due to this, there can occur cases which will
lead to inconsistencies in volumes in different peers. One such case is below,

Consider, a cluster made up 3 peers P1, P2 and P3, operating at op-version N.
The cluster has two volumes V1 and V2, which have volume op-versions N (since
volume op-version cannot be greater than cluster op-version). We have,
 Cluster-op-version = N
 V1 op-version = N
 V2 op-version = N
A set operation on V1 causes the clusters op-version to be bumped up to N+1.
Assume that there exist some features that are automatically enabled on
op-version N+1. The op-version of V2 remains at N as no operation has been
performed on it. So,
 Cluster op-version = N+1
 V1 op-version = N+1
 V2 op-version = N
Now, we probe a new peer P4. On the new peer we will have the following
op-versions,
 Cluster op-version = N+1
 V1 op-version = N+1
 V2 op-version = N+1
This happens because we don't send volume op-versions during the sync after
probe. P4 will freshly calculate the op-version of V2 (assuming features have
been auto enabled due to the cluster op-version being N+1) as N+1.

Another case is when glusterd on a peer restarts. Assume P3 was restarted,
glusterd will recalculate the volume op-versions during the restore state.
Again, op-version of V2 will be calculated as N+1 assuming auto enabled
features. This will lead to inconsistency in the volume representation in
memory and on disk, as glusterd will assume the volume contains auto enabled
features, but the volfiles don't contain them as they were not regenrated.

These kind of issues can be solved by calculating the volume op-version only
when features are enabled and disabled (ie. during volume set/reset),
persisting the volume-op-versions and exporting/importing them.

Change-Id: I52de0668c92628622e85f4588fb28829a7231132
BUG: 1005043
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5568
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Logging :  Improved the log message on unlock failure in afr_unlock_inodelk_cbk.

"unlock failed on 1 unlock" seems meaningless in the log message. Improved it.

Change-Id: If67d3f9d4aa5310d0b6728a6c89fa58a5cc93d12
BUG: 1012947
Signed-off-by: Anuradha <atalur@redhat.com>
Reviewed-on: http://review.gluster.org/6012
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
libglusterfs: add glusterfs-acl.h to Makefile.am

Without this, glusterfs-acl.h is left out of 'make dist'
and building RPM fails.

Change-Id: I5dc9dc8eecdea4c4c0d06f0b3da23bd2df4e944e
Signed-off-by: Anand Avati <avati@redhat.com>
BUG: 1009210
Reviewed-on: http://review.gluster.org/6015
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
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>
cluster/afr: remove self-healing from lookup()

In AFR lookup() we will only find out which of the copies is good
for reading and save that in the inode ctx.

Change-Id: I33bef58362fb1f0163b7202cf4ad52dc928c3f54
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: move self-heal specific functions to afr-self-heal-common.c

No code change, just re-organize.

Change-Id: Ieddda28c8919a8aac5f5ebfd5d5f6448deea92f6
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: revert (temporarily) fsync based durability fixes

Change-Id: Ifb09d6e69150d335b1c314217738b34d533aaa43
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: remove unused lock recovery code

Lock recovery now happens at protocol/client level. Remove all unused
recovery code in AFR.

Change-Id: Ic1ce01ee17dd1a094b8ca70d5d15319aa1c654f1
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: consistently use xdata sent from up in all transaction fops

This xdata will be loaded with dirty marker and post-op in future patches

Change-Id: Ie21c1b38b20eb0b663d60658c2d24e78d17d90eb
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: keep count of possible consistency changing events

Later, use this to recalculate freshness/staleness per inode.

Change-Id: If2fd882fdd14fcdbec4ee767840264478b67d4ad
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: Implement dirty flag support (in place of pending counts)

Change-Id: I6ccf71a507ad4eece839c80f711096224f0128d2
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: temporarily disable self-heal build

Change-Id: I0cc3e694fb4c711c7e09def24e2f4d5d2b03a5ad
Signed-off-by: Anand Avati <avati@redhat.com>
cluster/afr: eliminate inode ctx

and use read_child + event_generation combination as a long integer.

Also (re)implement all read fops as a transaction to recalculate
read child on every generation bump.

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