summaryrefslogtreecommitdiffstats
path: root/api
Commit message (Collapse)AuthorAgeFilesLines
* gfapi: Update loc->inode accordingly in 'glfs_loc_link'Soumya Koduri2015-07-092-15/+11
| | | | | | | | | | | | | | | | In case if the inode already exits in the cache, inode_link returns the pointer to the exiting one instead of using loc->inode. This will result in issues if that invalid inodei(loc->inode) is referenced further. Fixed the same. Change-Id: I7d4a06043e4e731c8404532c47d482175dc2c277 BUG: 1240916 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/11572 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* libgfapi: Gracefully exit when glfd is invalidPrashanth Pai2015-07-072-4/+6
| | | | | | | | | | | | | | | When glfs_* methods operating on glfd are invoked after calling glfs_close(), the program segfaults inside __GLFS_ENTRY_VALIDATE_FD trying to deference glfd->fd->inode which is invalid. Also, returning EBADF seemed more specific than EINVAL. BUG: 1221008 Change-Id: I13a92dca52da9a300252b69e026581b3a9e931fd Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/10759 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* build: Mac OS X build issues, header guard macrosKaleb S. KEITHLEY2015-07-041-2/+2
| | | | | | | | | | | | clang compiler errors Change-Id: I0aaa9f4353afd34e0e49ccb579b630a768c6c22a BUG: 1238788 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/11513 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* build: Mac OS X build issues, gfapi symbol versionsKaleb S. KEITHLEY2015-07-042-3/+3
| | | | | | | | | | | | fix broken symbol versions Change-Id: I153b87d80895ddd4718d0a9e51b4c0712b178bd4 BUG: 1238791 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/11514 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: send explicit lookups on inodes linked in readdirpRaghavendra Bhat2015-07-022-14/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the inode is linked via readdirp, then the consuners of gfapi which are using handles (got either in lookup or readdirp) might not send an explicit lookup on that object again (ex: NFS, samba, USS). If there is a replicate volume where the replicas of the object are not in sync, then readdirp followed by fops might lead data being served from the subvolume which is not in sync with latest data. And since lookup is needed to trigger self-heal on that object the consumers might keep getting wrong data until an explicit lookup is not done. Fuse handles this situation by sending an explicit lookup by itself (fuse xlator) on those inodes which are linked via readdirp, whenever a fop comes on that inode. The same procedure is done in gfapi as well to address this situation. Thanks to shyam(srangana@redhat.com) for valuable inputs Change-Id: I64f0591495dddc1dea7f8dc319f2558a7e342871 BUG: 1236009 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/11236 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* Revert "Upcall/gfapi: Return ENOTSUP when upcall feature is disabled"Niels de Vos2015-06-284-72/+1
| | | | | | | | | | | | | | This reverts commit b68f671b2b8a0aafef8f98145aee7044edaa907d from http://review.gluster.org/11196 . The change depends on modifications to the cluster xlators, but these are still partially under review. Dropping this change now, it causes regression tests to fail. Change-Id: If5ae4a519c9c6312cdb2e2a31acce4b1901f9442 BUG: 1231132 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/11452
* gfapi : symlink resolution for glfs_objectJiffin Tony Thottan2015-06-283-2/+64
| | | | | | | | | | | | | | | Generally posix expects symlink should be resolved, before performing an acl related operation. This patch introduces a new api glfs_h_resolve_symlink() which will do the same. Change-Id: Ieee645154455a732edfb2c28834021bab4248810 BUG: 1209735 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/11410 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* Upcall/gfapi: Return ENOTSUP when upcall feature is disabledSoumya Koduri2015-06-274-1/+72
| | | | | | | | | | | | | | Changes to detect the list of upcall events enabled using GF_FOP_IPC and return ENOTSUP to applications in case if they poll for any of the events disabled. Change-Id: Icc748054ef903598288119dbe99b1e337174662a BUG: 1231132 Signed-off-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/11196 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* build: do not #include "config.h" in each fileNiels de Vos2015-05-295-25/+0
| | | | | | | | | | | | | | | | | | Instead of including config.h in each file, and have the additional config.h included from the compiler commandline (-include option). When a .c file tests for a certain #define, and config.h was not included, incorrect assumtions were made. With this change, it can not happen again. BUG: 1222319 Change-Id: I4f9097b8740b81ecfe8b218d52ca50361f74cb64 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10808 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
* libgfapi: introduce bit flags for pthread mutex and cond variablesHumble Devassy Chirammal2015-05-282-73/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | At present stage, the initialization and destroy of conditional and mutex variables of glfs struct happen in different places and there is no uniform way of destroying these variables incase there is a failure when initializing these. The fs mutex and conditional variables are getting destroyed from glfs_free_from_ctx(). However this destroy is not done by a conditional check inside destroy function. By introducing bit flags in glfs object, we can make use of the same (if there is a failure in initialization) in glfs_fini() which is evolving as one and only function to free fs and ctx resources. This patch introduce the flags field and set the flags according to the initialization flow of the mutex and conditional variables of struct glfs members. Without this patch we are compelled to use the goto lables and other hacks in init functions to make sure the resources are freed if there is an error path. Change-Id: I86e2719fb7ce437419a05699b4f06c14b02d0e69 BUG: 1208482 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/10120 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* gfapi: zero size issue in glfs_h_acl_set()Jiffin Tony Thottan2015-05-281-2/+2
| | | | | | | | | | | | | | | | | | | When setting the stringified ACLs in the xattr dict through pub_glfs_h_setxattrs(), the size of the string is always passed as 0. The correct way is to pass the length of the ACL in text form. While verifying this issues, it seems that posix_pacl_set() should return the errno instead of -1. This helps in debugging, otherwise EPERM would always be returned on an error. [ndevos: fix off-by-one strlen() and return errno in posix_pacl_set()] Change-Id: Ia7a7fa1f3a7d615a813c703057dc97b09a0bbb34 BUG: 789278 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10782 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com>
* gfapi: fix compile warning in pub_glfs_h_access()Niels de Vos2015-05-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While compiling libgfapi, the following warning is reported: Making all in src CC libgfapi_la-glfs-handleops.lo In file included from glfs-handleops.c:12:0: glfs-handleops.c: In function 'pub_glfs_h_access': glfs-internal.h:216:14: warning: 'old_THIS' may be used uninitialized in this function [-Wmaybe-uninitialized] THIS = old_THIS; \ ^ glfs-internal.h:202:36: note: 'old_THIS' was declared here #define DECLARE_OLD_THIS xlator_t *old_THIS = NULL ^ glfs-handleops.c:1159:2: note: in expansion of macro 'DECLARE_OLD_THIS' DECLARE_OLD_THIS; ^ CCLD libgfapi.la CCLD api.la The DECLARE_OLD_THIS macro should be done with the declarations of all the other variables used in this function. Moving the macro further up in the function prevents this warning. Change-Id: I2bedc1aa074893ae3e2c933abc5a167ab5b55f41 BUG: 1210934 Reported-by: Shyamsundar Ranganathan <srangana@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10728 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com>
* core: use reference counting for mem_acct structuresJeff Darcy2015-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When freeing memory, our memory-accounting code expects to be able to dereference from the (previously) allocated block to its owning translator. However, as we have already found once in option validation and twice in logging, that translator might itself have been freed and the dereference attempt causes on of our daemons to crash with SIGSEGV. This patch attempts to fix that as follows: * We no longer embed a struct mem_acct directly in a struct xlator, but instead allocate it separately. * Allocated memory blocks now contain a pointer to the mem_acct instead of the xlator. * The mem_acct structure contains a reference count, manipulated in both the normal and translator allocate/free code using atomic increments and decrements. * Because it's now a separate structure, we can defer freeing the mem_acct until its reference count reaches zero (either way). * Some unit tests were disabled, because they embedded their own copies of the implementation for what they were supposedly testing. Life's too short to spend time fixing tests that seem designed to impede progress by requiring a certain implementation as well as behavior. Change-Id: Id929b11387927136f78626901729296b6c0d0fd7 BUG: 1211749 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/10417 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
* libgfapi: Store and restore THIS in every API exposed by libgfapiPoornima G2015-05-085-145/+591
| | | | | | | | | | | | | | | | | | | | | | Storing and restoring THIS: When the APIs exposed by libgfapi are called by other xlators like snapview server etc. the THIS value is overwritten to contain the THIS of libgfapi(viz libgfapi master xlator). Hence using 'THIS' in any xlator after calling libgfapi API will lead to issues. One such issue was uncovered in snapview and the patch http://review.gluster.org/#/c/9469/ was sent to workaround this issue. Hence, storing and restoring THIS, at the entry and exit of every API exposed by libgfapi. Change-Id: I6f330dde25e7700fb26339d667a7ccd193ec6ba0 BUG: 1210934 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/9797 Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi : anonymous fd supportJiffin Tony Thottan2015-05-056-0/+226
| | | | | | | | | | | | | | | | Anonymous fd's are floating fd assigned to a glusterfs client without a explicit file open. Here either it will create a new anonymous fd or existing anonymous fd in the client stack for requested file.The anonymous fd's are mainly used for IO's. This patch introduces two api's glfs_h_anonymous_read and glfs_h_anonymous_write which performs read and write respectively Change-Id: Id646f2220e8387b2f8bb244c848dc1db6761444f BUG: 1204651 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/9971 Tested-by: Gluster Build System <jenkins@build.gluster.com>
* api/libgfapi: Add support for statfs handleMohammed Rafi KC2015-05-054-0/+57
| | | | | | | | | | | | | snapd feature require statfs fops and thereby handle of statfs Change-Id: I037ee846aee3971826a73c592e15f1be27796c64 BUG: 1176837 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/10356 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* Upcall: Send stat as part of cache_invalidation notificationsSoumya Koduri2015-05-054-39/+134
| | | | | | | | | | | | | | | | Have added support to send attributes of both entries and its parent (include oldparent in case of RENAME fop) in the same notification request to avoid multiple rpc requests. Also, made changes in gfapi to send parent object and its attributes changed in a single upcall event. Change-Id: I92833da3bcec38d65216921c2ce4d10367c32ef1 BUG: 1200262 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10460 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* gfapi: Skip and delete the upcall entry if not foundSoumya Koduri2015-05-041-20/+32
| | | | | | | | | | | | | | We could run into situations where in gfapi received a upcall notification for a file and the file may have got deleted by then. Hence, incase of error while trying to create handle from gfid, log it, delete the entry and return with CBK_NULL reason. Change-Id: I191f10f44d6804be07734a6be63a3ca08f455f0e BUG: 1213773 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10341 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* Upcall: Process each of the upcall events separatelySoumya Koduri2015-04-305-35/+96
| | | | | | | | | | | | | | | | As suggested during the code-review of Bug1200262, have modified GF_CBK_UPCALL to be exlusively GF_CBK_CACHE_INVALIDATION. Thus, for any new upcall event, a new CBK procedure will be added. Also made changes to store upcall data separately based on the upcall event type received. BUG: 1200262 Change-Id: I0f5e53d6f5ece16aecb514a0a426dca40fa1c755 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10049 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* Fix ENOKEY build failure on non Linux systemsEmmanuel Dreyfus2015-04-291-3/+3
| | | | | | | | | | | | | ENOKEY is Linux specific, using it will fail the build on any other system. Proposed fix is to use EINVAL instead. BUG: 1129939 Change-Id: I7bdcb8dbc55aa50760c46c0d2ed932083b3066ed Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/10456 Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
* libgfapi : port gfapi to new logging frameworkHumble Devassy Chirammal2015-04-287-92/+254
| | | | | | | | | | | | Change-Id: Iaa0a92f82b9a0a26eda1a8d72b3b66ce66fab443 BUG: 1194640 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9918 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi: Reduce the log-level from ERROR to TRACEAnoop C S2015-04-241-1/+1
| | | | | | | | | | | | | Change-Id: I0b87f8ccc755a32ac64547c5f5973ea5c468018f BUG: 1202274 Signed-off-by: Anoop C S <achiraya@redhat.com> Reviewed-on: http://review.gluster.org/10364 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Poornima G <pgurusid@redhat.com> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System
* gfapi: Modified CACHE_INVALIDATE flagsSoumya Koduri2015-04-192-28/+21
| | | | | | | | | | | | | | Have prefixed CACHE_INVALIDATE flags exposed via gfapi with 'GFAPI_'. In addition as INODE_UPDATE is asynchronous and may need some support in NFS-Ganesha, have taken it out for now. Will revisit it later. Change-Id: Icbbc2c92a61c9225b6c5bc8c4212e8c4a3a0a10f BUG: 1200262 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10225 Tested-by: NetBSD Build System Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi: Fix in glfs_h_create_from_handleSoumya Koduri2015-04-192-3/+10
| | | | | | | | | | | | | While constructing glfs_object from the handle given, incase if inode is found in the inode table, we need not do "syncop_lookup" unless we need to return the inode attributes. BUG: 1200262 Change-Id: I4682d9e4420a0bcb1b3e807b801ccb3d8de3d2cd Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10232 Tested-by: NetBSD Build System Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi: fix potential non-0-terminated string (CID 1134002)Michael Adam2015-04-181-1/+2
| | | | | | | | | | | | | | | | Use correct target buffer length for strncpy and make sure that the target string is 0 terminated. Fixes Coverity ID 1134002. Change-Id: I97a74a94a818eb08a711e547f2ac6ae46087f065 BUG: 789278 Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-on: http://review.gluster.org/10247 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* libglusterfs/syncop: Add xdata to all syncop callsRaghavendra Talur2015-04-083-67/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for xdata in both the request and response path of syncops. Few calls like lookup already had the support; have renamed variables in few places to maintain uniformity. xdata passed downwards is known as xdata_in and xdata passed upwards is known as xdata_out. There is an old patch by Jeff Darcy at http://review.gluster.org/#/c/8769/3 which does the same for some selected calls. It also brings in xdata support at gfapi level. xdata support at gfapi level would be introduced in subsequent patches. Change-Id: I340e94ebaf2a38e160e65bc30732e8fe1c532dcc BUG: 1158621 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/9859 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* Avoid conflict between contrib/uuid and system uuidEmmanuel Dreyfus2015-04-045-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glusterfs relies on Linux uuid implementation, which API is incompatible with most other systems's uuid. As a result, libglusterfs has to embed contrib/uuid, which is the Linux implementation, on non Linux systems. This implementation is incompatible with systtem's built in, but the symbols have the same names. Usually this is not a problem because when we link with -lglusterfs, libc's symbols are trumped. However there is a problem when a program not linked with -lglusterfs will dlopen() glusterfs component. In such a case, libc's uuid implementation is already loaded in the calling program, and it will be used instead of libglusterfs's implementation, causing crashes. A possible workaround is to use pre-load libglusterfs in the calling program (using LD_PRELOAD on NetBSD for instance), but such a mechanism is not portable, nor is it flexible. A much better approach is to rename libglusterfs's uuid_* functions to gf_uuid_* to avoid any possible conflict. This is what this change attempts. BUG: 1206587 Change-Id: I9ccd3e13afed1c7fc18508e92c7beb0f5d49f31a Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/10017 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* libgfapi : return if gf_strdup failedHumble Devassy Chirammal2015-04-011-1/+2
| | | | | | | | | Change-Id: Ic8ad48b8118a8505ebbab2e9084007acca7226e9 BUG: 1198963 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9807 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* Upcall: Added xlator options to enable cache-invalidationSoumya Koduri2015-03-312-18/+16
| | | | | | | | | | | | | | | | Added two xlator options to enable cache-invalidation and set cache-invalidation-timeout. In addition, made few minor changes in the upcall processing code in gfapi. Change-Id: Ie0b32ca8348e34e3fe4f1e7df30cc925fa4aad31 BUG: 1200271 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/9975 Reviewed-by: Meghana M <mmadhusu@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: revamp glfs_new functionHumble Devassy Chirammal2015-03-301-29/+78
| | | | | | | | | | | | | | | | | Current glfs_new() function is not flexible enough to error out and destroy the struct members or objects initialized just before the error path/condition. This make the structs or objects to continue or left out with partially recorded data in fs and ctx structs and cause crashes/issues later in the code path. This patch avoid the issue. Change-Id: Ie4514b82b24723a46681cc7832a08870afc0cb28 BUG: 1202492 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9903 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Poornima G <pgurusid@redhat.com> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* features/bit-rot: Implementation of bit-rot xlatorVenky Shankar2015-03-241-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the "Signer" -- responsible for signing files with their checksums upon last file descriptor close (last release()). The event notification facility provided by the changelog xlator is made use of. Moreover, checksums are as of now SHA256 hash of the object data and is the only available hash at this point of time. Therefore, there is no special "what hash to use" type check, although it's does not take much to add various hashing algorithms to sign objects with. Signatures are stored in extended attributes of the objects along with the the type of hashing used to calculate the signature. This makes thing future proof when other hash types are added. The signature infrastructure is provided by bitrot stub: a little piece of code that sits over the POSIX xlator providing interfaces to "get or set" objects signature and it's staleness. Since objects are signed upon receiving release() notification, pre-existing data which are "never" modified would never be signed. To counter this, an initial crawler thread is spawned The crawler scans the entire brick for objects that are unsigned or "missed" signing due to the server going offline (node reboots, crashes, etc..) and triggers an explicit sign. This would also sign objects when bit-rot is enabled for a volume and/or after upgrade. Change-Id: I1d9a98bee6cad1c39c35c53c8fb0fc4bad2bf67b BUG: 1170075 Original-Author: Raghavendra Bhat <raghavendra@redhat.com> Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/9711 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* gfapi: space/tab conversion in gfapi.mapNiels de Vos2015-03-191-5/+5
| | | | | | | | | | | | | The last two patches incorrectly add symbols indented by spaces. The rest of the file uses tabs. This change corrects these occurences. Change-Id: Ibfb057b78c1203a594bfeb73a2955e798e86c8e1 BUG: 1185654 Reported-by: Kaleb S. Keithley <kkeithle@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/9937 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* gfapi: add glfs_h_acl_set() and glfs_h_acl_get()Niels de Vos2015-03-187-13/+140
| | | | | | | | | | | | | | | | | | | | | These two functions add support for POSIX ACLs through the GFAPI-handle interface. The initial infrastructure for POSIX ACLs based on libacl has been added with the required changes to the POSIX xlator: - http://review.gluster.org/9627 NetBSD does not support POSIX ACLs, so using any of the functions should return ENOTSUP. URL: http://www.gluster.org/community/documentation/index.php/Features/Improved_POSIX_ACLs Change-Id: Ie74f3f963c3f9d576cb2f2a1e6d97e3cd4b01eda BUG: 1185654 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/9736 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* libgfapi, timer: Fix a crash seen in timer when glfs_fini was invoked.Poornima G2015-03-171-3/+10
| | | | | | | | | | | | | | | | | | | | | | The crash is seen when, glfs_init failed for some reason and glfs_fini was called for cleaning up the partial initialization. The fix is in two folds: 1. In timer store and restore the THIS, previously it was being overwritten. 2. In glfs_free_from_ctx() and glfs_fini() check for NULL before destroying. Change-Id: If40bf69936b873a1da8e348c9d92c66f2f07994b BUG: 1202290 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/9895 Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* gfapi: APIs to store and process upcall notifications receivedSoumya Koduri2015-03-179-4/+370
| | | | | | | | | | | | | | | | | | | | | | | In case of any upcall cbk events received by the protocol/client, gfapi will be notified which queues them up in a list (<gfapi_cbk_upcall>). Applicatons are responsible to provide APIs to process & notify them in case of any such upcall events queued. Added a new API which will be used by Ganesha to repeatedly poll for any such upcall event notified (<glfs_h_poll_upcall>). A new test-file has been added to test the cache_invalidation upcall events. Below link has a writeup which explains the code changes done - URL: https://soumyakoduri.wordpress.com/2015/02/25/glusterfs-understanding-upcall-infrastructure-and-cache-invalidation-support/ Change-Id: Iafc6880000c865fd4da22d0cfc388ec135b5a1c5 BUG: 1200262 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/9536 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* every/where: add GF_FOP_IPC for inter-translator communicationJeff Darcy2015-03-174-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several features - e.g. encryption, erasure codes, or NSR - involve multiple cooperating translators which sometimes need a "private" means of communication amongst themselves. Historically we've used virtual or synthetic xattrs, but that's not very elegant and clutters up the getxattr/setxattr path which must also handle real xattr requests. This new fop should address that. The only argument is an int32_t "op" which should be recognized by the target translator. It is recommended that translators using these feature follow some convention regarding the ops that they define, to avoid conflicts. Using a hash of the target translator's type string as a base for a series of ops would probably be a good start. Any other information can be passed in both directions using xdata. The default behavior for this fop, as with any other, is to pass through to FIRST_CHILD. That makes use of this fop "transparent" to other translators that were written before it existed, but it also means that it only really works with pass-through translators. If a routing translator (such as DHT) or a fan-out translator (such as AFR) is involved, the IPC might not reach its intended destination unless those translators are modified to forward IPC fops along all paths. If an IPC gets all the way to storage/posix it is considered an error, much like an uncaught exception. We don't actually *do* anything in that case, but we do log it send back an EOPNOTSUPP error. This makes the "unrecognized opcode" condition distinguishable from the "no IPC support" condition (which would yield an RPC error instead) so clients can probe for the presence of a handler for their own favorite opcode and either use that or use old-school xattrs depending on the result. BUG: 1158628 Signed-off-by: Venky Shankar <vshankar@redhat.com> Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Change-Id: I84af1b17babe5b30ec03ecf027ae37d09b873968 Reviewed-on: http://review.gluster.org/8812 Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* gfapi: improve source comments and error messages.Humble Devassy Chirammal2015-03-163-5/+11
| | | | | | | | | Change-Id: I0bfa44eb5b5f21e381af3e71c26ea863e4adc46f BUG:1202274 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9878 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* libgfapi: initialize child_down_count cond. variable.Humble Devassy Chirammal2015-03-161-0/+1
| | | | | | | | | | | | | | | currently glfs_new_from_ctx() does not initialize child_down_count conditional variable, but, glfs_free_from_ctx() destroy this variable. mnt3udp_get_export_subdir_inode() from mount3 calls glfs_free_from_ctx(), so bound to invite problems. This patch avoids the issue. Change-Id: I8c1ed83f0b39248edbb78db25c9434274b538e80 BUG: 1200879 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9857 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* doc: convert gfapi symbol version to markdown and move to docKaleb S. KEITHLEY2015-03-101-226/+1
| | | | | | | Change-Id: Iaa0dd288b24240660594023e04a7fd84e7e62a5e BUG: 1188557 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/9561
* gfapi: Add NULL check for volname in glfs_new()Prashanth Pai2015-03-081-0/+10
| | | | | | | | | | BUG: 1199388 Change-Id: I66cb65355504eb47e4392576029a9a5422996a1b Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/9735 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* Use common loc-touchup in fuse/server/gfapiPranith Kumar K2015-03-081-22/+7
| | | | | | | | | | | Change-Id: Id41fb29480bb6d22c34469339163da05b98c1a98 BUG: 1115907 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8226 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* glfs_fini: Clean up all the resources allocated in glfs_new.Poornima G2015-03-042-7/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initially even after calling glfs_fini(), all the threads created during init and many other resources like memory pool, iobuf pool, event pool and other memory allocs were not being freed. With this patch these resources are freed in glfs_fini(). The two thumb rules followed in this patch are: - The threads are not killed, they are made to exit voluntarily, once the queued tasks are completed. The main thread waits for the other threads to exit. - Free the memory pools and destroy the graphs only after all the other threads are stopped, so that there are less chances of hitting access after free. Resources freed and its order: 1. Destroy the inode table of all the graphs - Call forget on all the inodes. This will not be required when the cleanup during graph switch is implemented to perform inode table destroy. 2. Deactivate the current graph, call fini of all the xlators. 3. Syncenv destroy - Join the synctask threads and cleanup syncenv resources Sets the destroy mode, complete the existing synctasks, then join the synctask threads. After entering the destroy mode, -if a new synctask is submitted, it fails. -if syncenv_new() is called, it will end up creating new threads, but this is called only during init. 4. Poller thread destroy Register an event handler which sets the destroy mode for the poller. Once the poller is done processing all the events, it exits. 5. Tear down the logging framework The log file is closed and the log level is set to none, after this point no log messages appear either in log file or in stderr. 6. Destroy the timer thread Set the destroy bit, once the pending timer events are processed the timer thread exits. Note: Log infrastructure should be shutdown before destroying the timer thread as gf_log uses timers. 7. Destroy the glusterfs_ctx_t For all the graphs(active and passive), free graph, xlator structs and few other lists. Free the memory pools - iobuf pool, event pool, dict, logbuf pool, stub mem pool, stack mem pool, frame mem pool. Few things not addressed in this patch: 1. rpc_transport object not destroyed, the PARENT_DOWN should have destroyed this object but has not, needs to be addressed as a part of different patch 2. Each xlator fini should clean up the local pool allocated by its xlator. Needs to be addresses as a part of different patch. 3. Each xlator should implement forget to free its inode_ctx. Needs to be addresses as a part of different patch. 3. Few other leaks reported by valgrind. 4. fd and fd contexts The numbers: The resource usage by the test case in this patch: Without the fix, Memory: ~3GB; Threads: ~81 With this fix, Memory: 300MB; Threads: 1(main thread) Change-Id: I96b9277541737aa8372b4e6c9eed380cb871e7c2 BUG: 1093594 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/7642 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* libgfapi: In glfs_init() set the cwd to "/".Poornima G2015-02-271-0/+5
| | | | | | | | | | | | | | | | | | | | | Initially, when the cwd is NULL, while resolving a relative path, it was taken to be relative from the root of the volume. But this behaviour changed with the patch: http://review.gluster.org/#/c/9671/ with this patch, if cwd is NULL, all the fops on the files (given relative path) under root directory will fail. Hence, setting the cwd to "/" during glfs_init() itself. Change-Id: I65018f6cd42539d09852069b84099034b9925418 BUG: 1196019 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/9744 Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* gfapi: handle inode_link failures gracefullyRajesh Joseph2015-02-201-1/+9
| | | | | | | | | | | Bug: 1193757 Change-Id: I73bfb91a6a73ad4f06e8828d2d7efd34d9873888 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/9671 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
* api: coverity fix.Sakshi Bansal2015-02-091-0/+6
| | | | | | | | | | | | CID 1214617: dereference NULL return value. Change-Id: I57447c3b1663edadfa966892c53bc2a16d4a166f BUG: 789278 Signed-off-by: Sakshi Bansal <sabansal@redhat.com> Reviewed-on: http://review.gluster.org/9610 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* epoll: Adding the ability to configure epoll threadsShyam2015-02-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the ability to configure the number of event threads for various gluster services. Currently with the multi thread epoll patch, it is possible to have more than one thread waiting on socket activity and processing the same. This thread count is currently static, which this commit makes dynamic. The current services which use IO path, i.e brick processes, any client process (nfs, FUSE, gfapi, heal, rebalance, etc.a), gain 2 set parameters to control the number of threads that are processing events. These settings are, - client.event-threads <n> - server.event-threads <n> The client setting affects the client graph consumers, and the server setting affects the brick processes. These are processed and inited/reconfigured using the client/server protocol xlators. Other services (say glusterd) would need to extend similar configuration settings to take advantage of multi threaded event processing. At present glusterd is not enabled with this commit, as it does not stand to gain from this multi-threading (as I understand it). Change-Id: Id8422fc57a9f95a135158eb6477ccf9d3c9ea4d9 BUG: 1104462 Signed-off-by: Shyam <srangana@redhat.com> Reviewed-on: http://review.gluster.org/9488 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* uss: disable memory accounting for the snapshot daemonRaghavendra Bhat2015-01-282-2/+3
| | | | | | | | | | | | | | | | | | * Bring in option to disable memory accounting for a glusterfs process This reverses the changes done by the commit 7fba3a88f1ced610eca0c23516a1e720d75160cd. * Change the key from "memory-accounting" to "no-memory-accounting", as by default all the glusterfs process enable memory accounting now. So to disable memory accounting for some process, "no-mem-accounting" argument has to be passed. Change-Id: I39c7cefb0fe764ea3e48f4e73e1305b084c5f497 BUG: 1184366 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/9469 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* gfapi: allow transport=NULL for set_volfile_server()Niels de Vos2015-01-201-5/+7
| | | | | | | | | | | | | | | Users of gfapi should not need to care about the supported transport methods, this is an advanced option. Simple use-cases for libgfapi should be able to pass NULL as transport, and the libraries should take care of connecting to the Gluster server(s) correctly. BUG: 1183547 Change-Id: Id93f96a3d10ae9fb69d53192642145ba8deed863 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/9464 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* api: versioned symbols for glfs_resolve()Ravishankar N2015-01-152-14/+14
| | | | | | | | | | | | | | | A minor fix not addressed in http://review.gluster.org/#/c/9143/. Needed by http://review.gluster.org/#/c/9377/5/ to resolve a merge conflict and for a sucessful compile without warnings about implicit declarations. Change-Id: I4aeb3b53887687096b69516c42a0888c6e137bf6 BUG: 1160709 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/9439 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* api: versioned symbols in libgfapi.so for compatibilityKaleb S. KEITHLEY2015-01-1213-309/+818
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use versioned symbols to keep libgfapi at libgfapi.so.0.0.0 Revisited to address broken build on Mac OS X See http://review.gluster.org/9036 Rebased to include http://review.gluster.org/#/c/9376/ (glfs_resolve()) but note that gerrit's "Rebase Change" couldn't do it. N.B. noticed that glfs_get_volumeid() decl in glfs.h was missing the __THROW, added it. On systems using ELF and the GNU toolchain, symbol versions are created with a .symver asm operand in the .c source file. Clang is claimed to be compatible with gcc, so we'll pretend for now that this also works with clang. On Mac OS X, aliases are created with __asm "magic" in the .h header file. In the normal case, when both the decl and defn match, that's all that's needed. In our case though the decl and defn don't match --- we have, e.g. a defn such as 'int glfs_foo(...)' and the corresponding decl is 'int pub_glfs_foo(...)'. To make this work we create the necessary aliases in the library at link time with the -alias_list link option. Note that this results in there being pairs of symbols in the .dylib, e.g. _pub_glfs_foo and _glfs_foo$GFAPI_3.4.0. We could use another link option, -unexported_symbols_list to elide the _pub_glfs_* symbols. (And we probably should.) Linux symbol versioning was essentially copied from Solaris; in general I would expect this to "just work" on Solaris, but until someone tries we don't really know. Change-Id: Icb96a3c2d80be7b6d7a6849bb9168f03a947f47c BUG: 1160709 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/9143 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>