socket: null out priv->ssl_ssl on disconnect

This prevents problems when a socket transport is reused for a non-SSL
connection (e.g. glusterd portmapper) after having been used for an SSL
connection (e.g. a brick).  In that case, ssl_ssl will still be non-null from
the first connection, even though the structure it points to has actually been
freed.

I'm not sure why/how we would reuse a socket transport in this way (the case of
SSL after non-SSL has been common for a long time) but recent glusterd changes
seem to have had that effect.

Change-Id: I46f1ff3c409c122478bf720a7f02d92abcc32bed
BUG: 902684
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4449
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
tests: skip time consuming mock builds for code-only changes

tests/basic/rpm.t takes a bulk of the time for the regression tests.
Often the building of the rpm is not affected at all and therefor the
tests does not add any value.

With this change the rpmbuild/mock test will only be run when some
changes affect the build system. Changes affecting 'tests/', 'doc/',
'*.py', *.c' and '*.h' do not trigger the test anymore.

Change-Id: Ic188b9e26cde3113b2bdf9cd1fab56d9fd85a4b7
BUG: 904005
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/4429
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
performance/io-cache: propagate errors while unwinding frame in
                      read path.

Change-Id: Ieb5d592a987e8681d5ec019da309f75e3b207580
BUG: 858242
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.org/4204
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
quick-read: various fixes

- initialize xdata in qr_lookup even if it was NULL from top. This
  allows qr to do its job even if lookup originated from fuse-resolve.c

- extend test cases to include 1 second delay and retry

- fix bug while checking condition for cached unwind

  qr_readv_cached() unwinds if op_ret > 0. Therefore qr_readv()
  must wind to subvol only if !(op_ret > 0) (i.e, op_ret <= 0).

- qr_readv_cached() is using uninitialized @conf pointer. Thanks
  to Raghavendra Bhat for catching this!

Change-Id: Ifaf2ea2685e452210ef9ba3c2d1f2ab51900650c
BUG: 846240
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4452
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cluster/afr: Change order of unwind, resume for writev

Generally inode-write fops do transaction.unwind then
transaction.resume, but writev needs to make sure that
delayed post-op frame is placed in fdctx before unwind
happens. This prevents the race of flush doing the
changelog wakeup first in fuse thread and then this
writev placing its delayed post-op frame in fdctx.
This helps flush make sure all the delayed post-ops are
completed.

Change-Id: Ia78ca556f69cab3073c21172bb15f34ff8c3f4be
BUG: 888174
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4428
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: wakeup delayed post op on fsync

Change-Id: I5d84ef72615f9d71b4af210976e2449de6e02326
BUG: 888174
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4446
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Tests: Test functionality of flush/fsync with afr

Change-Id: I307a77e90e1852f5e43d50e347f7b52468105389
BUG: 888174
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4447
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: if a subvolume is down wind the lock request to next

When one of the subvolume is down, then lock request is not attempted
on that subvolume and move on to the next subvolume.

/* skip over children that are down */
                while ((child_index < priv->child_count)
                       && !local->child_up[child_index])
                        child_index++;

In the above case if there are 2 subvolumes and 2nd subvolume is down (subvolume
1 from afr's view), then after attempting lock on 1st child (i.e subvolume 0)
child index is calculated to be 1. But since the 2nd child is down child_index
is incremented to 2 as per the above logic and lock request is STACK_WINDed to
the child with child_index 2. Since there are only 2 children for afr the child
(i.e the xlator_t pointer) for child_index will be NULL. The process crashes
when it dereference the NULL xlator object.

Change-Id: Icd9b5ad28bac1b805e6e80d53c12d296526bedf5
BUG: 765564
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4438
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
glusterfs : Moved option files, and statedumps from /tmp

Change-Id: Ibdede396c4d6859225937316b7a59a661bcaf9f5
BUG: 764890
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4422
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
762989.t: fix a typo by grepping only the blocked port number from netstat o/p

Change-Id: I14c3daa799f0936014bf8aa9fd798ecbaec6e912
BUG: 762989
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4426
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
libglusterfs/syncop: do not hold ref on the fd in cbk

* Do not do fd_ref in cbks of the fops which return a fd (such as
  open, opendir, create).

Change-Id: Ic2f5b234c5c09c258494f4fb5d600a64813823ad
BUG: 885008
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4282
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
fd-lk: implement new method to check for empty fd_lk_ctx_t

to use this in fuse-bridge, to conditionally attempt lock migration
to new graph.

Change-Id: I9b10d5839c4ac6051c75e4c020371391cd886ac8
BUG: 808400
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4455
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
fuse-bridge: fix some breakages from lock migration patch

- do not attempt lock migration if no locks were ever acquired on
  an fd.

- fix fd_lk_ctx_t ref leak during fd migration

- remove spurious fd_unref() (probably added to compensate for
  the fd_ref leak in syncop_open_cbk)

- remove @newfdptr out-param which makes fd ref management really
  tricky (and currently refs were unmanaged for the out-param).
  Instead acquire ref and unref within lock migration function.

Change-Id: I4cc9c451f0df4c051612bd1fa7bef11e801570e4
BUG: 808400
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4453
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
cluster/dht: stack wind with cookie

Default_fops uses stack_wind_tail. It winds without creating the frame leading
into wrong subvol return in the cookie. To avoid the problem caused by the
same, we're getting the subvol by passing the cookie.

Change-Id: I51ee79b22c89e4fb0b89e9a0bc3ac96c5b469f8f
BUG: 893338
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Reviewed-on: http://review.gluster.org/4388
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
protocol/client: Add fdctx back to saved-list after reopen

Change-Id: I01caa1b51570359e6e3ffe1ffb7279cbdb0b0c64
BUG: 821056
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4357
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
protocol/client: Periodically attempt reopens

If the brick is taken down and the hard disk is replaced
and the brick is brought back up, the re-opens of the open-fds
will fail because the file is not present on the brick.
Re-opens are not attempted even if the files are re-created by
self-heal until the brick is brought down after the files are
re-created and brought back up. This is a problem with a VM-store
in a replica-setup.  Until the fd is re-opened the writes will
never happen on the brick where the hard-disk is replaced.
To handle this situation gracefully, client xlator is enhanced
to perform finodelk, fxattrop, writev, readv using anonymous fds
if the file is yet to be re-opened. If the fop succeeds then client
xlator attempts re-open.

Change-Id: I1cc6d1bbf8227cd996868ab2ed0a57fb05e00017
BUG: 821056
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4358
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
tests: Added util functions

Added functions to extract gfid, gfid-str
function to check if a file is open
deleting gfid-link of a file

Change-Id: If2f39f43a6631cddb68b4ba7febcd3cf66f399ee
BUG: 821056
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4386
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
test: test re-opens of open-fds

Change-Id: Ic99c7f3cf1f6a381b0fc1b2ca1acc19f5fe75523
BUG: 821056
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4387
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Tests: Basic pump test case

Change-Id: I94666debd5ec271ce5404a77efc421c12928e134
BUG: 857549
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4451
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Tests: util to check if replace brick completed

Change-Id: I7748395395454765a35e34611d11f58dd4ef3efb
BUG: 857549
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4450
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>