summaryrefslogtreecommitdiffstats
path: root/xlators/features
Commit message (Collapse)AuthorAgeFilesLines
...
* features/locks:Use pthread_mutex_unlock() instead of pthread_mutex_lock()Vijay Bellur2018-11-081-1/+1
| | | | | | | | Fixes CID 1396581 Change-Id: Ic04091b5783a75d8e1e605a9c1c28b77fea048d3 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* glupy: remove from the buildAmar Tumballi2018-11-081-5/+4
| | | | | | | | | | | | | | | Based on the proposal to remove few features as they are not actively maintained [1], removing 'glupy' translator from the build. [1] https://lists.gluster.org/pipermail/gluster-users/2018-July/034400.html This patch aims at clearing the translator from build and tests. A followup is needed to remove the code from repository. Updates: bz#1642810 Change-Id: I41d0c1956330c3bbca62c540ccf9ab01bbf3a092 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* lock: Do not allow meta-lock count to be more than oneSusant Palai2018-11-061-1/+34
| | | | | | | | | | | | | | | | | | | | In the current scheme of glusterfs where lock migration is experimental, (ideally) the rebalance process which is migrating the file should request for a metalock. Hence, the metalock count should not be more than one for an inode. In future, if there is a need for meta-lock from other clients, this patch can be reverted. Since pl_metalk is called as part of setxattr operation, any client process(non-rebalance) residing outside trusted network can exhaust memory of the server node by issuing setxattr repetitively on the metalock key. The current patch makes sure that more than one metalock cannot be granted on an inode. Fixes CVE-2018-14660 updates: bz#1644758 Change-Id: Ie1e697766388718804a9551bc58351808fe71069 Signed-off-by: Susant Palai <spalai@redhat.com>
* all: fix the format string exceptionsAmar Tumballi2018-11-055-11/+11
| | | | | | | | | | | | | | | | Currently, there are possibilities in few places, where a user-controlled (like filename, program parameter etc) string can be passed as 'fmt' for printf(), which can lead to segfault, if the user's string contains '%s', '%d' in it. While fixing it, makes sense to make the explicit check for such issues across the codebase, by making the format call properly. Fixes: CVE-2018-14661 Fixes: bz#1644763 Change-Id: Ib547293f2d9eb618594cbff0df3b9c800e88bde4 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* index: prevent arbitrary file creation outside entry-changes folderRavishankar N2018-11-051-0/+17
| | | | | | | | | | | | | | | | | | | Problem: A compromised client can set arbitrary values for the GF_XATTROP_ENTRY_IN_KEY and GF_XATTROP_ENTRY_OUT_KEY during xattrop fop. These values are consumed by index as a filename to be created/deleted according to the key. Thus it is possible to create/delete random files even outside the gluster volume boundary. Fix: Index expects the filename to be a basename, i.e. it must not contain any pathname components like "/" or "../". Enforce this. Fixes: CVE-2018-14654 Fixes: bz#1644760 Change-Id: I35f2a39257b5917d17283d0a4f575b92f783f143 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* features/snapview-server: change gf_log instances to gf_msgRaghavendra Bhat2018-11-056-289/+417
| | | | | | Change-Id: Ib8bdf210a896423abcd7413dd4896d424ac0f561 fixes: bz#1626610 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* tiering: remove the translator from build and glusterdAmar Tumballi2018-11-021-1/+1
| | | | | | | | | | | | | Based on the proposal to remove few features as they are not actively maintained [1], removing tier translator from the build. Also make sure there are no regression tests involving tiering feature are present. [1] https://lists.gluster.org/pipermail/gluster-users/2018-July/034400.html Change-Id: I2c177f711f9b54b7b24e1a13525ff3132bd9a9c5 updates: bz#1642807 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* features/namespace: NULL pointer deferencing clang fixSheetal Pamecha2018-10-251-1/+0
| | | | | | | | | Removed VALIDATE_OR_GOTO check on "this" Updates: bz#1622665 Change-Id: Ie0d74525901ebf9daa1a5e788a035db6dc5d8c06 Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
* shard : fix coverity issue in shard.cSunny Kumar2018-10-251-4/+12
| | | | | | | | | | | | This patch fixes CID: 1394664 : CHECKED_RETURN 1356534 : Macro compares unsigned to 0 (NO_EFFECT) 1356532 : Macro compares unsigned to 0 (NO_EFFECT) updates: bz#789278 Change-Id: I04d64fd8c007627611710dc56109b76eeb59333a Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* leases:Mark the fop conflicting if lease_id not setSoumya Koduri2018-10-241-5/+8
| | | | | | | | | | | | | | | | Glusterfs leases expects lease_id to be set and sent for each fop to determine conflict resolution with the existing lease. Incase if not set (most likely if there is an older client in a mixed cluster), it makes sense to consider it as conflicitng fop and recall the lease. Also fixed the return status check for __remove_lease(), wherein non-negative value is considered as success case. Change-Id: I5bcfba4f7c71a5af7cdedeb03436d0b818e85783 updates: #350 Signed-off-by: Soumya Koduri <skoduri@redhat.com>
* xlators: some high severity coverity fixesBhumika Goyal2018-10-221-10/+33
| | | | | | | | Fixes: 124759 1288787 Change-Id: Ib8999242fc3ea5f4ea80246659899d2d4f06c506 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* ctr: fix coverity issue in changetimerecorder.cMohit Agrawal2018-10-181-3/+1
| | | | | | | | | | This patch fixes CID: 1396179: Read from pointer after free 1396178: Use after free Change-Id: I47a2e4aa257e0c4dbdf2e1fd2e0748902764463f fixes: bz#789278 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* shard : fix newly introduced coveritySunny Kumar2018-10-181-1/+2
| | | | | | | | | This patch fixes CID: 1396177: NULL dereference. updates: bz#789278 Change-Id: Ic5d302a5e32d375acf8adc412763ab94e6dabc3d Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* trash : fix high sev coverity issue in trash.cSunny Kumar2018-10-161-0/+1
| | | | | | | | | This patch fixes CID 1288790: RESOURCE_LEAK. updates: bz#789278 Change-Id: I34bb410f1d3027e2d4c21044e87e319360344e04 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* Multiple xlators: perform gettimeofday() not under lockYaniv Kaul2018-10-163-8/+16
| | | | | | | | | | | | | While it may slightly reduce accuracy, I think it's better to acquire the time outside a lock and then memcpy the value while under lock. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: Ic8fb94a56c4fa2d3b13e59767e13646fb39342ba
* features/shard: Hold a ref on base inode when adding a shard to lru listKrutika Dhananjay2018-10-161-14/+34
| | | | | | | | | | | | | | | | | | | | | | | | | In __shard_update_shards_inode_list(), previously shard translator was not holding a ref on the base inode whenever a shard was added to the lru list. But if the base shard is forgotten and destroyed either by fuse due to memory pressure or due to the file being deleted at some point by a different client with this client still containing stale shards in its lru list, the client would crash at the time of locking lru_base_inode->lock owing to illegal memory access. So now the base shard is ref'd into the inode ctx of every shard that is added to lru list until it gets lru'd out. The patch also handles the case where none of the shards associated with a file that is about to be deleted are part of the LRU list and where an unlink at the beginning of the operation destroys the base inode (because there are no refkeepers) and hence all of the shards that are about to be deleted will be resolved without the existence of a base shard in-memory. This, if not handled properly, could lead to a crash. Change-Id: Ic15ca41444dd04684a9458bd4a526b1d3e160499 updates: bz#1605056 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
* libglusterfs/dict: Add sizeof()-1 variants of dict functionsPranith Kumar K2018-10-154-26/+13
| | | | | | | | | | | One needs to be very careful about giving same key for the key and SLEN(key) arguments in dict_xxxn() functions. Writing macros that would take care of passing the SLEN(key) would help reduce this burden on the developer and reviewer. updates: bz#1193929 Change-Id: I312c479b919826570b47ae2c219c53e2f9b2ddef Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
* features/locks: Fix Coverity issuesAshish Pandey2018-10-121-1/+4
| | | | | | | | | | | | | CID: 1395812 Explicit null dereferenced 1356542 Dereference null return value https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=86261835&defectInstanceId=26407100&mergedDefectId=1395812 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=86261835&defectInstanceId=26407215&mergedDefectId=1356542 Change-Id: I2c20972a8080fa7a70b88eab0688b9cf734bbf24 updates: bz#789278 Signed-off-by: Ashish Pandey <aspandey@redhat.com>
* snapshot : fix high sev coverity on snapview-server.cSunny Kumar2018-10-121-0/+1
| | | | | | | | | This patch fixes CID 1325525 (double free). updates: bz#789278 Change-Id: I26a5f428dde83dd7708815f06830decf4068b94c Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* locks : fix coverity issueSunny Kumar2018-10-102-0/+8
| | | | | | | | | This patch fixes CID 1356544 and 1356539. Both are of type NULL_RETURNS. Change-Id: I2ef7c3ff9929c4d85b79fff00e835ebee3ff3ce0 updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* all: fix warnings on non 64-bits architecturesXavi Hernandez2018-10-1014-33/+34
| | | | | | | | | | When compiling in other architectures there appear many warnings. Some of them are actual problems that prevent gluster to work correctly on those architectures. Change-Id: Icdc7107a2bc2da662903c51910beddb84bdf03c0 fixes: bz#1632717 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* features/snapview-client: replace gf_log with gf_msgRaghavendra Bhat2018-10-104-168/+206
| | | | | | Change-Id: I87f01d86f50eb2fca21febb0ea3e77fbd152eb93 updates: bz#1626610 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* cloudsync: coverity fixSusant Palai2018-10-102-2/+4
| | | | | | | | | CID: 1394649 1394657 Issue: Explicit null dereferenced Change-Id: Ic1040ffa5548e1ecd49cfdc9a8716be445cbdf0f Updates: bz#789278 Signed-off-by: Susant Palai <spalai@redhat.com>
* core: glusterfsd keeping fd open in index xlatorMohit Agrawal2018-10-082-2/+52
| | | | | | | | | | | | | | Problem: Current resource cleanup sequence is not perfect while brick mux is enabled Solution: 1) Destroying xprt after cleanup all fd associated with a client 2) Before call fini for brick xlators ensure no stub should be running on a brick Change-Id: I86195785e428f57d3ef0da3e4061021fafacd435 fixes: bz#1631357 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* changetimerecorder : fix coverity issueSunny Kumar2018-10-081-0/+1
| | | | | | | | | | This patch fixes CID : 1124725 Issue : Resource leak updates: bz#789278 Change-Id: I2afe65875fa393fd2d2f90b6f7cf7f6782dabf89 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* features/bit-rot: NULL pointer deferencing clang fixSheetal Pamecha2018-10-082-5/+13
| | | | | | | | | | | Problem: local could be NULL Added condition checks to address this issue Updates: bz#1622665 Change-Id: I7be7dacc5386a77441385240b43f22d85074b69d Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
* features/compress: NULL pointer dereferencing clang fixHarpreet Lalwani2018-10-051-2/+5
| | | | | | | | | Added a Label "err" to avoid NULL pointer dereferencing Updates: bz#1622665 Change-Id: I7ec02a9cbbc482c2cf77f66e5692e86cd251cd53 Signed-off-by: Harpreet Lalwani <hlalwani@redhat.com>
* cloudsync: coverity fixSusant Palai2018-10-051-1/+1
| | | | | | | | | | | CID: 1394631 1394634 1394643 1394645 1394652 1394655 1394661 1394666 1394669 1394670 1394671 Issue: Argument cannot be negative Change-Id: Id4a9b1adcc271374971e788f161d91e8c9ac442f Updates: bz#789278 Signed-off-by: Susant Palai <spalai@redhat.com>
* mgmt/glusterd: use proper path to the volfileRaghavendra Bhat2018-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Till now, glusterd was generating the volfile path for the snapshot volume's bricks like this. /snaps/<snap name>/<brick volfile> But in reality, the path to the brick volfile for a snapshot volume is /snaps/<snap name>/<snap volume name>/<brick volfile> The above workaround was used to distinguish between a mount command used to mount the snapshot volume, and a brick of the snapshot volume, so that based on what is actually happening, glusterd can return the proper volfile (client volfile for the former and the brick volfile for the latter). But, this was causing problems for snapshot restore when brick multiplexing is enabled. Because, with brick multiplexing, it tries to find the volfile and sends GETSPEC rpc call to glusterd using the 2nd style of path i.e. /snaps/<snap name>/<snap volume name>/<brick volfile> So, when the snapshot brick (which is multiplexed) sends a GETSPEC rpc request to glusterd for obtaining the brick volume file, glusterd was returning the client volume file of the snapshot volume instead of the brick volume file. Change-Id: I28b2dfa5d9b379fe943db92c2fdfea879a6a594e fixes: bz#1635050 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* python: remove shebangs of non-main scripts and make others executableNiels de Vos2018-10-026-2/+0
| | | | | | | | | | | | | | | Some of the scripts that have a #!/usr/bin/python3 shebang do not have a main() like function. These scripts will not get executed but only imported. They do not need the shebang. A few others are not installed with 'make install', but do have a main() like function. These scripts are expected to be used by developers for different tasks (mostly code generation). Marking these scripts executable to make it easier to identify them. Change-Id: I73541471deb7e0830766b804786244e73dfe4221 Updates: #411 Signed-off-by: Niels de Vos <ndevos@redhat.com>
* index : fix coverity issues in index.cSunny Kumar2018-10-011-4/+13
| | | | | | | | This patch fixes CID 1356508 and 1356577. Change-Id: I09bc5398fbf6ee49fc066b42aaedf1170df39df8 updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* Quota related files: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}Yaniv Kaul2018-09-267-60/+104
| | | | | | | | | | | | | | In a previous patch (https://review.gluster.org/20769) we've added the key length to be passed to dict_* funcs, to remove the need to strlen() it. This patch moves some code to use it. Please review carefully. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: If4f425a9827be7c36ccfbb9761006ae824a818c6
* features/locks: NULL pointer deferencing clang fixIraj Jamali2018-09-261-3/+3
| | | | | | | | | Added checks to avoid NULL pointer dereferencing Updates: bz#1622665 Change-Id: I8e441c2931f406a6012e418127550bdf454a599a Signed-off-by: Iraj Jamali <ijamali@redhat.com>
* ctime: Provide noatime optionKotresh HR2018-09-258-9/+123
| | | | | | | | | | | | | | | | | Most of the applications are {c|m}time dependant and very few are atime dependant. So provide noatime option to not update atime when ctime feature is enabled. Also this option has to be enabled with ctime feature to avoid unnecessary self heal. Since AFR/EC reads data from single subvolume, atime is only updated in one subvolume triggering self heal. updates: bz#1593538 Change-Id: I085fb33c882296545345f5df194cde7b6cbc337e Signed-off-by: Kotresh HR <khiremat@redhat.com>
* features/marker: Avoid passing structures as parameters to functionsVijay Bellur2018-09-253-12/+15
| | | | | | | | | | | | | | | Fixes CIDs: 1388779,1390242,1390057 The patch does the following: 1. Changes the prototype of mq_inspect_file_xattr() and mq_xattr_state() to have a parameter of struct iatt * instead of struct iatt. 2. Remove unneeded struct iatt parameter from mq_inspect_directory_xattr() Change-Id: I1f6eabda042f0fe56d8c9bca010302f5e518dbe4 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* ctr: NULL pointer dereferencing clang fixSheetal Pamecha2018-09-211-1/+1
| | | | | | | | | Replaced this->name with "ctr" Updates: bz#1622665 Change-Id: I49af42a5d77c98ffb34224c8800757b8986012ea Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
* Quota: NULL pointer dereferencing clang FixHarpreet Lalwani2018-09-201-1/+2
| | | | | | | | | Added ternary operator to avoid NULL pointer dereferencing Updates: bz#1622665 Change-Id: I903ec1973fd4bb6473d16e2680bd86ac3a20e093 Signed-off-by: Harpreet Lalwani <hlalwani@redhat.com>
* glusterd: Update op-version from 4.2 to 5.0ShyamsundarR2018-09-131-2/+2
| | | | | | | | | | | | Post changing the max op-version to 4.2, after release 4.1 branching, the decision was to go with increasing release numbers. Thus this needs to change to 5.0. This commit addresses the above change. Fixes: bz#1628664 Change-Id: Ifcc0c6da90fdd51e4eceea40749511110a432cce Signed-off-by: ShyamsundarR <srangana@redhat.com>
* build: cleanup xlator link, --no-undefined, libuuidv6devKaleb S. KEITHLEY2018-09-123-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While attempting to build a (pre-)5.0 of glusterfs on Ubuntu bionic and cosmic, it became apparent that there are some gremlins hiding in the combination of the xlator export-symbols, the newish addition of -Wl,--no-undefined, and the new switch to libuuid from the old contrib/uuid. Note: even though Fedora 28 (and later) and Ubuntu bionic (and later) have the same nominal version of libtool, the Fedora version appears to do a better job of recursing through dependencies to determine the libraries to link with. Examination of the build logs showed that despite appearing to work on Fedora, not all xlators and shared libs were linked with -Wl, --no-undefined, and -luuid. And in the case of the gnfs xlator, it was not only not linked with -Wl,--no-undefined but alsos not linked with -lgfxdr and -lgfrpc. Added GF_XLATOR_LDFLAGS, similar to GF_XLATOR_DEFAULT_LDFLAGS. GF_XLATOR_DEFAULT_LDFLAGS is for xlators that export/expose the default or common set of symbols. GF_XLATOR_LDFLAGS is for those remaining xlators that export/expose non-default symbols, e.g. dht and glupy. This removes the need in the future to add things like $(UUID_LIBS) to every xlator's Makefile.am. Just add it to GF_XLATOR_LDFLAGS and GF_XLATOR_DEFAULT_LDFLAGS in configure.ac and you're done. This patch was tested on Fedora 28 (build, rpmbuild), Fedora Rawhide/30 (rpmbuild), RHEL8 (rpmbuild), CentOS7 (rpmbuild), Fedora koji --scratch build for f30/rawhide, and a Launchpad build for Ubuntu cosmic/18.10. Change-Id: Ieca104fa5c5d3c094e701c8ca4a73754dd0292b0 updates: bz#1193929 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* Land part 2 of clang-format changesGluster Ant2018-09-1274-62912/+61142
| | | | | Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4 Signed-off-by: Nigel Babu <nigelb@redhat.com>
* Land clang-format changesGluster Ant2018-09-1293-4564/+4296
| | | | Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
* misc: fix misc. shebangsKaleb S. KEITHLEY2018-09-114-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * One #!/usr/bin/env python and three #!/usr/bin/python were overlooked in all the other python fixups. Ugh. * Two new python files missed the memo about #!/usr/bin/python3. * One #!/usr/bin/env bash. Various distribution packaging policies have strong wording about the use of #!/usr/bin/env ... Note: this patch does not change the use of #!/usr/bin/env bash in the two files extras/{clang-checker.sh,check_goto.pl} as these are not included in any packages. (Although I'm not actually sure why anyone would ever use '/usr/bin/env {sh,bash}' as I'm not aware of any version-specific differences like there are with, e.g., python.) * One #!/usr/bin/bash. On Fedora and CentOS > 6, /bin is a symlink to /usr/bin, so it makes little difference. But Debian & Ubuntu still have separate /bin and /usr/bin; and sh and bash are in /bin, not /usr/bin. (Historically, in BSD and SYSV Unix it was /bin/sh.) Note: Fedora and CentOS package build runs a script that converts all /bin/sh and /bin/bash to /usr/bin/sh and /usr/bin/bash. Change-Id: I9171265829af78dd0cd7622c22b56d22179ff8a3 updates: bz#1193929 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* features/snapview-server: remove the ret variableRaghavendra Bhat2018-09-111-4/+2
| | | | | | | | Used only once to store the return value of a function. Change-Id: Ib2b9db847b5f652ce46f220297d9c7c3503eaea2 fixes: #230 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* Quota: Fix for clang issuessanoj-unnikrishnan2018-09-072-4/+5
| | | | | | Updates: bz#1193929 Change-Id: I549f741fbf97ee3fa2d63edacee5b705ef37c49a Signed-off-by: sanoj-unnikrishnan <sunnikri@redhat.com>
* features/uss: Use xxh64 to generate gfid instead of md5sumRaghavendra Manjunath2018-09-053-13/+44
| | | | | | | | | | | | | | | | * This is to ensure FIPS support * Also changed the signature of svs_uuid_generate to get xlator argument * Added xxh64 wrapper functions in common-utils to generate gfid using xxh64 - Those wrapper functions can be used by other xlators as well to generate gfids using xxh64. But as of now snapview-server is going to be the only consumer. Change-Id: Ide66573125dd74122430cccc4c4dc2a376d642a2 Updates: #230 Signed-off-by: Raghavendra Manjunath <raghavendra@redhat.com> Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* xlators: add classification flag to someAmar Tumballi2018-09-041-0/+1
| | | | | | | | | Add classification to those translators which has `xlator_api_t` already defined and used. Updates: #430 Change-Id: I9d2772cb2c4ed4ab06aaa546500cf3b7d00bddac Signed-off-by: Amar Tumballi <amarts@redhat.com>
* Multiple files: calloc -> mallocYaniv Kaul2018-09-0410-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xlators/storage/posix/src/posix-inode-fd-ops.c: xlators/storage/posix/src/posix-helpers.c: xlators/storage/bd/src/bd.c: xlators/protocol/client/src/client-lk.c: xlators/performance/quick-read/src/quick-read.c: xlators/performance/io-cache/src/page.c xlators/nfs/server/src/nfs3-helpers.c xlators/nfs/server/src/nfs-fops.c xlators/nfs/server/src/mount3udp_svc.c xlators/nfs/server/src/mount3.c xlators/mount/fuse/src/fuse-helpers.c xlators/mount/fuse/src/fuse-bridge.c xlators/mgmt/glusterd/src/glusterd-utils.c xlators/mgmt/glusterd/src/glusterd-syncop.h xlators/mgmt/glusterd/src/glusterd-snapshot.c xlators/mgmt/glusterd/src/glusterd-rpc-ops.c xlators/mgmt/glusterd/src/glusterd-replace-brick.c xlators/mgmt/glusterd/src/glusterd-op-sm.c xlators/mgmt/glusterd/src/glusterd-mgmt.c xlators/meta/src/subvolumes-dir.c xlators/meta/src/graph-dir.c xlators/features/trash/src/trash.c xlators/features/shard/src/shard.h xlators/features/shard/src/shard.c xlators/features/marker/src/marker-quota.c xlators/features/locks/src/common.c xlators/features/leases/src/leases-internal.c xlators/features/gfid-access/src/gfid-access.c xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c xlators/features/bit-rot/src/bitd/bit-rot.c xlators/features/bit-rot/src/bitd/bit-rot-scrub.c bxlators/encryption/crypt/src/metadata.c xlators/encryption/crypt/src/crypt.c xlators/performance/md-cache/src/md-cache.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible It doesn't make sense to calloc (allocate and clear) memory when the code right away fills that memory with data. It may be optimized by the compiler, or have a microscopic performance improvement. In some cases, also changed allocation size to be sizeof some struct or type instead of a pointer - easier to read. In some cases, removed redundant strlen() calls by saving the result into a variable. 1. Only done for the straightforward cases. There's room for improvement. 2. Please review carefully, especially for string allocation, with the terminating NULL string. Only compile-tested! .. and allocate memory as much as needed. xlators/nfs/server/src/mount3.c : Don't blindly allocate PATH_MAX, but strlen() the string and allocate appropriately. Also, align error messges. updates: bz#1193929 Original-Author: Yaniv Kaul <ykaul@redhat.com> Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: Ibda6f33dd180b7f7694f20a12af1e9576fe197f5
* core: python3Kaleb S. KEITHLEY2018-09-033-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see https://review.gluster.org/#/c/19788/, https://review.gluster.org/#/c/19871/, https://review.gluster.org/#/c/19952/, https://review.gluster.org/#/c/20104/, https://review.gluster.org/#/c/20162/, https://review.gluster.org/#/c/20185/, https://review.gluster.org/#/c/20207/, https://review.gluster.org/#/c/20227/, https://review.gluster.org/#/c/20307/, https://review.gluster.org/#/c/20320/, https://review.gluster.org/#/c/20332/, https://review.gluster.org/#/c/20364/, https://review.gluster.org/#/c/20441/, and https://review.gluster.org/#/c/20484 shebangs changed from /usr/bin/python2 to /usr/bin/python3. (Reminder, various distribution packaging guidelines require use of explicit python version and don't allow '#!/usr/bin/env python', regardless of how handy that idiom may be.) glusterfs.spec(.in) package python{2,3}-gluster and python2 or python3 dependencies as appropriate. configure(.ac): + test for and use python2 or python3 as appropriate. If build machine has python2 and python3, use python3. Override by setting PYTHON=/usr/bin/python2 when running configure. + PYTHONDEV_CPPFLAGS from python[23]-config --includes is a better match to the original python sysconfig.get_python_inc(). All those other extraneous flags breaks the build. + Only change the shebangs once. Changing them over and over again, e.g., during a `make glusterrpms` in extras/LinuxRPM just sends make (is it really make that's looping?) into an infinite loop. If you figure out why, let me know. + Oldest python2 is python2.6 on CentOS 6 and Debian 8 (Jessie). Everything else has 2.7 or 3.x + logic from https://review.gluster.org/c/glusterfs/+/21050, which needs to be removed/merged after that patch is merged. Builds on CentOS 6, CentOS 7, Fedora 28, Fedora rawhide, and the mysterious RHEL > 7. Change-Id: Idae21d3b6f58b32372e1daa0d234e491e563198f updates: #411 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* libgfchangelog: Fix changelog history APIKotresh HR2018-08-311-5/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: If requested start time and end time doesn't fall into first HTIME file, then history API fails even though continuous changelogs are avaiable for the requested range in other HTIME files. This is induced by changelog disable and enable which creates fresh HTIME index file. Cause and Analysis: Each HTIME index file represents the availability of continuous changelogs. If changelog is disabled and enabled, a new HTIME index file is created represents non availability of continuous changelogs. So as long as the requested start and end falls into single HTIME index file and not across, history API should succeed. But History API checks for the changelogs only in first HTIME index file and errors out if not available. Fix: Check in all HTIME index files for availability of continuous changelogs for requested change. fixes: bz#1622549 Change-Id: I80eeceb5afbd1b89f86a9dc4c320e161907d3559 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* Various files: strncpy()->sprintf(), reduce strlen()'sYaniv Kaul2018-08-313-4/+15
| | | | | | | | | | | | | | | | | | | | strncpy may not be very efficient for short strings copied into a large buffer: If the length of src is less than n, strncpy() writes additional null bytes to dest to ensure that a total of n bytes are written. Instead, use snprintf(). Check for truncated output where applicable. Also: - save the result of strlen() and re-use it when possible. - move from strlen to SLEN (sizeof() ) for const strings. Compile-tested only! Change-Id: I54e80d4f4a80e98d3775e376efe05c51af0b29eb updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>