nfs: do not change root inode if enable-ino32 is set

When a user sets nfs.enable-ino32 on,
the root inode, which must be 1, is jumbled during
hashing of the gfid into 32 bits.
This patch avoids doing that, and returns inode of 1
for the root inode.

Change-Id: Ib65f2660998a95e1059be32bc298485c5cbe52df
BUG: 864222
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.org/4154
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: copy peers that participate in volume xaction

- To avoid working with a mutable list of peers in
  the scope of a volume xaction.

Change-Id: I228ae96bccdce127026eff8320adb37b17e2cc6a
BUG: 862834
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4113
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
features/locks: fcntl(3) on F_GETLK must return first conflicting lock

- Added test program, getlk_owner.c to capture the bug when regressed.

Change-Id: Ic2a0f6fa8d094c0f2e9f4a6febd278d4a2948223
BUG: 869724
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4164
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterfsd-mgmt: make brick-ops work in synctask

this way, the main epoll thread is freed up to serve other requests.

Change-Id: Iecf68aceb8bd84433d0f9fcd98d96c734a4cc134
BUG: 842955
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: http://review.gluster.org/4096
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
fuse: handle mountflags properly

The internal mount API had no access to the generic
mountflags used by mount(2).

Thus the "ro" mount option that needs to be passed down to mount(2) as
as a mountflag was incorrectly mangled into the fuse-specific mount
parameter string (cf. http://review.gluster.com/655).

This commit fixes the internal API and the "ro" issue. It also adds a
check for the "rw" and "ro" mount options in tests/basic/mount.t.

Thanks to Csaba Henk (csaba@) for suggestions and proposing an updated
patch.

Change-Id: I7f7bf49ae44d148f5c16f10736a0e412fb8f5e67
BUG: 853895
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/4163
Reviewed-by: Csaba Henk <csaba@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
glusterfsd: log all command line options in log file

this would help support to make sure the glusterfs process
received all the required options, as not all the options set with
'mount -t glusterfs' will be visible with 'mount' command.

also one need not bother checking 'ps ax | grep gluster' for getting
all the details of the command.

Change-Id: Idf635904074bc0892abb6b707ff91149e92a33e3
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 871063
Reviewed-on: http://review.gluster.org/4146
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
fuse-bridge: fix posix-only configuration

Recent changes in fuse-resolver had broken the use case of having
a trivial configuration with only storage/posix translator. Fix
it and include a regression test to avoid breakage in the future.

Change-Id: I85cbcac4b5c2d3517dd03fd3dc6d07610697981b
BUG: 868478
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4114
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
nfs: after resolving the entry use the linked inode instead of old inode

Change-Id: I56add0c3c852d096ec70a0e35610f46c2d12980a
BUG: 877885
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4205
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/dht: dump the layout information of directories only

testcase:
The changes are for removing gf_log from statedump related sections in dht and
using pthread_mutex_trylock in statedump sections. Changes are internal. So
tests were done by attaching gdb to the process and executing by manually
changing the values of some of the pointers.

Change-Id: I41fa76c1812b462cb76f5bbf2fd14de080e73895
BUG: 843822
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4117
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
tests: make _EXPECT handle more cases

First issue is that _EXPECT wasn't handling args with spaces correctly. This
was fixed by enclosing the entire expected-value expression in double quotes
with a simple backslash escape for the end-of-line dollar sign.

Second issue is that we were throwing away potentially useful debug
information. Fixed by using egrep's -q option to suppress output, and
eliminating redirections so that we can see any stderr output related to a
script error.

Change-Id: Ide3f49558dcece55bd90cad50b1ffc572592f11c
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4126
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
debug/error-gen: add the short write pseudo-error

Add a separate enum for pseudo-errors in the debug/error-gen
translator and include a short write error. The short write error
causes writev requests to return with some non-error value less
than the size of the write request.

BUG: 853690
Change-Id: I50b7d328386a8b78d03ce91b4c2ec83e0d32c9aa
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4148
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
storage/posix: Make rchecksum O_DIRECT friendly

Problem:
When posix-aio is enabled to perform aio fd is set with O_DIRECT
whenever possible in read, writev fops. Rchecksum does not take
this into account. If either offset/size/memory-buf passed to
pread in rchecksum fop is not aligned, pread fails with EINVAL.

Fix:
Before doing pread necessary O_DIRECT manipulation is done when
aio is enabled. Memory buffer passed to pread is now page-aligned.

Test:
1) Create replica volume with aio enabled.
2) dd if=/dev/urandom of=a bs=1M count=1
3) kill one of the bricks in the replica pair
4) dd if=/dev/urandom of=a bs=1M count=1
5) bring back the brick. Self-heal succeeds after the change.

The test above checks both rchecksum, writev fops that were
changed in this patch.

Change-Id: I186099a2854d4864c5b48086ab7bc5f1a7b27313
BUG: 866459
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4134
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
posix: Fix volume will not start if brick has no volume-id attribute

Problem:
If the extended attribute (trusted.glusterfs.volume-id) of a brick  is
absent and <gluster volume start volume-name> command is executed then
curretly volume-id from the volume file will be set as an extended attribute of
the brick and volume will get started.
But if setup is such that brick is used as a mount point and before
executing the <gluster volume start volume-name> command, nothing is mounted on
the brick then all the file operations will take place at the brick but actual
intention of the brick is to be used as mount point only.

FIX:
Do not start the volume if extended attribute (trusted.glusterfs.volume-id)
is set absent.

Change-Id: Id2462d87d6087e97e0b8831512fdbc3595f7078b
BUG: 860297
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4202
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Put _check_key_is_zero_filled outside _xattrop_index_action

Change-Id: Ifb89a3a911213b2816a540a104558e7c3c13e23a
BUG: 874498
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4182
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
libglusterfs: implement gf_strndup

Change-Id: Ifb7bf22e8cf4ad1faccf7999c36919693912093f
BUG: 808400
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.org/4135
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: check transaction type for eager-lock after it is set

Problem:
Eager locking lk-owner decision is taken before transaction
type is set. Default transaction type is DATA so all transactions
are treated as DATA transactions at the time of eager-locking
decision.

Fix:
Move the code that takes lk-owner decision after the transaction
type is set.

Test:
Checked that the transaction type is set properly in gdb at
the time of the lk-owner decision.

Change-Id: I7607c7ff4f88c7ced5416a1cddb6586cf45d88f9
BUG: 861335
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4220
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>