contrib/rbtree license GPL -> LGPL

The latest source of rb.c in the avl-2.0.3 package from GNU/FSF is
now licensed under LGPL, a better license for allowing our partners
to write translators and applications for gluster.

Resubmitting with a BZ. The real question is whether this is okay with
LGPL or whether we should go all the way to a BSD-licensed implementation.

Change-Id: Ifb9c344c84d960832671a2619d37b925e4dede2d
BUG: 807724
Signed-off-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.com/3008
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Merge branch 'master' into hsrepl
glusterfsd: Change a free() to GF_FREE()

Change-Id: I19bad33864b67e7ac79d8c5e642efa19dbc5bd80
BUG: 816163
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3231
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
nlm: use correct subvolume when opening the file

Change-Id: Ia0a482c89f10481184dc8f0f5b27cf6612ac114a
BUG: 816476
Signed-off-by: Krishna Srinivas <ksriniva@redhat.com>
Reviewed-on: http://review.gluster.com/3233
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
cli: Make use of cli_err()

Use cli_err() in case of errors instead of cli_out().

Change-Id: Ib0766e59516a1ccd56a2133f33fac3877c4384d6
BUG: 815194
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3229
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
features/quota: update inode ctx in reconfigure.

Till this patch, quota was relying on lookups after reconfigure, for
new limits to be effective. However, this might be restrictive for
users who don't want to change directories after resetting quota
limits.

Change-Id: I236aa31fdc7dcbc01d40d38c9b5b7b0a28a4d2ea
BUG: 802905
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.com/3022
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Mohammed Junaid <junaid@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
libglusterfs/fd.c: Dynamically scale fd->_ctx when there are no
slots for new keys.

Since while migrating fds to new graph we retain the same fd object,
we might run out of slots for new keys in fd->_ctx after some graph
switches.

Change-Id: I1e3865c76f4703768f9b10b0453558877c2f5448
BUG: 811562
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.com/3201
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
nfs: use hostname without port numbers

Change-Id: I7c4cba84723a9ca73f1d1f1e9a2c479a2bfd14fe
BUG: 798969
Signed-off-by: Krishna Srinivas <ksriniva@redhat.com>
Reviewed-on: http://review.gluster.com/2973
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
storage/posix: Fix leak of dict in getxattr calls.

get_new_dict does not take a ref. Ref was taken only when any data
was added to the dict.
But in the out tag: we call explicit unref, which would move the ref
count to -1, if it was a unsuccessful call. unref destroys the dict
only if ref == 0.

Change-Id: Ie08c301237c2042daf90a7ef25569e3b06e3e1e9
BUG: 816870
Signed-off-by: shishir gowda <shishirng@gluster.com>
Reviewed-on: http://review.gluster.com/3240
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
storage/posix: fix illegal memory access in fgetxattr()

we were not checking for the return value of the fgetxattr(key), and
used to continue with the allocation even if size was -1, leading to
wrong memory access.

Change-Id: Ib5cf2e74fee95bc919b12efe89fed5cd25807efd
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 815346
Reviewed-on: http://review.gluster.com/3236
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterd: Fail replace-brick subcmds on bricks other src/dst.

Change-Id: I5b55d3e353e70a9d4d8b7948853cbfa5b001a447
BUG: 811956
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-on: http://review.gluster.com/3184
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
contrib/rbtree: additional license from Richard Fontana

BUG: 807724
Change-Id: I1e9a7aac7b535687b9e48bdb0e94c7f52dc6aad7
Signed-off-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.com/3252
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libglusterfs/fd: use reallocated memory for intializing new graphs contexts

While setting fd_ctx, if we have to scale the fd contexts, then we get the
xl_count of the new graph and reallocate the memory for contexts so that
it is suffecient for contexts of xlators of both new as well as old graph, and
then initialize the new graph xlator contexts. For that we are considering the
old pointer itself, instead of using newly reallocated pointer.

Change-Id: I32c18cd69c03c771b4a63e5186c65ae658e54e92
BUG: 817461
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/3250
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
get rid of ZR_PATH_MAX

As suggested by Amar Tumballi

Change-Id: Id1cd74fd7530e8c846f3be4a88b1fa301a728cf1
BUG: 764655
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.com/3243
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
mgmt/glusterd: take the statedumps of running bricks if one of the bricks is down

Till now if one of the bricks of the volume is down, then statedump of that
volume (bricks) did not take the statedumps of running bricks.

This patch fixes that issue and cli command will take the statedumps of
running brick processes.

Change-Id: Id9b11905d3d759202e505c2ecfa6ccd5dce6a9ff
BUG: 816884
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/3237
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
rpcsvc: size check before calloc in rpcsvc_handle_disconnect

Change-Id: Ib9e9e28b4fd3d68ebd4b5dcbd0ee4576217b9d4f
BUG: 782761
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.com/3257
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
glustershd: allow changing of log-level through cli

Change-Id: Ie33ad4f4ffcb025b22801d6beb9b87d8325021a0
BUG: 815903
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/3234
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
extras: Added hook script to help in CTDB setup

Change-Id: Ib43cd3583e791aabc8cc25fe4eea43a620f73d01
BUG: 806996
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-on: http://review.gluster.com/3188
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
log cleanup: in setxattr() path

* in posix we log occassionally if errno is ENOTSUP, added a
  suggestion to mount with 'user_xattr' option.

* changed server's *etxattr_cbk to log ENOTSUP in debug level.

* changed client's *etxattr_cbk to log ENOTSUP in debug level.

Change-Id: Icd604050aaa68546011f2c950ecd7883ac6ee820
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 811957
Reviewed-on: http://review.gluster.com/3140
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
libgluster: Fix counting, synctask state errors

When a synctask is executed in synctask_switchto, if by the time
it goes to check the woken/sleep part a reply already comes and
__wake is called, already running task is going to be put in runq
this generates a false warning "re-running already running task".

If the reply does not come before the woken/sleep check, then the
running task is put in waitq which decrements env->runcount even
when the task is not in runq, this leads to -ve runcount everytime
a task goes from runq->switchto->waitq.

This patch fixes both of them by introducing a new state for the
task called SYNCTASK_SUSPEND just when the task is suspended before
yeild in SYNCOP.

Change-Id: Ib82182cf950f9d85b5656f6243541489a104ca3d
BUG: 816551
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3249
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>