6152 Commits

Author SHA1 Message Date
Poornima
8a0f744c46 cluster/afr: handle NULL check before strlen/strcmp in fgetxattr
xattr name can legally be NULL. Handle that case without crashing.

Change-Id: Ie214cb05ccd52565dc247a9234ad83ae799d3866
BUG: 1036879
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6412
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-12-03 15:17:12 -08:00
Kaleb S. KEITHLEY
1731253487 gfapi: add __THROW [(__attribute) ((__nothrow__))] to fn decls for C++ users.
Off hand I don't know of anything written in C++ that is or could be a user
of gfapi.

Never the less, it's possible that one could exist, or be written, and
marking the library entry points is a) friendly, b) possibly allows the
C++ compiler to generate better code, and c) is a good practice when
writing APIs that might be consumed by C++ applications. Considering we
already take the first step and use __BEGIN_DECLS/__END_DECLS to be C++
friendly, we should take the extra step

Change-Id: Ib319ecaa452a46f258a9c6e8c7221454d2fefd0f
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/6393
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-12-03 10:01:59 -08:00
Anand Avati
ed31918c2c protocol/client: handle network disconnect/reconnect properly
if client/server state versions match, we still need to notify
parent xlators of reconnection (CHILD_UP) because they were
notified of CHILD_DOWN at the time of disconnection.

Change-Id: I36c4bde6d8c3db9cb0c48eeb10663b56897c932e
BUG: 1037267
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6396
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2013-12-03 01:50:17 -08:00
Vijay Bellur
cb78328952 cluster/afr: Fix description string for option 'self-heal-daemon'
Change-Id: I267b935a16a6fdc72a4e791f681289e6868baee6
BUG: 1010834
Reviewed-on: http://review.gluster.org/6385
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-12-02 21:48:15 -08:00
Aravinda VK
0e5837a449 cli: xml: Rebalance status(xml) was empty when a glusterd down
When a glusterd is down in cluster rebalance/remove-brick status
--xml will fail to get status and returns null.

This patch skips collecting status if glusterd is down, and
collects status from all the other up nodes.

Change-Id: I6df0feef41b5cc817cc8d7820ee2acac95176a98
BUG: 1036564
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/6391
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-12-02 21:47:47 -08:00
Anand Avati
be380f35a2 cluster/dht: handle NULL check before strlen/strcmp in fgetxattr
@key can legally be NULL. Handle that case without crashing.

Change-Id: Iaae293caa7eeb24afc9cd2580799173e2ce00911
BUG: 1036879
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6395
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-12-02 21:47:07 -08:00
Pranith Kumar K
a36c812756 features/marker: Filter quota xattrs on file as well
Problem:
Quota contributions of a file/directory are tracked by quota
xlator using xattrs on the file. Quota allows these xattrs to be
healed as part of metadata self-heal. This leads to
wrong quota calculations on this brick after self-heal because
quota xattrs don't represent the actual contributions on the
brick anymore.

Fix:
Don't let self-heal of this xattr happen as part of self-heal
by filtering quota xattrs on file in listxattr.

Change-Id: Iea68a116595ba271e58c6fdcc3dd21c7bb55ebb3
BUG: 1035576
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6374
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-12-01 21:23:58 -08:00
Krutika Dhananjay
182bad8bfd cli, glusterd: More quota fixes ...
... which may be grouped under the following categories:

1. Fix incorrect cli exit status for 'quota list' cmd
2. Print appropriate error message on quota parse errors in cli

        Authored by: Anuradha Talur <atalur@redhat.com>

3. glusterd: Improve quota validation during stage-op
4. Fix peer probe issues resulting from quota conf checksum mismatches
5. Enhancements to CLI output in the event of quota command failures

        Authored by: Kaushal Madappa <kmadappa@redhat.com>

7. Move aux mount location from /tmp to /var/run/gluster

        Authored by: Krishnan Parthasarathi <kparthas@redhat.com>

8. Fix performance issues in quota limit-usage

        Authored by: Krutika Dhananjay <kdhananj@redhat.com>

Note: Some functions that were used in earlier version of quota,
      that aren't called anymore have been removed.

Change-Id: I9d874f839ae5fdcfbe6d4f2d727eac091f27ac57
BUG: 969461
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/6366
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-30 10:15:05 -08:00
Kaleb S. KEITHLEY
72f733a64a glusterfsd: fix small memory leaks in glusterfsd-mgmt.c
E.g. In glusterfs_volfile_fetch(), req.xdata.xdata_val is allocated
in dict_allocate_and_serialize() but not freed after mgmt_submit_request().

A survey of dict_allocate_and_serialize/_submit_request in
glusterfsd-mgmt.c shows no consistent pattern of freeing the xdata_val
and also the dict, which is a little disturbing. (Yes, clearly not
every place this occurs needs to be freed the same way.)

Change-Id: Ic306d60b157e97c822a562bfdf21896e40db632a
BUG: 1036102
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/6363
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-30 10:12:42 -08:00
Pranith Kumar K
bca9eab359 mount/fuse: Prevent release_cbk not implemented warning
Change-Id: I53f0cb30f62ee9154670debf92476a51d6156844
BUG: 1035639
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6375
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-28 08:50:23 -08:00
Anuradha
3c55293327 features/index : Creation of indices directory as soon as brick is up.
Missing indices directory in the bricks leads to unwanted log messages.
Therefore, indices directory needs to be created as soon as the brick
comes up.
This patch results in creation of indices/xattrop directory as required.

Also includes a testcase to test the same.

Change-Id: Ic2aedce00c6c1fb24929ca41f6085aed28709d2c
BUG: 1034085
Signed-off-by: Anuradha <atalur@redhat.com>
Reviewed-on: http://review.gluster.org/6343
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-28 08:47:26 -08:00
Krutika Dhananjay
72d3dde33b posix-acl: Fix crash resulting from GF_FREE() done on a CALLOC'd object
The object in question was created in posix_acl_inherit () and
was being GF_FREE'd as part of data_destroy().

Change-Id: Ibdb7c3b5c10ce447f061bde68452502e5170de92
BUG: 1035751
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/6377
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-28 08:46:33 -08:00
Harshavardhana
a25d321bad glusterfs.spec: Add 'python and python-ctypes' dependency
Change-Id: Icde586131bab00476abc44d8dd4e2db7e9d59b2b
BUG: 1033275
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/6339
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 17:48:46 -08:00
Varun Shastry
50a6e9a740 features/quota: Add the quota config xattr to newly added brick
Issue:
Quota directory limit configuration is stored in the xattrs. When a new brick
is added these 'limit-set' xattrs have to be created to the directory in the
new brick. This is done by the dht directory healing when the directory is
created in the new brick. Since 'root' directory is already created DHT doesn't
heal the limit-set xattr root.

Solution:
When the add-brick command is issued run the below hook script to heal the
'limit-set' xattr. The hook script does the following only if limit is
configured on root.
    1. Create an auxiliary mount.
    2. getxattr 'limit-set' on the root
    3. setxattr the same value on the root
But this script needs the volume to be started to make the auxiliary mount.

To handle the case when the add-brick is issued when the volume was stopped,
symlink is created by the 'master' script to the corresponding location and
these two are by default disabled.

So, a 'master' script is added in the add-brick/pre. When add-brick command is
issued, it enables one of the scripts mentioned above based on the condition,
    if volume is started - enable add-brick/post script
    else                 - enable start/post script
After the actual script completes its job, it disables itself.

Note:
The enabling and disabling of the script is based on the glusterd's logic, that
it only runs the scripts which starts its name with 'S'. So,
    Enable     - symlink the file to 'S'*
    Disable    - unlink the symlink.

Change-Id: I2d3947a4d686c54417ec95f530af3bdd3444f4e2
BUG: 969461
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Reviewed-on: http://review.gluster.org/6104
Reviewed-by: Brian Foster <bfoster@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 11:57:11 -08:00
Bala.FA
8690388bc7 cli: use proper copy to set node-name
Previously node-name is set to point to node-uuid which could cause
memory leak.  This is fixed by having memory copy of node-uuid.

BUG: 1012296
Change-Id: I3b638ec289d5b167c6e752ef1ba41f41efacb9da
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: http://review.gluster.org/6330
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 11:55:46 -08:00
Jeff Darcy
7f62ee2432 Fix CFLAGS handling with enable_debug.
The value was getting stomped by the Python stuff (for glupy) after we
had supposedly dealt with enable_debug, so we were getting stray -O2
options that hamper debugging.

Change-Id: Iacd616071c83b92018b597b6144ab565bd5fc66f
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/6362
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 11:09:36 -08:00
Vijaykumar M
21f7ad207b posix: do not allow to set/get "trusted.glusterfs.volume-id" xattr
Change-Id: I2e9a2264b1fd5ebc1ed0aff30225e89acbd0bcb4
BUG: 1034716
Signed-off-by: Vijaykumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/6361
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 11:00:18 -08:00
Pranith Kumar K
2f218e1335 cluster/dht: Handle Link-info getxattr failure in rebalance
When getxattr fails with errno other than ENODATA fail rebalance
on that file. Log the reason for error.

Change-Id: Ia519870b88e6e6dd464d1c0415411aa999f80bc9
BUG: 1032927
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6341
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <sgowda@redhat.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-26 10:37:41 -08:00
Anand Avati
d4c9d342f6 write-behind: handle iobref_merge() error gracefully
.. by UNWINDing ENOMEM error, rather than crashing.

Change-Id: Ica2d6399eaf7e381e7ebc41155620559c139c4d3
BUG: 1034398
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6349
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@gmail.com>
2013-11-26 10:32:00 -08:00
Anand Avati
e3f80f53b5 io-cache: handle iobref_merge() error gracefully
.. by UNWINDing ENOMEM, rather than leaving pointer in vector pointing
to stale memory.

Change-Id: I7f3917ac056fae144f845c9d123233e91e278187
BUG: 1034398
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6351
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@gmail.com>
2013-11-26 10:31:48 -08:00
Anand Avati
2a18e24264 read-ahead: handle iobref_merge() error gracefully
.. by UNWINDing ENOMEM rather than leaving pointers in vector which
points to unref'ed (or even worse, re-used) iobufs.

Change-Id: I849d8cbe5fc02ee992d4e28b7212c49aad4925c7
BUG: 1034398
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6350
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@gmail.com>
2013-11-26 10:31:40 -08:00
Anand Avati
c9579c4501 iobufs: make iobref container size dynamic
With gfapi we can receive read/write size beyond the natural limits
of FUSE and NFS server. iobref was hardcoded to hold iobuf refs up
to 16 in count, which imposes a natural limit of 2MB with 128KB page
sizes of read-ahead and io-cache. Fix this by making iobref's iobuf
ref container size dynamic.

Change-Id: I93d88104d6c5e7af96cc9f1bfcc870d80fa81dad
BUG: 1034398
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6348
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@gmail.com>
2013-11-26 10:31:17 -08:00
Anand Avati
9da4958b78 socket: limit vector count to IOV_MAX
IOV_MAX is the maximum supported vector count on a given platform.
Limit the count to IOV_MAX if higher. As we are performing non-blocking
IO getting a smaller return value is handled naturally.

Change-Id: I94ef67a03ed0e10da67a776af2b55506bf721611
BUG: 1034398
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6354
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@gmail.com>
2013-11-26 10:31:04 -08:00
Anand Avati
9f793d70ba cluster/dht: set layout in inode ctx even if linkfile fails
Creating linkfile could have failed, but we dont care about linkfile
for setting layout in the inode ctx (could be EEXIST etc.)

So ignore @inode in cbk and pick it up from local->loc.inode

Change-Id: I2952799d7ae0d3441b84b2ca2981afd75d7576e2
BUG: 1032859
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6319
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-26 10:30:33 -08:00
Anand Avati
d1879d04e3 core: fix errno for non-existent GFID
When clients refer to a GFID which does not exist, the errno to
be returned in ESTALE (and not ENOENT). Even though ENOENT might
look "proper" most of the time, as the application eventually expects
ENOENT even if a parent directory does not exist, not returning
ESTALE results in resolvers (FUSE and GFAPI) to not retry resolution
in uncached mode. This can result in spurious ENOENTs during
concurrent path modification operations.

Change-Id: I7a06ea6d6a191739f2e9c6e333a1969615e05936
BUG: 1032894
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6318
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@gmail.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-26 10:29:23 -08:00
Raghavendra G
ec8c678c4d features/quota: Add TODO file.
Change-Id: I31990f05ca1814d229026965b7675e3990a65678
BUG: 969461
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6360
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:27:31 -08:00
Raghavendra G
33e0df30cb cluster/dht: instruct marker whenever it shouldn't do accounting
This is needed for two reasons:

* since dht-linkfiles are internal, they shouldn't be accounted.
* hardlink handling in marker is broken. link/unlink of hardlinks
  present in same directory can break marker accounting. Hence, if src
  and dst are in same directory in case of rename, dht - if it breaks
  rename into link/unlink operations - should instruct marker to not to
  do accounting.

Change-Id: I9c9f7384569f75a2792f6450ee7a5279bf751ae7
BUG: 1022995
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6203
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:27:21 -08:00
Raghavendra G
75f66a98da features/marker-quota: exclude dht-linkfiles from being accounted.
Change-Id: I3239f5e8477664dcc04434e4d455ae447493a7ac
BUG: 1022995
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6153
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:27:03 -08:00
Raghavendra G
1a2f51144f core: add dht_is_linkfile helper procedure.
components other than distribute (like marker to exclude linkfiles
from being accounted) also need awareness of what constitutes a
linkfile. Hence its good to separate out this functionality into
core.

Change-Id: Ib944eeacc991bb1de464c9e73ee409fc7a689ff1
BUG: 1022995
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6152
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:26:44 -08:00
Raghavendra G
3f1ebe0298 features/quota: make writes short when the entire write cannot fit into available space.
This patch aims to prevent creation of infinite zero byte sized files
due to amount of storage available before exceeding quota limit
being less than write sizes. Imagine x bytes of storage is available
before we exceed quota limit and quota enforcer is receiving writes of
size y and (y > x). In this scenario, if we run a shell script like:

   # for i in $(seq 1 10); do dd if=/dev/zero of=$i bs=y count=1; done

Then, we would end up with 10 zero byte sized files, because we allow
only complete writes and all writes will fail because of lack of space.
However, creates succeed since a create itself will consume zero
bytes. In this pattern of creates and writes, size of volume would
never grow and x bytes of space will always be available and we can
end up with an infinite number of zero byte sized files.

Change-Id: Ice148d6a2207883e41759f7b0be73abaa3198b41
BUG: 1012216
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6035
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:26:26 -08:00
Raghavendra G
0d5cd92f51 cli/glusterd: Changes to quota command Quota feature
re-work.

Following are the cli commands that are new/re-worked:
======================================================

volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
volume status [all | <VOLNAME> [nfs|shd|<BRICK>|quotad]] [detail|clients|mem|inode|fd|callpool]
volume statedump <VOLNAME> [nfs|quotad] [all|mem|iobuf|callpool|priv|fd|inode|history]

glusterd changes:
=================
* Quota limits are now set as extended attributes by glusterd from
  the aux mount created by the cli.
* The gfids of the directories on which quota limits are set
  for a given volume are stored in
  /var/lib/glusterd/vols/<volname>/quota.conf file in binary format,
  and whose cksum and version is stored in
  /var/lib/glusterd/vols/<volname>/quota.cksum.

Original-author: Krutika Dhananjay <kdhananj@redhat.com>
Original-author: Krishnan Parthasarathi <kparthas@redhat.com>

BUG: 969461
Change-Id: If32bba36c67f9c2a30417af9c6389045b2b7c13b
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6003
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:25:27 -08:00
Raghavendra G
ab3ab1978a features/quota: Improvements to quota
* Two stages of quota enforcement is done:

  Soft and hard quota Upon reaching soft quota limit on the directory
  it logs/alerts in the quota daemon log (ie DEFAULT_LOG_DIR/quotad.log)
  and no more writes allowed after hard
  quota limit. After reaching the soft-limit the daemon alerts the
  user/admin repeatively for every 'alert-time', which is
  configurable.

* Quota enforcer is moved to server-side.

  It  takes care of enforcing quota. Since enforcer doesn't have the
  cluster view, it relies on another service called
  quota-aggregator. Aggregator, on query can return the size of a
  directory based on the cluster view.

  Enforcer is always loaded in the server graph and is by passed if
  the feature is not enabled.

  Options specific to enforcer:

  server-quota - Specifies whether the feature is on/off. It is used
  to by pass the quota if turned off.

  deem-statfs - If set to on, it takes quota limits into consideration
  while estimating fs size. (df command). The algorithm followed is,
  i.   Adjust statvfs based on limit configured on root.
  ii.  If limit is set on the inode passed, use size/limits on that inode to
       populate statvfs. Otherwise, use size/limits configured on root.
  iii. Upon statvfs, update the ctx->size on the inode.
  iv.  Don't let DHT aggregate, instead take the maximum of the usages from the
       subvols of the DHT, since each of it contains the complete information.

  Enforcer also makes use of gfid-to-path conversion functionality to
  work correctly when a client like nfs predominently relies on
  nameless lookups.

* Quota Aggregator acts as a thin client to provide cluster view

  Its a lightweight *gluster client* process with no mount point,
  started upon enabling quota or restarting the volume. This is a
  single process run on each brick, which can answer queries on all
  volumes in the cluster. Its volfile stored in
  GLUSTERD_DEFAULT_WORKING_DIR/quotad/quotad.vol.

Credits:
Raghavendra Bhat        <rabhat@redhat.com>
Varun Shastry           <vshastry@redhat.com>
Shishir Gowda           <sgowda@redhat.com>
Kruthika Dhananjay      <kdhananj@redhat.com>
Brian Foster            <bfoster@redhat.com>
Krishnan Parthasarathi  <kparthas@redhat.com>

Change-Id: Id1cb25b414951da34c665a55f77385d482e0f9de
BUG: 969461
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/5952
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:24:02 -08:00
Raghavendra G
460ce40d3e features/marker: quota friendly changes
* handles renames on dht linkfiles correctly

* nameless lookup friendly changes. uses gfid-to-path conversion
  functionality from storage/posix to build ancestry till root.

* log message cleanup.

* build inode contexts in readdirp

* Accounting still not correct with hardlinks.

Credits:
========
Vijay Bellur <vbellur@redhat.com>
Raghavendra Bhat <rabhat@redhat.com>

Change-Id: I415b6fbbc9691f5a38d9fd3c5d083a61e578bb81
BUG: 969461
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/5953
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:23:02 -08:00
Raghavendra G
d6dc8d0e9e posix: placeholders for GFID to path conversion
what?
=====
    The following is an attempt to generate the paths of a file when
    only its gfid is known.

    To find the path of a directory, the symlink handle to the
    directory maintained in  the ".glusterfs" backend directory is
    read. The symlink handle is generated using the gfid of the
    directory. It (handle) contains the directory's name and parent
    gfid, which are used to recursively construct the absolute path as
    seen by the user from the mount point.

    A similar approach cannot be used for a regular file or a symbolic
    link since its hardlink handle, generated using its gfid, doesn't
    contain its parent gfid and basename. So xattrs are set to store
    the parent gfids and the number of hardlinks to a file or a
    symlink having the same parent gfid.  When an user/application
    requests for the paths of a regular file or a symlink with
    multiple hardlinks, using the parent gfids stored in the xattrs,
    the paths of the parent directories are generated as mentioned
    earlier. The base names of the hardlinks (with the same parent
    gfid) are determined by matching the actual backend inode numbers
    of each entry in the parent directory with that of the hardlink
    handle.

    Xattr is set on a regular file, link, and symbolic link as
    follows, Xattr name : trusted.pgfid.<pargfidstr> Xattr value :
    <number of hardlinks to a regular file/symlink with the same
    parentgfid>

    If a regular file, hard link, symbolic link is created then an
    xattr in the above format is set in the backend.

how to use?
===========
    This functionality can be used through getxattr interface. Two
    keys - glusterfs.ancestry.dentry and glusterfs.ancestry.path - enable
    usage of this functionality. A successful getxattr will have the
    result stored under same keys. Values will be,

    glusterfs.ancestry.dentry:
    --------------------------
    A linked list of gf-dirent structures for all possible paths from
    root to this gfid. If there are multiple paths, the linked-list
    will be a series of paths one after another. Each path will be a
    series of dentries representing all components of the path. This
    key is primarily for internal usage within glusterfs.

    glusterfs.ancestry.path:
    ------------------------
    A string containing all possible paths from root to this gfid.
    Multiple hardlinks of a file or a symlink are displayed as a colon
    seperated list (this could interfere with path components
    containing ':').

    e.g. If there is a file "file1" in root directory with two hardlinks,
         "/dir2/link2tofile1" and "/dir1/link1tofile1", then

         [root@alpha gfsmntpt]# getfattr -n glusterfs.ancestry.path -e text
          file1
          glusterfs.ancestry.path="/file1:/dir2/link2tofile1:/dir1/link1tofile1"

    Thanks Amar, Avati and Venky for the inputs.

Original Author: Ramana Raja <rraja@redhat.com>
BUG: 990028
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Change-Id: I0eaa9101e333e0c1f66ccefd9e95944dd4a27497
Reviewed-on: http://review.gluster.org/5951
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-26 10:22:40 -08:00
Pranith Kumar K
1d554b179f cluster/afr: Provide HA for pathinfo getxattr
Problem:
afr_[f]getxattr_pathinfo_cbks fail the fop even when it succeeded on
one of the bricks. This can happen if the last response to pathinfo
[f]getxattr is a failure.

Fix:
Remember if any of the [f]getxattr_pathinfos are successful and send
that as the op_ret/op_errno value to the xlators above.

Note:
Winding fop to a client xlator that is not connected to server produces
an error log. Preventing that by not even winding fop when client xlator
is DOWN.

Change-Id: I846e8c47423ffcfa2eabffe8924534781a36841a
BUG: 1032927
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6332
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-11-26 00:34:14 -08:00
Santosh Kumar Pradhan
b87d96b97d gNFS: More clean up for Gluster NFS
1) Fix the typo in NFS default ACL
   The typo was introduced as part of the Fix to BZ 1009210 i.e.
   http://review.gluster.org/5980. The user ACL xattr structure
   was passed to default ACL xattr.

2) Clean up NFS code to avoid unnecessary SEGV in
   rpcsvc_drc_reconfigure() which was not validating the
   svc->drc. Add a routine rpcsvc_drc_deinit() to handle
   the clean up of DRC specific data structures. For init(),
   use rpcsvc_drc_init().

3) nfs_init_state() was returning wrong value even if the
   registration with portmapper failed, causing the NFS
   server process to hang around. As a result it used to
   get SEGV during rpcsvc_drc_reconfigure().

4) Clean up memfactor usage across nfs.c nfs3.c.

Change-Id: I5cea26cb68dd8a822ec0ae104952f67fe63fa703
BUG: 1009210
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6329
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-25 05:40:57 -08:00
Raghavendra G
07a3b04d5c tests: add EXPECT_NOT macro
We needed this macro while writing test cases for quota. With quota,
a directory size is only guaranteed to be within some margin of quota
limit, but not an accurate number. With not knowing what size to
expect and EXPECT macro not complete enough to accept ranges of sizes,
we can atleast write test-cases with EXPECT_NOT macro. After copying
data to an empty file, it will be guaranteed the size will not be
zero. This is good enough for quota test cases.

Change-Id: I722ebd68044716a5eeaf0bd7e9aae61df8469017
BUG: 1022995
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/6253
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-24 20:28:38 -08:00
Harshavardhana
6e7817232c group-virt: To minimize 'split-brain' enable quorum under virt profile
Quorum as default is necessary when storing virtual machine images. It
would be necessary to enable both server and client quorum

Currently defaulted values are:
----------------
server-quorum-type=server
quorum-type=auto
----------------

Change-Id: Ic2adb5856ce3c2589476e872e988cae6eeb9b25e
BUG: 1032080
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/6340
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-11-22 22:40:28 -08:00
Anand Avati
fee08b2cbf fuse: revalidate group id cache on uid/gid change detection
- Remember the uid and gid of the pid at the time of caching
  the group id list.

- Next time when referring to the cache confirm that uid and gid
  of that pid has not changed since. If it has, treat it like
  a timeout/cache miss.

- Solves group id caching issue caused when Samba runs on gluster
  FUSE mount and changes the uid/gid on a per syscall basis.

Change-Id: I3382b037ff0b6d5eaaa36d9c898232543475aeda
BUG: 1032438
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6320
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2013-11-21 13:11:18 -08:00
Anand Avati
544dee895a syncops: expose @flags in syncop_rmdir()
Change-Id: I9b73c1db728e4cb3948fc118cceb292b21d48b96
BUG: 1021686
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6112
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-11-21 13:08:32 -08:00
Bala.FA
d13bf457d4 cli: fix possible memory leaks
BUG: 955548
Change-Id: Iae410712e7e6d7a76cd537c77f1919e3b4cdf6bb
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: http://review.gluster.org/6328
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-11-21 13:08:16 -08:00
Vijay Bellur
6157e4198c Add description for git based installations.
Change-Id: I60e445539f255b3220f885bd790f800e4c1ea55a
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/6333
Reviewed-by: Lalatendu Mohanty <lmohanty@redhat.com>
Tested-by: Lalatendu Mohanty <lmohanty@redhat.com>
2013-11-21 12:27:42 -08:00
Brian Foster
689b86cfe6 libglusterfs: use correct check for linux falloc.h availability
We should check for HAVE_LINUX_FALLOC_H rather than HAVE_FALLOC_H
to determine whether to include linux/falloc.h.

Change-Id: I05eca4de2893a88d6b9cc5ebfce738708b9960d4
BUG: 1032378
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/6314
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
2013-11-20 15:42:58 -08:00
Emmanuel Dreyfus
ed75205b1c Build storage/posix xlator if fallocate() does not exists
If fallocate() does not exists, just return EOPNOTSUPP

BUG: 764655
Change-Id: I808114f733c88985519dc47fb7537e1ced1db077
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/6289
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-20 14:47:31 -08:00
M. Mohan Kumar
2bb025699a bd: Add Zerofill FOP support
BUG: 1028673
Change-Id: I9ba8e3e6cf2f888640b4d2a2eb934a27ff903c42
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Reviewed-on: http://review.gluster.org/6290
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-20 14:46:16 -08:00
Anand Avati
5e31894fbd mount/fuse: handle --gid-timeout=0 properly
Fix the bug which was using the timeout value as a flag to indicate
if it was set (and hence would fail when timeout=0 would evaluate
as False)

Change-Id: Ie9a8f28d35603458cdac26c9a4e0343e7eda7344
BUG: 1032438
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6308
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-11-20 14:42:29 -08:00
Santosh Kumar Pradhan
ff7ee1ecd7 gNFS: Coverity fix for CID 1128906
Fix the Coverity issue introduced in RFE: NFS volume set/reset
commit i.e.  http://review.gluster.org/6236

Change-Id: I817b9da03a3ce7f5511303faea0c50dfdad60ff4
BUG: 1027409
Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-on: http://review.gluster.org/6307
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-20 13:41:26 -08:00
Kaushal M
3c38ba1e7b glusterd: Start rebalance only where required
Gluster was starting rebalance processes on peers where it wasn't
required in two cases.
- For a normal rebalance command on a volume, rebalance processes were
  started on all peers instead of just the peers which contain bricks of
  the volume
- For rebalance process being restarted by a volume sync, caused by a
  new peer being probed or a peer restarting, rebalance processes were
  started on all peers, for both a normal rebalance and for remove-brick
  needing rebalance.

This patch adds a new check before starting rebalance process in the
above two cases.
- For rebalance process required by a rebalance command, each peer will
  check if it contains atleast one brick of the volume
- For rebalance process required by a remove-brick command, each peer
  will check if it contains atleast one of the bricks being removed

Change-Id: I512da16994f0d5482889c3a009c46dc20a8a15bb
BUG: 1031887
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/6301
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-20 11:32:09 -08:00
Kaushal M
bc9f0bb5ce cli: List only nodes which have rebalance started in rebalance status
Listing the nodes on which rebalance hasn't been started is just giving
out extraneous information.

Also, refactor the rebalance status printing code into a single function
and use it for both rebalance and remove-brick status.

BUG: 1031887
Change-Id: I47bd561347dfd6ef76c52a1587916d6a71eac369
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/6300
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-11-20 11:30:25 -08:00
Pranith Kumar K
e0dbbe851b mgmt/glusterd: fix undefined sybmol error related to BD
Change-Id: I2210f1ac7de04c6025c0ec02d998b626d41466ae
BUG: 1028672
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6303
Reviewed-by: M. Mohan Kumar <mohan@in.ibm.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-11-19 22:11:29 -08:00