feautre/gfid-access: Fix EINVAL when stat on .gfid

Problem: Some of the inode operations on '.gfid'
virtual directory was resulting in the error
EINVAL from dht after failing to find the layout.

Solution: Inode operations on '.gfid' virtual directory
should not wind further down and should be handled
accordingly in the gfid-access translator itself.

Change-Id: I156cb10ffea0c46b0d747e26f74538d7fb01a1dd
BUG: 1105891
Signed-off-by: Kotresh H R <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/8011
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/8234
Reviewed-by: Niels de Vos <ndevos@redhat.com>
libglusterfs/client_t: cliententries are never expanded

clienttable->cliententries are never expanded once all the available
entries have been used.

Also removed a couple chatty log messages.

Change-Id: I3947fcb948e9ab84d1bb54233e96ea6808620b66
BUG: 1113749
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/8193
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
quotad: Remove dead code

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

client_t is created by server xlator for managing connection related
resources. Quotad doesn't do that. So no need to handle anything related
to it.

BUG: 1113403
Change-Id: I4f457b60c0b3377f8980857a883da1cf3e44d16e
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8227
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
features/gfid-access: Fix inode leaks and loc path corruption

        Backport of http://review.gluster.org/8009
        Backport of http://review.gluster.org/8163

BUG: 1112659
Change-Id: Ic70a3ddfcfef88909c12ca6791a8e20c3fee2eae
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8250
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
features/gfid-access: Fix entry operations

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

Problem:
When more than one aux-mounts are performing rmdir .gfid/<pargfid>/dir
simultaneously, then sometimes a hang is observed.  In gfid-access xlator When
virtual parent/inode are replaced with real parent/inode in loc, virtual
pargfid/gfid are not replaced with real pargfid/gfid respectively. Afr is using
parent_loc->gfids to order the entry locks. But parent_loc->gfid contains
random/virtual gfid generated by gfid-access xlator. Entrylk in client xlator
is using loc->inod->gfid for sending entrylk which has 'real' gfid. Because the
ordering is happening based on random gfids, One mount orders the locks as (L1,
L2) where as the other orders them as (L2, L1) leading to a dead-lock thus
a hang.

Fix:
Replace virtual pargfid/gfid with real pargfid/gfid when virtual-inodes are
replaced with real-inodes in loc.

BUG: 1114501
Change-Id: I13016de1da11762e0697792d76e6e946d991c0a4
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8251
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
rpcsvc: Validate RPC procedure number before fetch

While accessing the procedures of given RPC program in,
rpcsvc_get_program_vector_sizer(), It was not checking boundary
conditions which would cause buffer overflow and subsequently SEGV.

Make sure rpcsvc_actor_t arrays have numactors number of actors.

FIX:
Validate the RPC procedure number before fetching the actor.

Upstream main review: http://review.gluster.org/7726

BUG: 1096020

Change-Id: Iaf207ee976cb56fa9a554ec82c9eab36d3b289ed
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/8228
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
nfs: prevent assertion error with MOUNT over UDP

The MOUNT service over UDP runs in a separate thread. This thread does
not have the correct *THIS xlator set. *THIS points to the global (base)
xlator structure, but GF_CALLOC() requires it to be the NFS-xlator so
that assertions can get validated correctly.

This is solved by passing the NFS-xlator to the pthread function, and
setting the *THIS pointer explicitly in the new thread.

It seems that on occasion (needs further investigation) MOUNT over UDP
does not unregister itself. There can also be issues when the kernel NLM
implementation has been registered at portmap/rpcbind, so adding some
unregister procedures in the cleanup of the test-cases.

Cherry picked from commit ec74ceedaa41047b88d270c00eeb071b73e19664:
> Change-Id: I3be5a420fc800bbcc14198d0b6faf4cf2c7300b1
> BUG: 1116503
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
> Reviewed-on: http://review.gluster.org/8241
> Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: Vijay Bellur <vbellur@redhat.com>

Change-Id: I3be5a420fc800bbcc14198d0b6faf4cf2c7300b1
BUG: 1116997
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/8258
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
protocol/server: '/s/ESTALE/ENOENT' only in lookup path

Problem:
[1] modified the server resolver code to send ENOENT instead of
ESTALE to older clients for all FOPS. This caused dht_mkdir
to fail under certain conditions (see bug description).

Fix:
Since [1] is needed by AFR only in its lookup path, reverted the changes
introduced by [1]  in resolve_entry_simple () an resolve_inode_simple () and
made the change instead in server_lookup_resume().

[1] http://review.gluster.org/#/c/8080

Change-Id: Idb2de25839fe712550486f2263a60c0531530d8f
BUG: 1118574
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/8294
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
client_t: Fix memory leaks

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

- Assign frame->root->client so that gf_client_unref happens
  in server_connection_cleanup_flush_cbk
- Avoid taking extra ref in gf_client_get

TODO:
The whole reason why there are two types of refs
bind, ref-count is to avoid lock inside lock which
is not the case now. I will be sending one more patch
which will accomplish that as well as changing the
tablearray to list

BUG: 1116672
Change-Id: Ica87b9cbf02cae34c10789cfb56d1ccdc393cbf0
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8289
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
build: glusterfs.spec.in, adding nfs-utils package dependency for server package

nfs-utils provides rpc.statd and it is a requirement for gluster-nfs

Master review:    http://review.gluster.org/7966
Master commit-Id: c34850ec71c9d6a4f30ad2e5e96aa15bc8a87064

Change-Id: I054b7d6d8fb1efe0fed9c90077a93c4f559c1ef4
BUG: 1113007
Reported-by: Satheesaran Sundaramoorthi <sasundar@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Vikhyat Umrao <vumrao@redhat.com>
Reviewed-on: http://review.gluster.org/8172
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cluster/afr: Fix leaks in self-heal code path

Change-Id: I5301ec9ebac27afe52e85cad75e6395d7f891355
BUG: 1120151
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8316
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
heal: fix the way we check the presence of AFR in glfsheal

Problem:
glfsh_validate_replicate_volume() used to check if AFR was the parent of
all client xlators present in the graph. This need not always be true, for
example, for user-serviceable-snapshots where the parent of snapd-client is
snapview-client.

Fix:
glfsh_validate_replicate_volume() returns true if atleast one client
xlator has AFR as its parent. Also, AFR need not be its immediate
parent, but be present somewhere in its parent ancestry.

Change-Id: Id37ac88c3202bb2fdcae56e108adc461dc8a9a37
BUG: 1115950
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/8229
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
cli: Fix xml output for volume status

The XML output for volume status was malformed when one of the nodes is
down, leading to outputs like
-------
          <node>
             <node>
               <hostname>NFS Server</hostname>
               <path>localhost</path>
               <peerid>63ca3d2f-8c1f-4b84-b797-b4baddab81fb</peerid>
               <status>1</status>
               <port>2049</port>
               <pid>2130</pid>
             </node>
-----

This was happening because we were starting the <node> element before
determining if node was present, and were not closing it or clearing it
when not finding the node in the dict.

To fix this, the <node> element is only started once a node has been
found in the dict.

Cherry picked from commit 2ba42d07eb967472227eb0a93e4ca2cac7a197b5:
> Change-Id: I6b6205f14b27a69adb95d85db7b48999aa48d400
> BUG: 1046020
> Signed-off-by: Kaushal M <kaushal@redhat.com>
> Reviewed-on: http://review.gluster.org/6571
> Reviewed-by: Aravinda VK <avishwan@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>

Change-Id: I6b6205f14b27a69adb95d85db7b48999aa48d400
BUG: 1117241
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/8334
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
gfapi: In glfs_set_volfile_server() remove the port number check.

The documentation for glfs_set_volfile_server() api says that the
port zero is a valid value. Specifying 0 uses the default port
number GF_DEFAULT_BASE_PORT. Hence removing the check for port being
zero.

Master branch commit 6567d141c1b0112acb35e711371ae5a879fc645a:
> Change-Id: I942a7fe54a418231a438ab67756537df8f28d2de
> BUG: 1084964
> Signed-off-by: Poornima G <pgurusid@redhat.com>
> Reviewed-on: http://review.gluster.org/7409
> Reviewed-by: Raghavendra Talur <rtalur@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>

Change-Id: I942a7fe54a418231a438ab67756537df8f28d2de
BUG: 1124728
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/8374
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Release Notes for GlusterFS 3.5.2

BUG: 1104511
Change-Id: I4b9bb636c1b07fc3552785e3b4ba277fd2301ed5
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/8339
Reviewed-by: Lalatendu Mohanty <lmohanty@redhat.com>
Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com>