client/protocol : Changes in client3_1_getxattr()

Backporting change 1d02db63ae from master.

Copy args->loc to local->loc in client3_1_getxattr(). This prevents logs with
"(null) (--)" in client3_1_getxattr_cbk().
Also save args->name in local->name and print it in the log as well.

Also, fixes crashes caused by above patch in master. (trying to gf_strdup a NULL
args->name)

BUG: 812199
Change-Id: I5419f6a244de93dd1a96ac8e229be3ecdc9f456e
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3350
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Revert "fuse-resolve: consider cases where an entry should be resolved even"

This reverts commit 27fb213be6101bca859502ac87dddc4cd0a6f272.
cluster/afr: Return EIO if read-child < 0 in inode-read fops

BUG: 800884
Change-Id: Ia3382d169e96308eaf48fbd717a72d5266e40677
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3351
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Self-heald: Print the time stamp of the event-history

BUG: 796579
Change-Id: I4c738d9073b53fc3c4d4797b5f01e841dae1b4e9
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3352
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
nfs/nlm: procedures for PC clients

*  This change introduces four NLMv4 procedures:

   NM_LOCK, SHARE, UNSHARE and FREE_ALL.

   These are used by PC clients (windows/dos) to control access
   to files.

   1. NM_LOCK: this lock is not monitored by statd.

   2. SHARE: A share reservation is a lock on the whole file
      that is taken whenever a file is opened on windows clients.
      This has ACCESS (N, R, W, RW) and DENY MODE (N, R, W, RW).
        ACCESS:    mode of access requested by the client;
        DENY MODE: what the requesting client wants to
                   deny other clients.

   3. UNSHARE: remove a share reservation obtained by SHARE.
      Called while closing a file.

   4. FREE_ALL: remove all share reservations and locks,
      both monitored and unmonitored, of the calling client.

*  lock and nm_lock use a common function with only
   a flag conveying whether or not to monitor a lock.

*  NOTES:
   1. SHARE reservations are not STACK_WIND'd to subsequent xlators.
      These are maintained in-memory in the nfs xlator.

   2. Consequently, for SHARE reservations to work effectively,
      all PC clients  *must* mount from the same gNfs server.
      Not doing so will result in different servers maintaining
      separate SHARE reservations which will not be enforced
      for obvious reasons.

Change-Id: Id4f22670a94ed58691a6a7f4c80aa8c11421a277
BUG: 800287
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.com/3356
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
libglusterfs/fd: while dumping the fd_ctx use fd->xl_count

While dumping the fd_ctx when statedump is issued fd->xl_count should be
used to determine the number of xlators instead of using latest graph's count,
since while creating the fd only those many slots would have been allocated
as the number of xlators in the graph at that instant. Then the graph would have
changed, thus the xl count.

All the above things should happen before any operation is done on fd, otherwise
fd_ctx_set will allocate the extra slots for the new xlators present in the
graph.

Also added the program which can be used to reproduce the bug.

Change-Id: I11fe75d71ef5d37e29e2958d53752aa31098c313
BUG: 820887
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/3335
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Reviewed-on: http://review.gluster.com/3369
glusterd: Fixed glusterd_brick_create_path algo.

- check if any prefix of the brick path has "trusted.gfid"
  or "trusted.glusterfs.volume-id" set.
- set trusted.glusterfs.volume-id on the bricks as soon as
  its induction into the volume is settled. Earlier, the setting of
  "volume-id" used to happen during the first run of the brick process,
  leaving of window for bricks part of one volume to be (ab)used by another
  volume inadvertently.
- removed creation of brick directory (if missing), during start volume force.
  This is to avoid directory creation as part 'force'ful starting of volume
  and leave the responsibility with the user, who understands the
  'availability' of the export directory (brick) better.

Change-Id: I4237ec4ea7a4e38a7501027e7de7112edd67de8c
BUG: 812214
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-on: http://review.gluster.com/3280
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Reviewed-on: http://review.gluster.com/3313
nfs/mount: avoid duplicate reply on ENOENT

Change-Id: I310e525b5bd302c0acadcc077213fbd570bf772d
BUG: 820582
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.com/3355
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
cluster/afr: Assign gfid path if path is NULL in lookup

BUG: 820355
Change-Id: I68bea2b8408e741af5fff9e6588ddb87421dbda4
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3374
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
features/quota: get the top xlator from the active graph outside the list

In quota reconfigure we were getting the top of the active graph within the
list which contains the limits set on the volume. Suppose the list is empty,
then the code inside the list traversal loop is not executed, and thus top
will be NULL which might lead to segfault when accessed later.

Change-Id: I1648d69256490878339294537e17300399ddbf2c
BUG: 822827
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/3379
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>