glusterd: Log hostname of the peer where there is cksum/version mismatch

Change-Id: I08065aaa3c140d4b02af4ca38f5f4d00d7f0c2bb
BUG: 958739
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/4937
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: delete "volume-name" from dict before processing the next option

Change-Id: Ib78963c1f43a66dab50b443742979c7c4e4cbc23
BUG: 958790
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/4940
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Syncop callbks should take big lock too

Change-Id: I5ae71ab98f9a336dc9bbf0e7b2ec50a6ed42b0f5
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4938
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
posix-acl: fetch ACLs in readdirplus

Not fetching ACLs in readdirplus can potentially result in spurious
wrong ACL decisions (which magically go away on a lookup() which
populates the ACLs)

Change-Id: Ided38b4d868fab482b477ce51b4878289ef9eed0
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4926
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
gfapi: add new API glfs_set_xlator_option()

This is the equivalent of specifying --xlator-option command line
argument to glusterfsd.

Change-Id: I1171dd518a85db4bd456fa0790f450e889a956cd
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4927
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
synctask: implement barriers around yield, not the other way

In the current implementation, barriers are in the core of the
syncprocessors. Wake()s are treated as syncbarrier wake. This
is however delicate, as spurious wake()s of the synctask can
mess up the accounting of the barrier and waking it prematurely.

The fix is to keep yield() and wake() as the basic primitives,
and implement barriers as an object impelemented on top of these
primitives. This way, only an explicit barrier_wake() gets
counted towards the barrier accounting, and spurious wakes
will be truly safe.

Change-Id: I8087f0f446113e5b2d0853431c0354335ccda076
BUG: 948686
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4921
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Revert "glusterd: Fix spurious wakeups in glusterd syncops"

This reverts commit efa154bb0a4cac34d5a9610ec25d38eebe495f22.

-- Following is Avati's analysis (edited) from gerrit --
The claim of the patch (being reverted) is that it in some cases cbkfn
is missed.  This is wrong analysis. cbk_fn is _always_ called. The patch
treats ret > 0 as a "missed cbk". ret > 0 only means socket submission
was not complete, and is queued to submit asynchronously when POLLOUT is
raised.  This is sufficient to guarantee that cbkfn is going to be
called (either the socket errors or submission succeeds and reply
eventually arrives).

This commit also removes spurious barrier_wake(s).

call backs are guaranteed to be called even if the transport is
disconnected. This means, a 'wake' would be called if rpc_clnt_submit is
called.  Also, we count both successful and failed operations in a
particular batch of operations for the synctask_barrier_wait.  So,
calling synctask_barrier_wake on failure of rpc_clnt_submit (say, due to
network failure) would result in a spurious wake.

Change-Id: I7d508c2a54b74a65b82f097742206bc777afc53a
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4922
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpc-lib: fix printf args when printing XID

* Prior to change, XID is sometimes logged with wrong format string
* Incorrect (0x%ux): generates output of "XID: 0x1920499352x"
* Correct (0x%x): generates output of "XID: 0x72787e98"

Change-Id: Id60b673a4356a4815cdb67303612181ac5624fe3
BUG: 960153
Signed-off-by: Michael Brown <michael@netdirect.ca>
Reviewed-on: http://review.gluster.org/4949
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
nfs: avoid double fd unref in opendir

Noticed that the fd_unref was called on the fd regardless of the return
value at nfs3svc_opendir_readdir_cbk(), hence removing an extra unref in
the negative case in nfs_inode_opendir_cbk, which fixes the spurious
fd_unref().

Change-Id: I2bf68410dd86cdf9cfe8a3d43adc27497d8bb36f
BUG: 959190
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.org/4943
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Club missing entry, missing gfid self-heals

Problem:
gfid-self-heal always assigns the gfid(GFID-1) it gets from lookup.
Between the time of lookup to triggering the gfid-self-heal the
entry could have changed. Now lets say there is a case where
one of the files of the replica subolumes already has a gfid
(GFID-2) and the other does not. In that case healing should
happen with GFID-2 instead of GFID-1.

Fix:
Missing-entry-self-heal already handles all these cases. So removed
separate handling of gfid-self-heal.

Change-Id: Ie96261e9036c8f3cb4cad89347f9bf7b681cdc1a
BUG: 767585
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/2670
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
extras: /etc/init.d/glusterd should create a lockfile under /var/lock/sybsys

Without a lockfile under /var/lock/subsys, the glusterd service is not
stopped on shutdown or reboot.

Change-Id: I9dc9b4204c5c39879c22191b2e8a2b81a4f3a58a
BUG: 960476
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/4960
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
nfs3-server: call truncate fop only if necessary

* nfs3svc_setattr_cbk: only truncate if requested size != current size

Change-Id: I3d89e4d2b0710118f90cf5bf9cfdea61d8877491
BUG: 960725
Signed-off-by: Michael Brown <michael@netdirect.ca>
Reviewed-on: http://review.gluster.org/4917
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: Give up big lock before performing any RPC

Change-Id: Ib0a772dc1cb9afc8adccd8f7092f480d2b525ea0
BUG: 960580
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4964
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster/CLI: crash upon executing "peer status" command

Problem:
While doing "gluster peer status", cli_cmd_peer_status_cbk() creates
the frame and passes as arg to gf_cli_list_friends() which sets
frame->local to GF_CLI_LIST_PEERS flag (value: 0x1). It expects
gf_cli_list_friends_cbk() [invoked through cli_cmd_submit()] to
reset frame->local to NULL. But if cli_cmd_submit() fails some
where before gf_cli_list_friends_cbk() gets invoked, then the
flag value remains in frame->local and causes a SEGV while
destroying the stack i.e. [CLI_STACK_DESTROY => cli_local_wipe()].

Fix:
In gf_cli_list_friends(), if cli_cmd_submit() fails, then
reset the value of frame->local to NULL.

Change-Id: Ied19f07eaf67e3bd42c75cdc2ff3729b0789e632
BUG: 961691
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/4976
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
object-storage: final removal of ufo code

See https://git.gluster.org/gluster-swift.git for the new location of
the Gluster-Swift code.

With this patch, no OpenStack Swift related RPMs are constructed.

This patch also removes the unused code that references the
user.ufo-test xattr key in the DHT translator.

Change-Id: I2da32642cbd777737a41c5f9f6d33f059c85a2c1
BUG: 961902 (https://bugzilla.redhat.com/show_bug.cgi?id=961902)
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4970
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glupy: Importing Jeff's glupy project into glusterfs

Change-Id: I3891ef6eaf6ede7c8cbedc3298ce2501a69b2b05
BUG: 961856
Original-author: Jeff Darcy <jdarcy@redhat.com>
Signed-off-by: Ram Raja <rraja@redhat.com>
Reviewed-on: http://review.gluster.org/4906
Reviewed-by: Justin Clift <jclift@redhat.com>
Tested-by: Justin Clift <jclift@redhat.com>
glusterd: Set op-version on startup based on install status

If the current installation of glusterfs doesn't have a stored
op-version and is,
a. a fresh install, then set op-version to maximum
b. an upgrade from release which didn't have op-version support, set it
to minimum.

The install status is detected using the peer-uuid.
If both peer-uuid and op-version are not present in the store, the
installation is fresh.
If peer-uuid is present, but op-version is absent in the store, the
installation has been upgraded from a version which didn't support
op-versions.

By setting the initial op-version as above, we can ensure that
a. features are not enabled accidentally during upgrades
b. a fresh install starts with all possible features enabled.

Change-Id: I52aed9ebeb5d3823c81e65f739a78a924ecf7e12
BUG: 954256
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4867
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
glusterd: Fix uuid to hostname conversion for 'volume status'

Change-Id: I46c41c29c2d11652f6d8ccd5637be0ac9774fc1d
BUG: 927648
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4873
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: remove-brick: prevent removal from a replicate volume.

Prevent the removal of brick(s) from a plain replicate volume and
display the error message at the CLI.

Change-Id: I8e182404564147329d8cd364b7c7931d19f14570
BUG: 961669
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/4975
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
rpcsvc: fix dangerous setting of pointer on free'd structure

The current code is setting @req->hdr_iobuf = NULL _after_ calling
actor_fn() on @req. Calling actor_fn() takes away all guarantees
of whether @req is still a valid object or destroyed.

Unfortunately most of the times the object is allocated from mem-pool
an a mem_put() still keeps the arena allocated (no crash). However
once the mem-pool is full and allocation falls back to malloc()/free()
the code actually becomes dangerous. This resulted in random crashes
when the system load is high (when there were sufficient outstanding
calls that @rpc pool got full)

Change-Id: I4398c717aa0e2c5f06733212b64dd79e7b2a4136
BUG: 884452
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4990
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>