761 Commits

Author SHA1 Message Date
Venkatesh Somyajulu
77e6caa440 libglusterfs: Fix circular buffer to dump entries if count is less than 1024
Problem:
To dump the values present in the circular buffer, index always
moves from current index to used_len. But if circular buffer is not
completely filled even once then next index to be filled  and used length
value are always same which means it will never dump any value.

Fix: Modified the logic of buffer traversing to dump values so that  it
will still maintain FIFO and cover both the cases where buffer is either
partially filled or being used more than once.

Change-Id: If73a5e481cca1751d57aba1136c2d25d23ce073c
BUG: 972459
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/5197
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
2013-06-13 18:30:22 -07:00
Brian Foster
17f2871724 glusterfs: discard (hole punch) support
Add support for the DISCARD file operation. Discard punches a hole
in a file in the provided range. Block de-allocation is implemented
via fallocate() (as requested via fuse and passed on to the brick
fs) but a separate fop is created within gluster to emphasize the
fact that discard changes file data (the discarded region is
replaced with zeroes) and must invalidate caches where appropriate.

BUG: 963678
Change-Id: I34633a0bfff2187afeab4292a15f3cc9adf261af
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/5090
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-06-13 14:37:43 -07:00
Brian Foster
d1ccc4e400 gluster: add fallocate fop support
Implement support for the fallocate file operation. fallocate
allocates blocks for a particular inode such that future writes
to the associated region of the file are guaranteed not to fail
with ENOSPC.

This patch adds fallocate support to the following areas:

	- libglusterfs
	- mount/fuse
	- io-stats
	- performance/md-cache,open-behind
	- quota
	- cluster/afr,dht,stripe
	- rpc/xdr
	- protocol/client,server
	- io-threads
	- marker
	- storage/posix
	- libgfapi

BUG: 949242
Change-Id: Ice8e61351f9d6115c5df68768bc844abbf0ce8bd
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4969
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-06-13 14:37:21 -07:00
Pranith Kumar K
7413ed951f cluster/afr: Avoid order mismatch in blocking entrylks
Problem:
When taking blocking entrylks, afr orders the entrylks based on
uuid_compare of gfids of parent dirs, if they are equal then it orders
them based on the basenames. While this approach works fine, the
implementation assumes loc->gfids to be populated at the time of
the comparison, but loc may have gfid in loc->inode->gfid instead
of loc->gfid which was leading to order mismatches and dead-locks.

Fix:
Implemented loc_gfid which gives gfid by checking both loc->gfid,
loc->inode->gfid. Used this for ordering the blocking entrylks.

Change-Id: Ib0db36bbaf0df09fa87c3c3bb6a834db74fc2154
BUG: 965987
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/5062
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-06-05 05:22:52 -07:00
Kaushal M
599c6b4728 glusterd-volgen: Improve volume op-versions calculation
Volume op-versions calculations now take into account if an option,
 a. enables/disables an xlator, or
 b. is a boolean option.
This prevents op-versions from being updated when a feature is disabled.

Also, correctly close the dynamically loaded xlators in
xlator_volopt_dynload() and prevent leaks.

Change-Id: I895ddeeec6f6a33e509325f0ce6f01b7aad3cf5c
BUG: 954256
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4952
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-05-31 06:43:42 -07:00
shishir gowda
afd669d6bd statedump: Print entries in cb buffer in FIFO order
Currently cb buffer was being printed in LIFO order, which
is was against the percieved notion of logs having older
entries printed before newer entries in the state dumps.

Re-did the loop to prevent crash as when w_index == 0, we
would access cb[w_index - 1].

Change-Id: Idd085f73fa6937e506a2a1925e42fbcfd2d9bb1c
BUG: 966847
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4968
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-05-31 01:48:35 -07:00
Venkatesh Somyajulu
84e966cc8b logging: Fix to avoid excessive logging.
mem_get function: Log message related to mem_pool 
calloc is removed  as its been calculated in mempool
'stats'.  This messgae is consuming nearly half of 
the total log messages in DEBUG mode.

dht_hash_compute function: Changed log level from DEBUG 
to TRACE.

client_fdctx_destroy function: Changed log  level from DEBUG 
to TRACE.

Change-Id: Ic948db0419e76df4e95ebd0cabaf66eadbaada6b
BUG: 966851
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/5086
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-05-28 01:24:42 -07:00
Anand Avati
05aaec645a dht,posix: support for case discovery
This is support for discovering a filename in a given directory
which has a case insensitive match of a given name. It is implemented
as a virtual extended attribute on the directory where the required
filename is specified in the key.

E.g:

  sh# getfattr -e "text" -n user.glusterfs.get_real_filename:FiLe-B /mnt/samba/patchy
  getfattr: Removing leading '/' from absolute path names
  # file: mnt/samba/patchy
  user.glusterfs.get_real_filename:FiLe-B="file-b"

In reality, there can be multiple "answers" as the backend filesystem is
case sensitive and there can be multiple files which can strcasecamp()
successfully. In this case we pick the first matched file from the first
responding server.

If a matching file does not exist, we return ENOENT (and NOT ENODATA).
This way the caller can differentiate between "unsupported" glusterfs
API and file not existing.

This API is used by Samba VFS to perform efficient discovery of the real
filename without doing a full scan at the Samba level.

Change-Id: I53054c4067cba69e585fd0bbce004495bc6e39e8
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4941
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-05-25 11:37:31 -07:00
Anand Avati
9b645be90f gfapi: link inodes in relevant entry FOPs
Do not let inode linking to happen only in lookup(). While
that works, it is inefficient.

Change-Id: I51bbfb6255ec4324ab17ff00566375f49d120c06
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4931
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-05-25 11:36:21 -07:00
Anand Avati
79387af286 syncop: copy inode pointer in readdirplus
Change-Id: I9ab2b8ac2da9fe13f56b8b08f715a0b603ece0cb
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4930
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-05-25 11:36:05 -07:00
Krishnan Parthasarathi
16b5ec6712 syncop: synctask shouldn't yawn, it could miss a 'wake'
Change-Id: I7731fd33ca0c925cc52f8d105275b44fc625a1e2
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/5058
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-05-21 15:59:55 -07:00
Krishnan Parthasarathi
277fabf577 syncop: Remove task from syncbarrier's waitq before 'wake'
Removing task from syncbarrier's waitq after wake could result in a
subsequent syncbarrier_wake, wake'ing up the already running task.  This
fix makes the removal from waitq and wake 'atomic'

The root cause and the fix are similar in spirit to what was observed
in synclock's waitq implementation.

Change-Id: I7dd9e6ad5945742bcda20eb5a06a9376bb18528e
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/5047
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-05-20 21:08:24 -07:00
Krishnan Parthasarathi
c377febe7a syncop: Update synctask state appropriately
* Earlier, SYNCOP macro, the only consumer of synctask_yield, would set
the task->state to SYNCTASK_SUSPEND. Today, we have glusterd having its
own wrapper macros which don't set task's state. There is also the
syncbarrier and synclock framework, which also participate in a
synctask's scheduling (and need to keep a task's state up to date). It
only makes more sense to leave a synctask's state to the synctask
library, since its an internal affair.

* Need to 'yawn' before 'yield' to avoid re-running tasks to set
  task->woken appropriately.

Change-Id: Ic7a59e6ebcc46f03e53223ca237668d45a3cba40
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4985
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-05-20 11:42:22 -07:00
Krishnan Parthasarathi
4c0b149d8e syncop: Remove task from synclock's waitq before 'wake'
Removing task from synclock's waitq after wake could result in
a subsequent unlock, wake'ing up the already running task.
This fix makes the removal from waitq and wake 'atomic'.

Change-Id: Ie51ccf9d38f2cee84471097644aab95496f488b1
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4987
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-05-15 22:21:41 -07:00
Anand Avati
83cedcd9be synctask: implement barriers around yield, not the other way
In the current implementation, barriers are in the core of the
syncprocessors. Wake()s are treated as syncbarrier wake. This
is however delicate, as spurious wake()s of the synctask can
mess up the accounting of the barrier and waking it prematurely.

The fix is to keep yield() and wake() as the basic primitives,
and implement barriers as an object impelemented on top of these
primitives. This way, only an explicit barrier_wake() gets
counted towards the barrier accounting, and spurious wakes
will be truly safe.

Change-Id: I8087f0f446113e5b2d0853431c0354335ccda076
BUG: 948686
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4921
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2013-05-04 00:33:01 -07:00
Emmanuel Dreyfus
d57e37a523 Fix uninitialized mutex usage in synctask_destroy
synctask_new() initialize task->mutex is task->synccbk is NULL.
synctask_done() calls synctask_destroy() if task->synccbk is not NULL.
synctask_destroy() always destroys the mutex.

Fix that by checking for task->synccbk in synctask_destroy()

BUG: 764655
Change-Id: I50bb53bc6e2738dc0aa830adc4c1ea37b24ee2a0
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/4913
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-04-30 20:12:11 -07:00
Vijay Bellur
7967e3e5cf cluster/afr: Avoid self-healing extended attribute used by SELinux.
Since removexattr() fails to remove "security.selinux" in a system 
where SELinux is enforcing, xattr self-healing fails. 
As a consequence of this, user extended attributes are not being healed.
Added a check in afr to prune SELinux xattr from the dictionary 
used for removing xattrs from the sink.

Minor changes in tests and md-cache as well.

Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Change-Id: I854bfc0098dde812ce2afe64b125ee40c04bdeb1
BUG: 957877
Reviewed-on: http://review.gluster.org/4905
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-04-30 20:11:37 -07:00
Kaushal M
915385553e glusterd: Introduce volume op-versions
Each volume is now associated with two op-versions,
 * op_version - the op-version of the highest op-versioned feature enabled
 * client_op_version - the op-version of the highest op-versioned feature
   enabled which affects the clients only.

These two op-versions are generated dynamically and kept updated during
runtime. Glusterd now uses the respective volumes' client-op-version during
getspec requests.

To achieve the above a new field in the vme table is introduced,
client_option, this boolean field tells if the option is a client side
option.

Change-Id: I12c83b1dd29ab506026efd50d448cebbcee53c27
BUG: 907311
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4584
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-04-26 01:45:06 -07:00
Rajesh Amaravathi
054c1d7eb3 nfs: change default nfs port to 2049
This change makes it possible to mount glusterfs volumes
without specifying vers=3 option.

Change-Id: If5a974e2bdfd2adbeac3d82af774310cdf30f988
BUG: 832939
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.org/4840
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
2013-04-24 02:06:02 -07:00
Anand Avati
1bcb1c4d52 gfapi: POSIX locking support
Change-Id: I37d9e1fb4a715094876be6af3856c1b4cf398021
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4881
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-04-24 01:06:05 -07:00
Anand Avati
714c9776c5 syncop: set credentials of running process in @frame
Inherit the pid/euid/egid/groups of the running process in the
frame. Do this only in cases where a loaded frame was not
presented to the synctask.

This behavior is required for Samba VFS.

Change-Id: Ib181c90f47c6741197b9ce9f67a19e2914b647d2
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4878
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2013-04-24 01:05:03 -07:00
Anand Avati
ce111f4727 syncenv: be robust against spurious wake()s
In the current implementation, when the callers of synctasks perform
a spurious wake() of a sleeping synctask (i.e, an extra wake() soon
after a wake() which already woke up a yielded synctask), there is
now a possibility of two sync threacs picking up the same synctask.
This can result in a crash. The fix is to change ->slept = 0|1 and
membership of synctask in runqueue atomically.

Today we dequeue a task from the runqueue in syncenv_task(), but
reset ->slept = 0 much later in synctask_switchto() in an unlocked
manner -- which is safe, when there are no spurious wake()s.

However, this opens a race window where, if a second wake() happens
after the dequeue, but before setting ->slept = 0, it results in
queueing the same synctask in the runqueue once again, and get
picked up by a different synctask.

This is has been diagnosed to be the crashes in the regression tests
of http://review.gluster.org/4784. However that patch still has a
spurious wake() [the trigger for this bug] which is yet to be fixed.

Change-Id: I9b4b9dd5115d6e62ba45162ae90dd5e917a4f83d
BUG: 948686
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4795
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-04-09 00:09:50 -07:00
Vijay Bellur
e0fac0b68f glusterfsd: Cleanup temporary files from /tmp
For each gluster{d,fs,fsd} start, one or more temporary
file(s) created in /tmp were not being unlinked. This
patch cleans that up.

Modified a typo in an unrelated log message as well.

Change-Id: I3dec2a2ca40c7d6828eb238ec9cd08b6072cf0dd
BUG: 949327
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/4786
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-04-08 14:21:39 -07:00
Venkatesh Somyajulu
a5a87f0d07 dict: Put "goto out" in dict_unserialize to avoid process crash
Problem:
In the dictionary serialization function, if the
[(buf + vallen) > (orig_buf + size)], then memdup is getting failed.

Fix:
Put "goto out" whenever this condition is met.

Change-Id: I662628a936596dbb47825aad47d7dbab2879eb07
BUG: 947824
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4767
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-04-03 18:21:29 -07:00
Pranith Kumar K
e80a04f785 protocol/client: Print valid loc identifiers
Change-Id: I45f91105862a2484b8906a7a63b98ab4aaf80d05
BUG: 924643
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4683
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-04-03 15:22:32 -07:00
Jeff Darcy
0106fce7fe dht: make nufa/switch call dht's init/fini
These functions keep changing as new functionality is added, so copying
and pasting the code is not a good solution.  This way ensures that all
fields get initialized properly no matter how much new stuff we throw in.

Change-Id: I9e9b043d2d305d31e80cf5689465555b70312756
BUG: 924488
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4710
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-04-03 15:16:24 -07:00
Jeff Darcy
42a9d608d5 core: add dispatch table for init/fini
This adds a layer of indirection so that derivative translators such as
NUFA and switch can refer to the parent's init/fini (in both cases DHT's)
without having to create stub functions.

Change-Id: I1af1fea70a9ddd2aa20485af7ae65f9660f19dd6
BUG: 924490
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4709
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-04-03 15:14:27 -07:00
Anand Avati
87300be91c synctask: introduce synclocks for co-operative locking
This patch introduces a synclocks - co-operative locks for synctasks.
Synctasks yield themselves when a lock cannot be acquired at the time
of the lock call, and the unlocker will wake the yielded locker at
the time of unlock.

The implementation is safe in a multi-threaded syncenv framework.

It is also safe for sharing the lock between non-synctasks. i.e, the
same lock can be used for synchronization between a synctask and
a regular thread. In such a situation, waiting synctasks will yield
themselves while non-synctasks will sleep on a cond variable. The
unlocker (which could be either a synctask or a regular thread) will
wake up any type of lock waiter (synctask or regular).

Usage:

    Declaration and Initialization
    ------------------------------

    synclock_t lock;

    ret = synclock_init (&lock);
    if (ret) {
        /* lock could not be allocated */
    }

   Locking and non-blocking lock attempt
   -------------------------------------

   ret = synclock_trylock (&lock);
   if (ret && (errno == EBUSY)) {
      /* lock is held by someone else */
      return;
   }

   synclock_lock (&lock);
   {
      /* critical section */
   }
   synclock_unlock (&lock);

Change-Id: I081873edb536ddde69a20f4a7dc6558ebf19f5b2
BUG: 763820
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4717
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-04-02 16:02:33 -07:00
Vijaykumar koppad
1f7dadccd4 libglusterfs/dict: fix infinite loop in dict_keys_join()
- missing "pairs = next" caused infinite loop

Change-Id: I9171be5bec051de6095e135d616534ab49cd4797
BUG: 905871
Signed-off-by: Vijaykumar Koppad <vijaykumar.koppad@gmail.com>
Reviewed-on: http://review.gluster.org/4723
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-03-27 11:03:28 -07:00
Anand Avati
e701fb2713 glusterfsd: dump the in-memory graph rather than volfile
Currently we have been printing in the logfile, the volfile
verbatim as received from the server. However we perform
pre-processing on the graph we receive from the server, like
adding ACL translator, applying --xlator-option cli params,
etc.

So print the serialized in-memory graph as the "volfile" in
the log. This can be very handy to double check if certain
--xlator-option param actually got applied or not, and in
general is showing a "truer" representation of the real graph
actually used.

Change-Id: I0221dc56e21111b48a1ee3e5fe17a5ef820dc0c6
BUG: 924504
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4708
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2013-03-24 23:30:46 -07:00
Krishnan Parthasarathi
7149682695 glusterfsd: Fixed fd leak due to use of tmpfile()
Change-Id: I3c2dc070ebe967100170e39f3545acacc6016d61
BUG: 924075
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4703
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-03-22 13:34:29 -07:00
Raghavendra Bhat
f6d32dd6e8 rpc: before freeing the volume options object, delete it from the list
* Suppose there is an xlator option which is considered by the xlator
  only if the source was built with debug mode enabled (the only example
  in the current code base is run-with-valgrind option for glusterd), then
  giving that option would make the process crash if the source was not
  built with debug mode enabled.

  Reason:
  In rpc, after getting the options symbol dynamically, it was stored in the
  newly allocated volume options structure and the structure's list head was
  added to the xlator's volume_options list. But while freeing the structure
  the list was not deleted. Thus when the list was traversed, already freed
  structure was accessed leading to segfault.

Change-Id: I3e9e51dd2099e34b206199eae7ba44d9d88a86ad
BUG: 922877
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4687
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-03-20 19:57:16 -07:00
Prashanth Pai
fbb94768cb iobuf: Added a function iobref_clear
Original-author: Venky Shankar <vshankar@redhat.com>

Change-Id: Ibf861db6c1b084b798d210962344487a1919aad2
BUG: 921942
Signed-off-by: Prashanth Pai <nullpai@gmail.com>
Reviewed-on: http://review.gluster.org/4595
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-03-20 19:51:50 -07:00
Kaleb S. KEITHLEY
caac150b2b Renamed TMP_MAX to GF_TMP_MAX to avoid namespace clash on OSX.
(Just moving things along. I don't mean to step on any toes, but wasn't
sure if I had confused things with my previous review comment.)

Change-Id: I095abf751ef952ba6e225305ec5c2afc5e62ee95
BUG: 919953
Signed-off-by: Justin Clift <jclift@redhat.com>
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/4654
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-03-13 10:33:02 -07:00
Justin Clift
8e495e9259 Add missing pthread.h include to logging.h
Change-Id: I986b3e978616510ed92903e192222be513297284
BUG: 920369
Signed-off-by: Justin Clift <jclift@redhat.com>
Reviewed-on: http://review.gluster.org/4653
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
2013-03-12 08:09:38 -07:00
Raghavendra Bhat
29e75759d5 libglusterfs: avoid the logging which says the port is invalid
If the reserved ports file in proc contains just a newline, then
do not proceed with ports checking and reserving.

Change-Id: If610b0e49a97e5c22e7e2b1bb4155c9616a4612a
BUG: 762989
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4583
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-02-28 15:22:45 -08:00
Krishnan Parthasarathi
5e6dfce0b0 glusterd: Increasing throughput of synctask based mgmt ops.
Change-Id: Ibd963f78707b157fc4c9729aa87206cfd5ecfe81
BUG: 913662
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4570
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-02-26 09:06:12 -08:00
Avra Sengupta
3f1ef648b9 libglusterfs: Fixed valid_ipv4_address and valid_host_name
In valid_ipv4_address(), strtok_r was ignoring consecutive dots,
and was marking any address with consecutive dots as valid. Now
such addresses will be marked as invalid.

In valid_host_name(), any name ending with any special characters
was marked as valid. Now such hostnames will be marked as invalid.

Change-Id: If9b625d9040a14bde8c176fe36e337cb483e284a
BUG: 822830
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4579
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-02-25 19:52:25 -08:00
Anand Avati
72ad9a3a8b synctask: support for (assymetric) counted barriers
This patch introduces a new set of primitives:

  - synctask_barrier_init (stub)
  - synctask_barrier_waitfor (stub, count)
  - synctask_barrier_wake (stub)

Unlike pthread_barrier_t, this barrier has an explicit notion of
"waiter" and "waker". The "waiter" waits for @count number of
"wakers" to call synctask_barrier_wake() before returning. The
wait performed by the waiter via synctask_barrier_waitfor() is
co-operative in nature and yields the thread for scheduling other
synctasks in the mean time.

Intended use case:

  Eliminate excessive serialization in glusterd and allow for
concurrent RPC transactions.

  Code which are currently in this format:

---old---

  list_for_each_entry (peerinfo, peers, op_peers_list) {
          ...
          GD_SYNCOP (peerinfo->rpc, stub, rpc_cbk, ...);
  }

  ...

  int rpc_cbk (rpc, stub, ...)
  {
          ...
          __wake (stub);
  }

---old---

  Can be restructred into the format:

---new---

  synctask_barrier_init (stub);
  {
          list_for_each_entry (peerinfo, peers, op_peers_list) {
                  ...
                  rpc_submit (peerinfo->rpc, stub, rpc_cbk, ...);
                  count++;
           }
   }
   synctask_barrier_wait (stub, count);

   ...

   int rpc_cbk (rpc, stub, ...)
   {
           ...
           synctask_barrier_wake (stub);
   }

---new---

  In the above structure, from the synctask's point of view, the region
between synctask_barrier_init() and synctask_barrier_wait() are spawning
off asynchronous "threads" (or RPC) and keep count of how many such
threads have been spawned. Each of those threads are expected to make
one call to synctask_barrier_wake(). The call to synctask_barrier_wait()
makes the synctask thread co-operatively wait/sleep till @count such threads
call their wake function.

  This way, the synctask thread retains the "synchronous" flow in the code,
yet at the same time allows for asynchronous "threads" to acheive parallelism
over RPC.

Change-Id: Ie037f99b2d306b71e63e3a56353daec06fb0bf41
BUG: 913662
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4558
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
2013-02-21 22:57:04 -08:00
Pranith Kumar K
96c61c5512 call-stub: remove fall-through in ftruncate
Change-Id: I58bf6b881ff63d627051bef1ab30bd0337ab65e2
BUG: 913544
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4564
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-02-21 06:18:52 -08:00
Krishnan Parthasarathi
4e15a0b418 syncop: Fixed indentation and whitespaces.
Change-Id: I90e496b5d5027ac702ab3804ba52f26d537812a0
BUG: 764890
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4554
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-20 14:38:58 -08:00
Anand Avati
f0bfbbd0f2 call-stub: internal refactor
- re-structure members of call_stub_t with new simpler layout
- easier to inspect call_stub_t contents in gdb now
- fix a bunch of double unrefs and double frees in cbk stub
- change all STACK_UNWIND to STACK_UNWIND_STRICT and thereby fixed
  a lot of bad params
- implement new API call_unwind_error() which can even be called on
  fop_XXX_stub(), and not necessarily fop_XXX_cbk_stub()

Change-Id: Idf979f14d46256af0afb9658915cc79de157b2d7
BUG: 846240
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4520
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2013-02-19 16:07:59 -08:00
Varun Shastry
6ff25bc981 libglusterfs: make gf_string2percent_or_bytesize to convert float numbers.
Change-Id: I0ac6588297bdb8b085c3c9b01848a098f7fd4293
BUG: 912206
Signed-off-by: Varun Shastry <vshastry@redhat.com>
Reviewed-on: http://review.gluster.org/4533
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-18 11:47:09 -08:00
Vijay Bellur
6c848529cb libglusterfs: Fix memory leaks in fd_lk_insert_and_merge
Change-Id: I666664895fdd7c7199797796819e652557a7ac99
BUG: 834465
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/4525
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-17 17:03:40 -08:00
Vijay Bellur
fc501a57bc Better mechanism to handle memory accounting
Memory accounting will now be enabled if:

1) Any glusterfs process is spawned with argument --mem-accounting.
2) DEBUG is defined.

Change-Id: I3345e114127a57ce61916be0e2c4e0049a4c3432
BUG: 834465
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/4523
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-17 16:55:37 -08:00
Anand Avati
1ffb2558fb synctask: implement setuid-like SYNCTASK_SETID()
synctasks can now call SYNCTASK_SETID(uid,gid) to set the effective
uid/gid of the frame with which the FOP will be performed.

Once called, the uid/gid is set either till the end of the synctask
or till the next call of SYNCTASK_SETID()

Change-Id: I7eb74f7c473099bcae39310d2ab353d58f8eb2ba
BUG: 884597
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4269
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <sgowda@redhat.com>
2013-02-13 09:31:33 -08:00
Krutika Dhananjay
7c0d35b2e7 glusterd: harden 'volume start' staging to check for brick dirs' presence
PROBLEM:

When the brick directory of a volume is absent on any of the servers,
AND an attempt is made to start the volume, commit fails ONLY on the
node where the brick dir is absent, leading to a split-brain like
situation.

FIX:

Harden 'volume start' to check for the presence of brick directories
at the time of staging, thereby preventing commit failure.

Change-Id: I67faeb9afbd3aa76f08645924462db126bf7a977
BUG: 889996
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/4365
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-08 19:13:36 -08:00
Rajesh Amaravathi
0b7cdbf50d rpc: get hostnames of client to allow FQDN based authentication
If FQDNs are used to authenticate clients, then from
this commit forth, the client ip(v4,6) is reverse looked up
using getnameinfo to get a hostname associated with it,
if any, thereby making FQDN-based rpc authentication possible.

Change-Id: I4c5241e7079a2560de79ca15f611e65c0b858f9b
BUG: 903553
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.org/4439
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-06 16:15:54 -08:00
Raghavendra Bhat
6b292ff33f libglusterfs/core: dump frame and callstack creation times in statedump
Change-Id: I3772602ac264cbca490d77a0343038297faee7df
BUG: 844688
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4087
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-06 12:18:49 -08:00
Kaushal M
02d653931c glusterd,glusterfsd,libgfapi: Client op-version
This patch introduces op-version support for glusterfs clients.
Now, a client sends its supported op-versions during the volfile fetch request
and glusterd will return the volfile only if the client can support the current
op-version of the cluster.

Change-Id: Iab1f1f1706802962bcf27058657c44e8a344d2f6
BUG: 907311
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4247
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-06 12:17:06 -08:00