protocol/server: Avoid race in add/del locker, connection_cleanup

conn->ltable address keeps changing in
server_connection_cleanup every time it is called.
i.e. New ltable is created every time it is called.
Here is the race that happened:
---------------------------------------------------
thread-1                        | thread-2
add_locker is called with       |
conn->ltable. lets call the     |
ltable address lt1              |
                                | connection cleanup is called
                                | and do_lock_table_cleanup is
                                | triggered for lt1. locker
                                | lists are splice_inited under
                                | the lt1->lock
lt1 adds the locker under       |
lt1->lock (lets call this l1)   |
                                | GF_FREE(lt1) happens in
                                | do_lock_table_cleanup

The locker l1 that is added just before lt1 is freed will never
be cleared in the subsequent server_connection_cleanups as there
does not exist a reference to the locker. The stale lock remains
in the locks xlator even though the transport on which it was
issued is destroyed.

Change-Id: I0a02f16c703d1e7598b083aa1057cda9624eb3fe
BUG: 787601
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2957
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfsd: Handle errors in response send

Change-Id: I2d0a136fdfc4c86fb89cff5565efbf4af80e1edf
BUG: 799265
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2961
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
protocol/server: add and remove the transports from the list, inside the lock

Till now for graph changes, glusterfs client used to remember the old graph
also. Hence the transport object on the server corresponding the old graph
never received disconnect. But now since the graph cleanup is happening,
transport on the server side gets disconnect for the cleaned up graph.

Server maintains, all the transports in a list. But addition of the new
transport to the list, or removal of the transport from the list is not
happening within the lock. Thus if a thread is accessing a transport
(in cases of statedump, where each transprt's information is dumped),
and the server gets a disconnect on that transport, then it leads to
segfault of the process.

To avoid it do the list (of transports) manipulation inside the lock.

Change-Id: I50e8389d5ec8f1c52b8d401ef8c8ddd262e82548
BUG: 803815
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/2958
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpc-lib: memleak fix in rpcsvc_volume_allowed

Change-Id: Iaa6baa4a3e036b2b5c808ea5e79017fffeb80a24
BUG: 801754
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.com/2956
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Enable eager-lock

Eager-lock is disabled by default.
Use cluster.eager-lock on/off to change the config.
write-behind on and eager-lock off is not supported configuration.

In afr, when eager-lock is enabled the inode lock on fd is taken
using the fd address as the lk-owner. So the lock is
interchangableale between the inode-locks on the same fd.

Change-Id: I7eef1ecd510f8028f5395dee882782da53c0de3f
BUG: 802515
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2925
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
protocol/server: memory leak fixes.

Change-Id: I203832d9d52373f068f90e30dc7672329d65bbea
BUG: 803675
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.com/2954
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli/remove-brick: Enhance remove-brick status to display

Rebalance status now contains info from all nodes.

Signed-off-by: shishir gowda <shishirng@gluster.com>
Change-Id: I6208c9879927fb6ddc0713c1480feadcf4f3fd75
BUG: 797887
Reviewed-on: http://review.gluster.com/2949
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Change option brick-with-valgrind to run-with-valgrind

brick-with-valgrind does not make much sense because all the
glusterfs/glusterfsd server processes are run with valgrind.
So changing the option from brick-with-valgrind to
run-with-valgrind.
Also fix misspelt 'valgrnd' for valgrind log file namenames.

Change-Id: I87aad6d65ffc37d8f8679be215709a9174385ecd
BUG: 804293
Signed-off-by: Rahul C S <rahulcs@redhat.com>
Reviewed-on: http://review.gluster.com/2965
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
afr: Copy loc->gfid independent of lookup being fresh or otherwise

This change ensures that entry self-heal following a lookup on that entry
would have loc->gfid 'filled'.

Change-Id: If723c71ca43e1f062dcb99cbe5488342514dace0
BUG: 786087
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-on: http://review.gluster.com/2950
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
mem-pool: more debug friendly logs by using gf_log_callingfn()

Change-Id: I4d6e53ad8660314315f2ff3aa92ffbe707d6efe9
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 803638
Reviewed-on: http://review.gluster.com/2951
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: set_read_child when xactions in progress in fresh lookup

Change-Id: I33e0268635ae7a1f247b0052994e027f990083da
BUG: 800755
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2963
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Self-heald: Handle errors gracefully and show errors to users

Change-Id: I5424ebfadb5b2773ee6f7370cc2867a555aa48dd
BUG: 800352
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2962
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
mount/fuse-bridge: don't pass flags O_CREAT | O_EXCL during open as part of
fd-migration during graph-switch

Change-Id: Ia1494941d3e3d5bebdba3483b0ea7b32c9704b8c
BUG: 802710
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.com/2943
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Updated the Ubuntu upstart jobs for glusterd in extras/Ubuntu.

Using upstart jobs, instead of an initscript, solves Bug 765014.
See also: https://bugs.launchpad.net/ubuntu/+source/glusterfs/+bug/876648

The new upstart jobs split the work of starting glusterd & mounting glusterfs volumes into two parts: a glusterd service runner and a glusterfs volume moung blocker which waits for the service runner.

This is the method preferred by Ubuntu developers to block a mounting event until a required service is available.  These changes will be included in the Ubuntu glusterfs-server package starting with release 12.04, Precise Pangolin.

Tested on Ubuntu 12.04

Change-Id: I9bb4e8cb05a1da0997c23f2ef7fea8737f6a2eb9
BUG: 765014
Signed-off-by: Louis Zuckerman <louiszuckerman@gmail.com>
Reviewed-on: http://review.gluster.com/2727
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: Anand Avati <avati@redhat.com>
mgmt/glusterd : volume set validation fixes

This is the new version of the patch by Kaushik at review.gluster.com/699

The following new option types have been introduced:
 * GF_OPTION_TYPE_INTERNET_ADDRESS_LIST
 * GF_OPTION_TYPE_PRIORITY_LIST
 * GF_OPTION_TYPE_SIZE_LIST
and option types of several options in translators have been updated to use the
new types.

valid_internet_address(), valid_ipv4_address() & valid_ipv6_address() functions
has been updated for * wildcard matching. Previously used standalone wildcard
address checking functions have been removed.

Changes have been done to stripe translator to correctly set, update and use
stripe-blocksize. Also minimum value for block-size has been set to 16KB.

Change-Id: I2aa484ff695f6a915a8fc9a9f965cf0344f41d59
BUG: 765248
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/2899
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <shishirng@gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
protocol/server: send forget on the renamed inode

If rename is given on a file "a" to "b" ("b" is already existing file),
then after rename, the inode for "b" would still be in the inode table
and would not get forget (for fuse client, the fuse kernel module would
send, but on server forget will not come on that inode), thus leading
to inode leak even when the mount point is empty.

To avoid that before doing inode rename, unlink the previous inode that
"b" is pointing to and send forget on that, if "b" is the last dentry
for that inode.

Change-Id: Ie4dcc39ea190ee8f28029b4d7661df576d9cf319
BUG: 799833
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/2874
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
mgmt/glusterd: don't create the brick path in 'volume start'

create the missing brick directory only on a
'gluster volume start <VOLNAME> force' command

Change-Id: Ica4fab9cefe953d73de9a30843d48f94e6ab735c
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 801610
Reviewed-on: http://review.gluster.com/2921
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
protocol/server: Clear internal locks on disconnect

If there is a disconnect observed on the client when the
inode/entry unlock is issued, but the reconnection to server
happens with in the grace-time period the inode/entry lk will
live and the unlock will never come from that client.
The internal locks should be cleared on disconnect.

Change-Id: Ib45b1035cfe3b1de381ef3b331c930011e7403be
BUG: 803209
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2966
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
volgen: by default don't include performance xlators in nfs volfile

Change-Id: I183ff00b0c0d23cec1123c320b7444eec0f71765
BUG: 790333
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: http://review.gluster.com/2883
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishna Srinivas <krishna@gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpc: cancel reconnect timer in rpc_clnt_disable

When the graph is considered no longer needed, rpc_clnt_disable
is called, which disconnects the connection to server but the
reconnect timer is not cancelled in that function, so it is
reconnecting to the server before the grace-time-period.
The locks of the disabled graph are still there on the server
which are leading to hangs.

Change-Id: I8d37f1296370e37117005137a0a430e636da4d2e
BUG: 803209
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2967
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>