31 Commits

Author SHA1 Message Date
Anand Avati
90d77fbdd2 gfapi: dict_unref() xattr_req in fop finish instead of dict_destroy()
The current way of calling dict_destroy() at the end of an API fop assumes
that xattr_req is not stored/ref'd by any translators in the stack. However
when translators like DHT store xattr_req in dht_local_t with a dict_ref()
and perform dict_unref() in the unwind path, things get subject to a race.

The race is between the woken up thread (by syncop_wake) i.e, the gfapi
invoking thread and the thread where the FOP was unwound. As the C stack
of STACK_UNWIND unwinds back, dht_local_unref() gets invoked within the
DHT_STACK_UNWIND macro. This thread attempts dict_unref, which would
be "safe" if it wins the race against the gfapi invoking thread. However
if the gfapi invoking thread wins the race, it will perform dict_destroy()
first and therefore make dict_unref() within dht_local_unref perform
a double free.

This is the embarrassing on-screen bug which showed up in a roomful of people
during the gluster dev summit demo of qemu/libgfapi integration.

Change-Id: I284c93de87cdc128d5801f42c84aa87f753090d4
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4644
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-03-07 07:03:26 -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
d3e7881ecd Use proper libtool option -avoid-version instead of bogus -avoidversion
Change-Id: I1c9541058c7d07786539a3266ca125a6a15287d8
BUG: 859835
Signed-off-by: Anand Avati <avati@redhat.com>
Original-author: Kacper Kowalik (Xarthisius) <xarthisius.kk@gmail.com>
Signed-off-by: Kacper Kowalik (Xarthisius) <xarthisius.kk@gmail.com>
Reviewed-on: http://review.gluster.org/3967
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2013-02-07 15:12:56 -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
Mohammed Junaid
34d8edf58a gfapi: Mark fs->init status done in glfs_init_done for the case of glfs_init_async.
This seen when we call glfs_init_async. The glfs_init_done function,
calls the call-back function without assigning 1 to fs->init. The problem
occurs when we call glfs_read or a similar api next time which checks if
fs->init is 1 and will enter into an infinite wait if it is zero.

Change-Id: I34a3d1652c80e737f5b05082a3fbb6e5978b14cd
BUG: 839950
Signed-off-by: Mohammed Junaid <junaid@redhat.com>
Reviewed-on: http://review.gluster.org/4445
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-02-03 12:11:31 -08:00
Avra Sengupta
777d395fea core: fixes for gcc's '-pedantic' flag build
* warnings on 'void *' arguments
* warnings on empty initializations
* warnings on empty array (array[0])

Change-Id: Iae440f54cbd59580eb69f3ecaed5a9926c0edf95
BUG: 875913
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4219
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2013-01-21 22:17:36 -08:00
Amar Tumballi
000e65d7af core: remove all the 'inner' functions in codebase
* move 'dict_keys_join()' from api/glfs_fops.c to libglusterfs/dict.c
  - also added an argument which is treated as a filter function if
    required, currently useful for fuse.

* now 'make CFLAGS="-std=gnu99 -pedantic" 2>&1 | grep nested' gives
  no output.

Change-Id: I4e18496fbd93ae1d3942026ef4931889cba015e8
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 875913
Reviewed-on: http://review.gluster.org/4187
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-12-19 23:35:29 -08:00
Jeff Darcy
e5a19e2ab5 api: update Python wrapper
This brings us back to functional parity with the C example, and also makes
things more "Pythonic" (e.g. methods on Volume/File objects instead of bare
functions).

Change-Id: I46edfee46d91881e275de2f63e15d9f0a6448e80
BUG: 839950
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4286
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Peter Portante <pportant@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-12-19 19:16:51 -08:00
Avra Sengupta
5f88d4c1b0 libgfapi: "tcp" is documented as the valid transport type instead of "socket".
Change-Id: I066e9be7755a535f385c102cdd1822adeda7f319
BUG: 860203
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4226
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2012-11-28 16:24:41 -08:00
Anand Avati
b872ccf508 api/examples: updated examples to use new calls
Change-Id: I865d0c52de268b27bbdb8786d3f4af5ef3ce3d9a
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4023
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2012-11-05 05:53:56 -08:00
Anand Avati
144db7f39f gfapi: added more API calls
- stat
- lstat
- access
- readlink
- mknod
- mkdir
- rmdir
- symlink
- rename
- link
- opendir
- closedir
- seekdir
- telldir
- readdir_r
- statvfs
- chmod
- fchmod
- chown
- lchown
- fchown
- utimens
- lutimens
- futimens
- getxattr
- lgetxattr
- fgetxattr
- setxattr
- lsetxattr
- fsetxattr
- listxattr
- llistxattr
- flistxattr
- removexattr
- lremovexattr
- fremovexattr

Change-Id: Ic2467293ddfbcefaa9b41c82cec61a5602636833
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4022
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-10-08 03:36:33 -07:00
Anand Avati
6c2e3e6a65 glfs-resolve: fix resolution of "/"
Change-Id: I78d63b39dde14a9a32ea197cf0dedeb5695b35c9
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4021
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-10-03 15:04:09 -07:00
Jeff Darcy
58e6296fa2 build: split CPPFLAGS from CFLAGS
Automake provides a separate variable for preprocessor flags
(*_CPPFLAGS). They are already uses in a few places, so make it
consistent and use it everywhere. Note that cflags obtained from
pkg-config often are cppflags, which is why LIBXML2_CFLAGS moves with
into AM_CPPFLAGS, for example.

Change-Id: I15feed1d18b2ca497371271c4b5876d5ec6289dd
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4029
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-03 12:26:45 -07:00
Jeff Darcy
1ecbb7ca68 build: remove useless explicit -fPIC -shared from
CFLAGS

libtool will automatically add "-fPIC" to the compiler command line as
needed, so there is no need to specify it separately.

"-shared" is normally a linker flag and has an odd effect when used with
libtool --mode=compile, namely that it inhibits production of static
objects. For that however, using AC_DISABLE_STATIC is a lot simpler.

Change-Id: Ic4cba0fad18ffd985cf07f8d6951a976ae59a48f
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4027
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-03 12:24:59 -07:00
Jeff Darcy
04371377f2 build: remove -nostartfiles flag
The "-nostartfiles" is a discouraged option and is documented to
potentially result in undesired behavior. Since I see no reason why it
should be in glusterfs, remove it.

Change-Id: I56f2b08874516ebad91447b2583ca2fb776bb7ab
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4018
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-02 13:11:43 -07:00
Jeff Darcy
3369983815 build: add missing backslash in api/src/
Seems like an accidental omission of the backslash.

Change-Id: If78efd9d985a08829ecd6307fd8209d05d0e1fbf
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4010
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-02 09:36:54 -07:00
Jeff Darcy
9059a76c67 build: consolidate common compilation flags into one variable
Some -D flags are present in all files, so collect them.
This adds -D${GF_HOST_OS} to some compiler command lines,
but this should not be a problem.

Change-Id: I1aeb346143d4984c9cc4f2750c465ce09af1e6ca
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4013
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-01 16:44:50 -07:00
Jeff Darcy
b9f76b7179 build: add missing GF_CFLAGS in api/src/
GF_CFLAGS seems missing in two spots.

In one of those, adding it to libgfapi_la_CFLAGS would make it equal
to AM_CFLAGS, so remove libgfapi_la_CFLAGS there.

Change-Id: I50c22f16210ecd40371d4abb0e418c7a4f94c12f
BUG: 862082
Original-author: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4009
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-10-01 16:42:11 -07:00
Amar Tumballi
95a33a5903 gfapi: fix the failure in glfs_open()
* the issue is happening because the resolve_symlink() logic was
  reversed

Change-Id: I10eca14d82e3ebf5a0195d5db1330f9e1a3e2dc4
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 839950
Reviewed-on: http://review.gluster.org/3978
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-09-25 10:53:18 -07:00
Anand Avati
8f9e94c655 gfapi: add symlink (auto resolution) support in resolver
- new internal API glfs_lresolve() for usage with APIs
  like glfs_lXXXX() (e.g. glfs_lstat())

Change-Id: I61c60af6bda3072f189684ad8ac9815d59f455fc
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/3866
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-09-17 19:25:01 -07:00
Amar Tumballi
2f2e3bfb5e syncop: handle 'dataonly' flag in syncop_fsync()
* and also in syncop_readv(), don't look at _cbk args if op_ret
  is < 0.

Change-Id: I3ab2982bc6d186e75b6adb74c8981e4ff7058bbe
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 839950
Reviewed-on: http://review.gluster.org/3828
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-08-20 00:16:01 -07:00
Amar Tumballi
ed4b76ba9c core: reduce the usage of global variables
* move all the 'logging' related global variables into ctx
* make gf_fop_list a 'const' global array, hence no init(),
  no edits.
* make sure ctx is allocated without any dependancy on
  memory-accounting infrastructure, so it can be the first
  one to get allocated
* globals_init() should happen with ctx as argument

not yet fixed below in this patchset:
* anything with 'THIS' related globals
* anything related to compat_errno related globals as its
  one time init'd and not changed later on.
* statedump related globals

Change-Id: Iab8fc30d4bfdbded6741d66ff1ed670fdc7b7ad2
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 764890
Reviewed-on: http://review.gluster.com/3767
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-08-03 02:01:52 -07:00
Anand Avati
c8ed0096d5 glfsxmp extension
Change-Id: I3859621637025e464bc83d748bae7dff9808643f
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3735
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-08-02 13:25:02 -07:00
Anand Avati
1b42c864d6 gfapi: let glfs_init() return on non-RPC errors
Change-Id: Ic3a15044434926127b8de273b1033b8ad452290c
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3732
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-08-02 13:24:36 -07:00
Anand Avati
a307249933 gfapi: set errno in glfs_init()
save errno from glfs_init_done and set it in glfs_init_wait()

Change-Id: I1a2f43a7e7b0f07f279c175df987ff94d642b629
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3771
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-08-02 13:22:28 -07:00
Anand Avati
a9e3e24dd3 gfapi: missed setting port option
Change-Id: I72790de10cefaae3d3307b6fbb9899907b019ccc
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3733
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Bharata B Rao <bharata.rao@gmail.com>
2012-08-02 13:21:18 -07:00
Pranith Kumar K
fa0442e001 Warnings: Fix set, unused variable warnings
Change-Id: If7ee85aa0d93f9018a76e7f60fcb7dcaf849dbdc
BUG: 839950
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3742
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-07-29 11:19:08 -07:00
Anand Avati
07c90f84d3 gfapi: unglobalize oldvol{file,len}
Multiple initialization of volumes works fine now.

Change-Id: Ibc16957b39325817bc6f9ab90ebac9cefdafabf8
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3734
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-07-27 11:58:21 -07:00
Jeff Darcy
67a85803b5 Example of using libglfs from Python.
Change-Id: I081582c457428d55db8ec1ed6d90f1e439f51f0d
BUG: 839950
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.com/3675
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
2012-07-18 12:45:10 -07:00
Anand Avati
b324e31731 glfsxmp: libgfapi based example
This is an example application which uses libgfapi. It is
a complete autotools based build system which demonstrates the
required changes in configure.ac, Makefile.am etc to successfuly
detect for and build an application against libgfapi.

There are two approaches to building a libgfapi based application:

1. In the presence of pkg-config in your build system.
This is the recommended approach which is also used in this example.
For this approach to work, you need to build glusterfs by passing
--pkgconfigdir=/usr/lib64/pkgconfig (or the appropriate directory)
in your distro. This already happens if you build RPMs with the
glusterfs.spec provided in glusterfs.git. You will also need to
install glusterfs-api RPM.

2. In the absence of pkg-config in your build system.
Make sure your LDFLAGS includes -L/path/to/lib where libgfapi.so is
installed and -I/path/to/include/glusterfs where the 'api' directory

Change-Id: Ic4eab2df002d7e8d20593a03e643859423048848
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3666
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
2012-07-18 12:12:25 -07:00
Anand Avati
2475e0193c gfapi: API/library for accessing gluster volumes
Change-Id: Ie4cbcf91b58218bebf23cf951c313aceeb29f311
BUG: 839950
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.com/3664
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Bharata B Rao <bharata.rao@gmail.com>
2012-07-18 12:10:44 -07:00