summaryrefslogtreecommitdiffstats
path: root/api/src
Commit message (Collapse)AuthorAgeFilesLines
* gfapi: Add xlator_cbks fops in gfapiSoumya Koduri2016-02-291-1/+23
| | | | | | | | | | | | | | | | This is backport of the below fix - http://review.gluster.org/13499 Change-Id: I1fe5dd757e65206f92e0a867b43b49a3c0f2d4cf BUG: 1311445 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/13499 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/13508 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* gfapi: Use inode_forget in case of handle objectsSoumya Koduri2016-02-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently with gfapi, even if applications release their reference on paritular inode entries, those entries never get destroyed as they shall always have positive nlookup count unless inode_table exceeds lru limit. Since inodes and their contexts can consume considerable amount of memory, applications may end up consuming lot of memory and may even get OOM killed. To avoid that, have considered below approaches (for handle based access)- a) Do 'inode_lookup' only if the corresponding inode is created for the first time and forget it during close of the handle This shall not work as multiple handle objects can refer to same inode entry and inode_forget from second handle object onwards shall result in assert. b) Do 'inode_lookup' during a handle or fd creation But this approach shall affect the performance of the fops which operate on neither handle nor fd. c) current approach taken- Applications using glfs handle objects hold a reference on corresponding inode entries. Hence it is safe to forget those inodes and make nlookup count to '0' while trying to delete those handle objects. That way the last unref (i.e, from the last handle close) shall result in inode_destroy(). This is backport of the below patch - http://review.gluster.org/13096 Change-Id: Id2c7ab178894a10c0030c143ba71e7813df8d18c Signed-off-by: Soumya Koduri <skoduri@redhat.com> BUG: 1311441 Reviewed-on: http://review.gluster.org/13096 Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/13506 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
* gfapi: send lookup if inode_ctx is not setMohammed Rafi KC2016-02-273-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During resolving of an entry or inode, if inode ctx was not set, we will send a lookup to pupulate inode ctx for every xlators This patch also make sure that inode_ctx will be created after every inode_link. We will store inode_ctx value as LOOKUP_NEEDED if the inode is liked via readdirp, in all other case we will store inode_ctx value as LOOKUP_NOT_NEEDED. Back port of> >Change-Id: I3a10c298944200fa3862127187ae8988e582d352 >BUG: 1297311 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/13226 >Reviewed-by: Poornima G <pgurusid@redhat.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> >Reviewed-by: Dan Lambright <dlambrig@redhat.com> >Tested-by: Dan Lambright <dlambrig@redhat.com> Change-Id: Ifeabb5611fcaa3c41404f0cdc48a680a16600e68 BUG: 1306131 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/13414 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Poornima G <pgurusid@redhat.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
* gfapi : fixing listxattr call for handle opsJiffin Tony Thottan2016-02-251-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently listxattr is called as part of glfs_h_getxattrs() when NULL is passed to name field, but glfs_h_getxattrs_common() inside it will error out if name is NULL. Therefore listxattr is broken for handle ops. Upstream reference >Change-Id: I9ced6e33525e1e1a50298972e4922c954fc2b223 >BUG: 1310620 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >Reviewed-on: http://review.gluster.org/13482 >Reviewed-by: Niels de Vos <ndevos@redhat.com> >Smoke: Gluster Build System <jenkins@build.gluster.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> >(cherry picked from commit 0bc54f3ea7a56040df4a67b8626200b47fa3d779) Change-Id: Ib88c12e5c2a1841e96a65e672f40b44ac9f491a9 BUG: 1311411 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/13504 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* api: Fix errno being set to EINVAL even on successPrashanth Pai2016-02-231-0/+2
| | | | | | | | | | | | | | | | | BUG: 1296007 Change-Id: I7905ac70a537f23e1844c097a24eaa6cb762fb82 Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/12909 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-on: http://review.gluster.org/13179 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* Upcall: Read gfid from iatt in case of invalid inodeSoumya Koduri2015-12-031-0/+4
| | | | | | | | | | | | | | | | | | | | When any file/dir is looked upon for the first time, inode created shall be invalid till it gets linked to the inode table. In such cases, read the gfid from the iatt structure returned as part of such fops for UPCALL processing. This is backport of the below patch - http://review.gluster.org/12773 Change-Id: Ie5eb2f3be18c34cf7ef172e126c9db5ef7a8512b BUG: 1287079 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/12773 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/12839 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: To support set_volfile-server-transport type "unix"Mohamed Ashiq2015-12-023-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch helps libgfapi to get the volfile using Unix domain socket. run the attachment file in the bug to test. The patch checks if the glfs_set_volfile_server transport is of type "unix", If It is then uses rpc_transport_unix_options_build to get the volfile. Signed-off-by: Mohamed Ashiq <mliyazud@redhat.com> Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> >Change-Id: Ifd5d1e7c0d8cc9a906c3c3355b8977141e892a2f >BUG: 1279739 >Signed-off-by: Mohamed Ashiq <mliyazud@redhat.com> >Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> >Reviewed-on: http://review.gluster.org/12563 >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: Niels de Vos <ndevos@redhat.com> >Reviewed-by: Poornima G <pgurusid@redhat.com> >Reviewed-by: Raghavendra Talur <rtalur@redhat.com> >Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Change-Id: I0b3f2023e6698366d8c20d6574f5de7b8a641f30 BUG: 1283038 Reviewed-on: http://review.gluster.org/12645 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi: xattr key length check to avoid brick crashMilind Changire2015-11-092-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | Added check to test if xattr key length > max allowed for OS distribution and return: EINVAL if xattr name pointer is NULL or 0 length ENAMETOOLONG if xattr name length > max allowed for distribution Function exit path for invalid input is via label "out:" for mandatory __GLFS_EXIT_FS. Typically the VFS does this in the kernel for us. But since we are bypassing the VFS by providing the libgfapi to talk directly to the brick process, we need to add such checks. Change-Id: I610a8440871200ae4640351902b752777a3ec0c2 BUG: 1272926 Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/12207 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> (cherry picked from commit 47d8d2fc9c88c95dfcae2c5c06e6eb3b1ce03a92) Reviewed-on: http://review.gluster.org/12387 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* libgfapi : port missing gf_log's to gf_msgManikandan Selvaganesh2015-08-313-11/+13
| | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/#/c/11891/ Cherry-picked from commit 1e0644031c7ac0fa28f0912e951a9238f7bbe8ab > Change-Id: I0c5320c09b4a5ff1e9df61a86ac7bd47c1bb1bbb > BUG: 1252807 > Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> > Reviewed-on: http://review.gluster.org/11891 > Tested-by: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Raghavendra Talur <rtalur@redhat.com> > Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> > Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Change-Id: I0c5320c09b4a5ff1e9df61a86ac7bd47c1bb1bbb BUG: 1258406 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/12063 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
* libgfapi: Gracefully exit when glfd is invalidPrashanth Pai2015-08-262-4/+6
| | | | | | | | | | | | | | | | | | | | | | This is a backport of: http://review.gluster.org/10759 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: 1240920 Change-Id: I13a92dca52da9a300252b69e026581b3a9e931fd Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on-master: http://review.gluster.org/10759 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-on: http://review.gluster.org/11571 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Reviewed-by: bipin kunal <bkunal@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
* libgfapi: adding 'follow' flag to glfs_h_lookupat()Jiffin Tony Thottan2015-08-254-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is backport of http://review.gluster.org/#/c/11883/ Previously glfs_h_lookupat won't follow the symlink, this patch introduces new flag `follow` which will resolve the same. Applications linking against the new library will need to use the new glfs_h_lookupat API call. In order to stay compatible with existing binaries that use the previous glfs_h_lookupat() function, the old symbol needs to stay available. Verification that there are two versions of glfs_h_lookupat: $ objdump -T /usr/lib64/libgfapi.so.0 | grep -w glfs_h_lookupat 0000000000015070 g DF .text 000000000000021e GFAPI_3.7.4 glfs_h_lookupat 0000000000015290 g DF .text 0000000000000008 (GFAPI_3.4.2) glfs_h_lookupat Testing with a binary (based on anonymous_fd_read_write.c from ./tests/) that was linked against the old library: $ objdump -T ./lookupat | grep -w glfs_h_lookupat 0000000000000000 DF *UND* 0000000000000000 GFAPI_3.4.2 glfs_h_lookupat Enable debugging for 'ld.so' so that we can check that the GFAPI_3.4.2 version of the symbol gets loaded: $ export LD_DEBUG_OUTPUT=lookupat.ld.log LD_DEBUG=all $ ./lookupat $ grep -w glfs_h_lookupat lookupat.ld.log.2543 2543: symbol=glfs_h_lookupat; lookup in file=./lookupat [0] 2543: symbol=glfs_h_lookupat; lookup in file=/lib64/libgfapi.so.0 [0] 2543: binding file ./lookupat [0] to /lib64/libgfapi.so.0 [0]: normal symbol `glfs_h_lookupat' [GFAPI_3.4.2] This change has been successfully cherry-picked as 1ead86a8bcbfe4045729466e4b98f765f3c13c8d in master Upstream reference >Change-Id: I8bf9b1c19a0585f681bc1a7f84aad1ccd0f75f6a >BUG: 1252410 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >Signed-off-by: Niels de Vos <ndevos@redhat.com> >Reviewed-on: http://review.gluster.org/11883 >Reviewed-by: soumya k <skoduri@redhat.com> >Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: Idbbf0cd6802f86c53b16377d90d08ff6d99e7b08 BUG: 1256616 Reviewed-on: http://review.gluster.org/12009 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* libgfapi: non-default symbol version macros are incorrectKaleb S. KEITHLEY2015-08-191-2/+2
| | | | | | | | | | | | | | | | | | | default symbol versions are in form glfs_h_lookupat@@GFAPI_2.7.4, versus old, non-default versions are in the form glfs_h_lookup@GFAPI_2.4.2 I.e. "@@" versus "@" Backport of: * Change-Id: I88a6b129558c0b3a6064de7620b3b20425e80bc9 * BUG: 1254863 * http://review.gluster.org/#/c/11955/ Change-Id: I0d53140e03dc2f501ce11d5b2d67373360f2b8b2 BUG: 1254865 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/11956 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* rpc: add owner xlator argument to rpc_clnt_newKrishnan Parthasarathi2015-08-142-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The @owner argument tells RPC layer the xlator that owns the connection and to which xlator THIS needs be set during network notifications like CONNECT and DISCONNECT. Code paths that originate from the head of a (volume) graph and use STACK_WIND ensure that the RPC local endpoint has the right xlator saved in the frame of the call (callback pair). This guarantees that the callback is executed in the right xlator context. The client handshake process which includes fetching of brick ports from glusterd, setting lk-version on the brick for the session, don't have the correct xlator set in their frames. The problem lies with RPC notifications. It doesn't have the provision to set THIS with the xlator that is registered with the corresponding RPC programs. e.g, RPC_CLNT_CONNECT event received by protocol/client doesn't have THIS set to its xlator. This implies, call(-callbacks) originating from this thread don't have the right xlator set too. The fix would be to save the xlator registered with the RPC connection during rpc_clnt_new. e.g, protocol/client's xlator would be saved with the RPC connection that it 'owns'. RPC notifications such as CONNECT, DISCONNECT, etc inherit THIS from the RPC connection's xlator. Change-Id: I9dea2c35378c511d800ef58f7fa2ea5552f2c409 BUG: 1253212 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/11436 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> (cherry picked from commit f7668938cd7745d024f3d2884e04cd744d0a69ab) Reviewed-on: http://review.gluster.org/11908 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
* syncop: Include iatt to 'syncop_link' argsSoumya Koduri2015-07-152-5/+5
| | | | | | | | | | | | | | | | | Include iatt to 'syncop_link' args to fetch proper attributes of the newly linked inode. This is backport of the below fix - http://review.gluster.org/11611 Change-Id: If6b92961bd7a89add3791ed3a9b494087348b492 BUG: 1243408 Reviewed-on: http://review.gluster.org/11611 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/11677 Tested-by: Gluster Build System <jenkins@build.gluster.com>
* gfapi: Update loc->inode accordingly in 'glfs_loc_link'Soumya Koduri2015-07-102-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. This is backport of the below fix - http://review.gluster.org/#/c/11572/ BUG: 1241666 Change-Id: I1a89932397f7d2b70d619eeaf862c0a5d7f6b91c Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/11572 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-on: http://review.gluster.org/11606 Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: send explicit lookups on inodes linked in readdirpRaghavendra Bhat2015-07-062-14/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/11236 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: I4230fae8e0b01a95c056282b08ed30832d4804a7 BUG: 1240190 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/11545 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi : symlink resolution for glfs_objectJiffin Tony Thottan2015-06-283-2/+63
| | | | | | | | | | | | | | | | | | | | 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. backport of http://review.gluster.org/#/c/11410/1 >Change-Id: Ieee645154455a732edfb2c28834021bab4248810 >BUG: 1209735 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: I13a83f37a9e59418fd8eb4bf2d44f828515beabf BUG: 1236269 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/11438 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: introduce bit flags for pthread mutex and cond variablesHumble Devassy Chirammal2015-06-222-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: 1233651 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> (cherry picked from commit bc858473db1e1091b15d3f3d69ac6ba5d20b58e7) Reviewed-on: http://review.gluster.org/10971 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* gfapi: zero size issue in glfs_h_acl_set()Niels de Vos2015-06-011-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. Backport of: > Change-Id: Ia7a7fa1f3a7d615a813c703057dc97b09a0bbb34 > BUG: 789278 > Reviewd-on: http://review.gluster.org/10782 > Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: Ia7a7fa1f3a7d615a813c703057dc97b09a0bbb34 BUG: 1224241 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10890 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.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. Backport of: > Change-Id: I2bedc1aa074893ae3e2c933abc5a167ab5b55f41 > BUG: 1210934 > Reviewed-on: http://review.gluster.org/10728 > Reported-by: Shyamsundar Ranganathan <srangana@redhat.com> > Signed-off-by: Niels de Vos <ndevos@redhat.com> Change-Id: I2bedc1aa074893ae3e2c933abc5a167ab5b55f41 BUG: 1215787 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10730 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> 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: 1219026 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> Reviewed-on: http://review.gluster.org/10723 Tested-by: NetBSD Build System
* libgfapi: Store and restore THIS in every API exposed by libgfapiPoornima G2015-05-095-145/+591
| | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/#/c/9797 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> (cherry picked from commit 1162bb36108ab8dba8303b86927a99835b791d79) Reviewed-on: http://review.gluster.org/10414 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* libgfapi : anonymous fd supportJiffin Tony Thottan2015-05-076-0/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | backport of http://review.gluster.org/#/c/9971/ 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 cherry-picked as fa0ad231745846918b2625d0e1a89c0a5c3c24dc >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> >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: I6b01d88f92ad045e48debee23aa79f4517c6bdc2 BUG: 1218857 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/10635 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* Upcall: Send stat as part of cache_invalidation notificationsSoumya Koduri2015-05-074-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: 1217711 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10568 Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* gfapi: Skip and delete the upcall entry if not foundSoumya Koduri2015-05-071-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: 1218566 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10341 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/10565 Tested-by: NetBSD Build System
* Upcall: Process each of the upcall events separatelySoumya Koduri2015-05-075-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: 1217711 Change-Id: I0f5e53d6f5ece16aecb514a0a426dca40fa1c755 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10049 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/10562 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi : port gfapi to new logging frameworkHumble Devassy Chirammal2015-05-077-92/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | This also contains backport of http://review.gluster.org/10456: - Fix ENOKEY build failure on non Linux systems Cherry picked from commit 8986a47c54db4769feb4e6664532386f1cd0275d: > 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> Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Change-Id: I320b4f1268d49a1a1086412ff2a9fb815bcf1cf4 BUG: 1217722 Change-Id: I320b4f1268d49a1a1086412ff2a9fb815bcf1cf4 Reviewed-on: http://review.gluster.org/10486 Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
* api/libgfapi: Add support for statfs handleMohammed Rafi KC2015-05-074-0/+57
| | | | | | | | | | | | | | | | Backport of http://review.gluster.org/10356 snapd feature require statfs fops and thereby handle of statfs Change-Id: I037ee846aee3971826a73c592e15f1be27796c64 BUG: 1218741 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> Reviewed-on: http://review.gluster.org/10598
* gfapi: Modified CACHE_INVALIDATE flagsSoumya Koduri2015-05-032-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. BUG: 1217711 Change-Id: If5cd7262c85946ade04892105100aafe66887e0e Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10225 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10484 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* gfapi: Fix in glfs_h_create_from_handleSoumya Koduri2015-05-022-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: 1217711 Change-Id: Iaf296a80f721f9fca38d8023b83d37e6e5d970a5 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10232 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10485 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Vijay Bellur <vbellur@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>