summaryrefslogtreecommitdiffstats
path: root/libglusterfs
Commit message (Collapse)AuthorAgeFilesLines
* core: Introduce string representation of GF_EVENTSShehjar Tikoo2010-09-222-0/+30
| | | | | | | | Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1643 (Initial requests after mount ESTALE if DHT subvolumes connect after nfs startup) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1643
* libglusterfs: handle failure properly in gf_system()Csaba Henk2010-09-211-1/+6
| | | | | | | | | | | | | | | | - Child must be terminated if execve(2) fails, otherwise it will deadlock parent - Status, as of given by waitpid(2), is aggregated data, should not be returned as is. In fact, there is not much point in threading up the exitvalue: callers usually return gf_system result as is, and according to glusterfs conventions, they should return -1 on failure. Therefore now we check only for success/fail, and return 0/-1. Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1665 (glusterd hangs if spawning a child is failed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1665
* Glusterd: gluster volume set <volume> <option> <value>Kaushik BV2010-09-184-0/+74
| | | | | | | | Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
* check for 'link_inode' in server protocolAmar Tumballi2010-09-181-2/+2
| | | | | | | | | | * also log and return in case of 'fd_bind' getting fd with NULL inode. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1635 (running mixed tests glusterfs crashed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1635
* nfs3: Unref & unbind dir fd with inode lock on EOFv3.1.0qa26Shehjar Tikoo2010-09-172-0/+26
| | | | | | | | | | | | | | ..so that when EOF is reached on this fd, any further requests on the same inode do not get handled through this fd but result in a new fd being opened. Unbinding results in the fd getting deleted from the inode's fd list. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1619 (glusterfs nfs server crashed on dht+replica(2x2)) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1619
* cli: add a simplistic option parser, convert "mode script" to "--mode=script"Csaba Henk2010-09-162-0/+14
| | | | | | | | Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
* logging: fix a crash in gf_log_callingfn()Amar Tumballi2010-09-161-3/+10
| | | | | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1623 (crash in logging callingfn()) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1623
* performance/write-behind: dump contents of wb-fileRaghavendra G2010-09-166-28/+164
| | | | | | | | Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1059 (enhancements for getting statistics from performance translators) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1059
* Deadlock in state dumping while holding the logging lockKaushik BV2010-09-151-15/+10
| | | | | | | | Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 976 (Deadlock in state dumping while holding the logging lock) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=976
* Cleaning up mem_get0.shishir gowda2010-09-151-25/+3
| | | | | | | | | | | mem_get0 is exactly the same as mem_get, but with the addition of a call to memset(0). hence, making mem_get0 to call mem_get Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1520 (gnfs crashes on start-up in mem_get0) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1520
* remove 'gen' from iatt/protocol structuresAmar Tumballi2010-09-141-5/+0
| | | | | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* Add checks in mem_pool to catch possible double freesshishir gowda2010-09-141-3/+17
| | | | | | | | Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1520 (gnfs crashes on start-up in mem_get0) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1520
* mgmt/glusterd: free xdr allocationsPranith Kumar K2010-09-142-2/+50
| | | | | | | | Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1186 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1186
* logging: provide a API to print calling functionsAmar Tumballi2010-09-133-2/+152
| | | | | | | | | | * logs 3 calling functions Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1493 (log enhancement to print calling function..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1493
* posix: remove gen related xattr usageAmar Tumballi2010-09-131-2/+2
| | | | | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* dict.c: fix a redundant log in DEBUG levelAmar Tumballi2010-09-091-2/+2
| | | | | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1493 (log enhancement to print calling function..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1493
* changes in fuse proc thread initializationAmar Tumballi2010-09-061-2/+2
| | | | | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1527 (mount time defunct window with remote volumes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1527
* gfid: changes in symlink() prototype to have params dictionary with uuid in itAnand Avati2010-09-045-25/+22
| | | | | | | | | Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* gfid: changes in mkdir() prototype to have params dictionary with uuid in itAnand Avati2010-09-045-27/+22
| | | | | | | | | Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* gfid: changes in mknod() prototype to have params dictionary with uuid in itAnand Avati2010-09-045-32/+23
| | | | | | | | | Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* gfid: change in create() prototype to have params dictionary with uuid in itAnand Avati2010-09-045-28/+23
| | | | | | | | | Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* gfid: changes in inode managementAnand Avati2010-09-042-227/+66
| | | | | | | | | | | | | - incorporate usage of uuid (gfid) as the key for finding inodes - deprecate inode number/generation number based inode_get - undo code specific to generation numbers (attic list etc.) Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* gfid: introduce uuid based handles for inodesAnand Avati2010-09-043-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gfid represents a gluter file id. This is a universally unique id assigned to a logical inode, independent of the inode numbers assigned by the various backend filesystems to that file/directory. The gfid of a file/directory will be the same on servers depending on the cluster translator in picture. The same gfid can be used as a handle across layers of various translators and across servers and clients. This was not the case previously as the cluster translators would pick the backend inode number from one of the servers and convert that into a logical inode number by performing some mathematical transforms. This new technique of addressing inodes also makes dynamic volume management have a more robust implementation as the file handles remain the same on all versions of the graphs, and allows for seamless NFS daemon restarts as well. This change makes way for server originating communication which was not possible earlier as the servers did not have any reliable way of addressing client side inodes at all. gfid solves this problem by preserving the same uuid as the handle on all the servers and across all clients Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* mgmt/glusterd: memory leak fixesPranith Kumar K2010-08-315-82/+96
| | | | | | | | Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1186 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1186
* 'gluster volume log' feature addedAmar Tumballi2010-08-312-9/+6
| | | | | | | | | * 'gluster volume log filename <VOLNAME> [BRICK] <path>' * 'gluster volume log locate <VOLNAME> [BRICK]' * 'gluster volume log rotate <VOLUME> [BRICK]' Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
* Add command logging facility for glusterdshishir gowda2010-08-312-0/+104
| | | | | | | | | | | | | | | Added new command logging facility to gf_cmd_log() which can be used to log all commands to a .cmd_log_history file situated in the glusterd working directory. Accepts 1 st argument a domain string (e.g: volume, peer..) followed by msg string (similar to gf_log) Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1404 (need a dump of all the op/mgmt commands) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1404
* changes to client to make use of the rdma functionality.Raghavendra G2010-08-301-0/+3
| | | | | | | | | | | - preallocate buffers in client and pass them to transport layer whenever a large response is expected. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 513 (Introduce 0 copy rdma) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=513
* Bring in new transport rdma.Raghavendra G2010-08-301-0/+9
| | | | | | | | | | | | - rdma is new transport and improvement over current ib-verbs. It uses rdma-read and rdma-write for efficiently transferring large buffers. For more details please refer to rfc-5666 and rfc-5667. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 513 (Introduce 0 copy rdma) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=513
* Provides the ability to filter the output of state dumpKaushik BV2010-08-303-27/+228
| | | | | | | | Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 828 (glusterdump filled up the /) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=828
* performance/stat-prefetch: while removing an entry from cache, remove it ↵Raghavendra G2010-08-281-1/+1
| | | | | | | | | | from caches stored in all opened fds. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1414 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1414
* fix notify mechanism to send CHILD_UP to fuseAmar Tumballi2010-08-271-1/+15
| | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
* glusterfsd: Clang error fixes.Sachidananda2010-08-261-1/+1
| | | | | | | | Signed-off-by: Sachidananda Urs <sac@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1077 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1077
* glusterd: support for volume version and cksumv3.1.0qa8Vijay Bellur2010-08-232-194/+221
| | | | | | | | Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1310 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1310
* rpcsvc: allow creation of both rdma and socket for a single server transport.Raghavendra G2010-08-231-2/+2
| | | | | | | | Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 513 (Introduce 0 copy rdma) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=513
* gf_system: fork/exec instead of systemAmar Tumballi2010-08-212-0/+58
| | | | | | | | | | * most of the glusterd 'system()' are replaced with 'gf_system()' Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1292 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1292
* portmapper program added to glusterfsd mgmt rpcAmar Tumballi2010-08-211-0/+4
| | | | | | | | | | | * some bug fixes glusterd-pmap.c * also renamed 'fetch-spec.c' -> 'glusterfsd-mgmt.c' Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1314 (portmapper functionality) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1314
* libglusterfs: Fix warnings reported by clang.Sachidananda2010-08-191-17/+51
| | | | | | | | | | Fix errors reported by clang. Signed-off-by: Sachidananda Urs <sac@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1088 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1088
* Fix memory corruption in mem poolshishir gowda2010-08-186-9/+44
| | | | | | | | | | | | Added new interface mem_get0, which calls memset on the mem pool entries being returned. Gluster and Kernel compile should now succeed. Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1393 (Gluster and kernel compile fails) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1393
* fix the 'no logfile set' log during gluster process start.Amar Tumballi2010-08-121-4/+3
| | | | | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1348 ('no logfile set' displayed when glusterfs is started) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1348
* argument sanity checks added in inode.cAmar Tumballi2010-08-121-3/+141
| | | | | | | | Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1311 (crash during nfs alpha test) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1311
* logging enhancementsAmar Tumballi2010-08-123-25/+104
| | | | | | | | | | | | | | | | * per translator loglevel introduced, if set, it will override process wide log level. * with extended attribute 'trusted.glusterfs.<xlator-name>.set-log-level' with the value being '<LOGLEVEL>', one can change log level of particular translator. * with extended attribute 'trusted.glusterfs.syslog' with the value '<BOOLEAN>', one can enable disable syslog for gluster Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 601 (Enable changing 'log-level' of GlusterFS process at runtime) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=601
* fuse resolve related changesAmar Tumballi2010-08-112-21/+29
| | | | | | | | | | | | | Now fuse is fully complaint with DVM, as even if there is a fop request on inode belonging to old graph, it will be resolved corresponding to new graph and operations will be performed wrt. new graph, which makes DVM truely spontaneous. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1240 (DVM: after graph change, inodes should resolve to new inode-table) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1240
* core,glusterd: Solaris getxattr build fixShehjar Tikoo2010-08-101-0/+1
| | | | | | | | Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1178 (Gluster mainline build fails on Solaris) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1178
* add pump xlator and changes for replace-brickPavan Sondur2010-08-063-3/+211
| | | | | | | | Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1235 (Bug for all pump/migrate commits) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1235
* mem pool for call_stub_tshishir gowda2010-08-063-3/+14
| | | | | | | | | Ran posix compliance test and sanity test Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
* mem pool for fd_tshishir gowda2010-08-063-2/+14
| | | | | | | | | Ran posix compliance test and sanity test Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
* Implement mem pool for inode dentryshishir gowda2010-08-062-7/+33
| | | | | | | | | Ran posix compliance test and sanity test Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
* Implement mem pool for frame and stackshishir gowda2010-08-061-14/+27
| | | | | | | | | Ran posix compliance test and sanity test Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
* libglusterfs: Prevent multiple timer threads from being spawnedv3.1.0qa3Vijay Bellur2010-07-291-1/+1
| | | | | | | | Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1246 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1246
* syncop: initial implementationPavan Sondur2010-07-285-2/+564
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resending Avati's syncop patch with a few bug fixes. (please do not skip the IMPORTANT NOTES section) * Framework for SYNChronous OPerations -------------------------------------- This patch provides a framework for performing synchronous operations over the underlying actual asynchronous GlusterFS FOPS. * Use cases ----------- 1. Convenient implementation of crawler thread in replicate/pump 2. Convenient implementation of high level control flow in DVM * Background ------------ All (almost) threads in GlusterFS are hosts for executing aysnchronous file operations using the STACK_WIND and STACK_UNWIND primitives - as calls and callbacks. While the STACK_WIND and STACK_UNWIND macros provide high control for efficiently implementing file operations in a clustered/parallel environment, there are tasks where the nature of the task itself is sequential and the execution performance of the task is not critical. In these cases the complexity to implement the task with STACK_WIND/STACK_UNWIND based operations as calls and callbacks is an overkill. * Introduction --------------- syncop: are wrappers around the STACK_WIND/STACK_UNWIND based asynchronous fops. synctask: a sequential task (a C function) which uses syncops. syncenv: an environement to schedule and execute synctasks. The synchronicity is implemented via ucontext.h based continuations. Execution of synchronous tasks is possible only in a synchronous environment. Therefore, the first step is to create such an environment - struct syncenv *env = syncenv_new (0); This creates a synchronous environment, with a thread (scheduler) to host the synchronous tasks. Creation of this environment is generally to be done at the time of process initialization. Next is to spawn a synchronous task in this environment - int slow_self_heal (void *data); int completion_func (int ret, void *data); ret = synctask_new (env, slow_self_heal, completion_func, data); Here slow_self_heal is a task which is implemented using synchronous operations. When slow_self_heal() completes, completion_func() is called with the first parameter as the return value of slow_self_heal(). Both these functions get the @data argument as the same value passed to synctask_new(). int slow_self_heal (void *data) { xlator_t *child = FIRST_CHILD (THIS); fd_t *dir = NULL; ... dir = syncop_opendir (child, loc); entry = syncop_readdir (dir); ... return ret; } * IMPORTANT NOTES ----------------- - calling syncops in code executing outside the synchronous environment will very likely cause and undesired blocking of the executing thread leading to deadlocks!! The synchronous environment is a special thread where such sleeps are safe, and these sleeps result in the scheduler to 'swap in' other synctasks. - syncops can put the task to sleep. DO NOT issue syncops while holding mutexes. This is very similar to the blunder of holding a mutex and doing STACK_WIND. - It works best when synctasks use only syncops. If a call_frame is created and STACK_WIND'ed, the callback would very likely happen in a thread outside the synchronous enviroment, at an undefined time - as expected. So note that the synchronous environment does not tame the notorious behaviour of STACK_WIND. Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971