summaryrefslogtreecommitdiffstats
path: root/xlators
Commit message (Collapse)AuthorAgeFilesLines
* crypt: fix coverity issuesBhumika Goyal2018-08-231-2/+2
| | | | | | | | Fixes CID: 130760 130759 Change-Id: I40efebd712a3bd769cb1fbc54409f1b0b35eb7b4 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* snapshot : fix snapshot status failure due to symlink problemSunny Kumar2018-08-231-1/+9
| | | | | | | | | | | | | | | | | | | | | | | Problems : 1. Snapshot status for individual snapshots were failing after OS upgrade from RHEL6 to RHEL7. 2. Post upgrade snapshot creation of cloned volume was failing. Root Cause : When OS upgrade is from RHEL6 to RHEL7 there is difference in symlink (/var/run) between these two versions. Basically when (/var/run) is symlinked to /run, mount command resolves path and mounts it. But at the same time call to those functions fails who depends on absolute path. (like strcmp in glusterd_get_mnt_entry_info) Solution : Resolve the input path to absolute path before calling these functions. Test : Tested on same setup where issue was reported. After this patch snapshot issues are completely resolved. Change-Id: I5ba57998cea614c6072709f52f42a57562018844 fixes: bz#1619843 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* coverity: Multiple coverity fixes for issues with HIGH severityShyamsundarR2018-08-221-25/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glfs-fops.c 1391414 Uninitialized pointer read List head needed initialization glusterfsd-mgmt.c graph.c 1382431 Buffer not null terminated 1382417 Dereference before null check 1382347 Buffer not null terminated Cleaned usage of volfile_checksum member of gf_volfile_t struct across the code base. glusterd-tier.c 1382426 Resource leak 1370955 Dereference before null check The function fixed needs more work, but with tier almost being deprecated, addressed some parts of the reported coverity issues as appropriate. Tested using the following test cases: ./tests/basic/tier/new-tier-cmds.t ./tests/basic/tier/tier.t ./tests/basic/tier/bug-1214222-directories_missing_after_attach_tier.t ./tests/basic/tier/tier_lookup_heal.t ./tests/basic/tier/tier-heald.t ./tests/basic/tier/tier-snapshot.t ./tests/features/glfs-lease.t Change-Id: I396f1c34bb112bb22d2745ed279e1a4850cac4af Updates: bz#789278 Signed-off-by: ShyamsundarR <srangana@redhat.com>
* xlators/playground: fix the template files with latest requirementsAmar Tumballi2018-08-223-15/+185
| | | | | | | | | | | | | | | * Make use of xlator_api * Make use of gf_msg() * Make use of mem-pool * Add a sample metrics dump function * Provide an dummy option, which can be initialized, and reconfigured * Add a test case to make sure template xlator is built and used with default fops * Make a change in rpc-coverage to run without lock tests. Updates: bz#1193929 Change-Id: I377dd67b656f440f9bc7c0098e21c0c1934e9096 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* protocol: coverity fixesBhumika Goyal2018-08-224-12/+6
| | | | | | | | Fixes CID: 1389388 1389320 1274113 1388881 1388623 1124801 1124795 Change-Id: Ia72abc0560c959b0298f42e25abdfc5523755569 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* cluster/dht: coverity fixesN Balachandran2018-08-212-12/+14
| | | | | | | | | Fixes 1133997, 1370910, 1382387, 1382444, 1394635 Change-Id: Ie63ad47abd5519b9b9536da26b61ed4c9eaf2c75 updates: bz#789278 Signed-off-by: N Balachandran <nbalacha@redhat.com>
* features/sdfs: Minor improvementsVijay Bellur2018-08-211-3/+3
| | | | | | | | | | | | | | | | Addresses: CID 1389688: Prevent op_errno from being -ve in sdfs_rename() CID 1389286: Check for retval from loc_copy() to avoid logically dead code and Initializes op_errno to ENOMEM in sdfs_link() Change-Id: I12e17a98faa5887da94a33ba9ca775e8e0fef359 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* Revert "performance/write-behind: better invalidation in readdirp"Raghavendra G2018-08-211-28/+23
| | | | | | | | | | | This reverts commit 4d3c62e71f3250f10aa0344085a5ec2d45458d5c. Traversing all children of a directory in wb_readdirp caused significant performance regression. Hence reverting this patch Change-Id: I6c3b6cee2dd2aca41d49fe55ecdc6262e7cc5f34 updates: bz#1512691 Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
* glusterd: fix gcc warningsRavishankar N2018-08-213-187/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...and also changed char array initialization to from {0,} to "". gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC) on Fedora 28. Sample warnings: glusterd-utils.c:7234:41: warning: ‘.hostname’ directive output may be truncated writing 9 bytes into a region of size between 1 and 1024 [-Wformat-truncation=] snprintf (key, sizeof (key), "%s.hostname", base_key); ^~~~~~~~~ glusterd-utils.c:7234:9: note: ‘snprintf’ output between 10 and 1033 bytes into a destination of size 1024 snprintf (key, sizeof (key), "%s.hostname", base_key); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ glusterd-snapshot.c:3090:65: warning: ‘/’ directive output may be truncated writing 1 byte into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf (snap_path, sizeof (snap_path) - 1, "%s/%s", ^ glusterd-snapshot.c:3090:17: note: ‘snprintf’ output between 2 and 4351 bytes into a destination of size 4095 snprintf (snap_path, sizeof (snap_path) - 1, "%s/%s", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ snap_mount_dir, snap_vol->snapshot->snapname); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ glusterd-statedump.c:28:45: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 144 [-Wformat-truncation=] snprintf (subkey, sizeof (subkey), "%s%d", key, index); ^~ ~~~ glusterd-statedump.c:28:9: note: ‘snprintf’ output between 2 and 4107 bytes into a destination of size 144 snprintf (subkey, sizeof (subkey), "%s%d", key, index); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ updates: bz#1193929 Change-Id: Ic721f27b28d1221c124b570e81c55528f5b7f3cd Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* xlators: protocol: Fix deferencing pointer after free coverity issuesBhumika Goyal2018-08-213-32/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | The pointer of type struct iobuf * is getting dereferenced after getting freed by iobuf_unref function. Therefore, move this function after all the dereferences of this pointer type. Also, it is useful coding standard to have iobuf_unref just after iobref_add. So, move iobref_add too. Occurences found using Coccinelle script: @@ identifier rsphdr_iobuf; expression E; identifier func; @@ *iobuf_unref(rsphdr_iobuf); ... *E = func(rsphdr_iobuf); Fixes CID: 1390517, 1390278, 1388666, 1356588, 1356587 at [1]. and also some more occurences which were found using the above script but not caught by Coverity. [1]. https://scan6.coverity.com/reports.htm#v42388/p10714/fileInstanceId=84384920&defectInstanceId=25600709&mergedDefectId=1388666 Change-Id: I579e9d12698f14e9e24bc926c6efef16bac5c06c updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* jbr : fix coverity issue in jbr.cSunny Kumar2018-08-211-0/+2
| | | | | | | | This fixes CID 1395069. Change-Id: I0d2fa8fb04adf035c358841f43dea64f6aa8a1d8 updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* write-behind: coverity fixesBhumika Goyal2018-08-201-3/+7
| | | | | | | | Fixes CID: 1124360 1291740 1370918 Change-Id: I008c7ade8f9809d040f42f6d3e9af70fff2f3dc6 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* marker: FORWARD_NULL coverity fixShwetha Acharya2018-08-201-1/+1
| | | | | | | | | | | | | | Problem: Coverity false positive. Solution: Added a comment to ignore the false positive. CID: 1325591 BUG: 789278 Change-Id: I95037efd12c059efcfc04f3c4c13f60c530150b4 Signed-off-by: Shwetha Acharya <shwetha174@gmail.com>
* quota: coverity fixesBhumika Goyal2018-08-201-6/+3
| | | | | | | | Fixes CID: 1325638 1288766 1124357 Change-Id: I425f857d0d549da2dfaa6a6e6b8440cb14c21121 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* posix: Delete the entry if gfid link creation failskarthik-us2018-08-203-14/+41
| | | | | | | | | | | | | | | Problem: If the gfid link file inside .glusterfs is not present for a file, the operations which are dependent on the gfid will fail, complaining the link file does not exists inside .glusterfs. Fix: If the link file creation fails, fail the entry creation operation and delete the original file. Change-Id: Id767511de2da46b1f45aea45cb68b98d965ac96d fixes: bz#1612037 Signed-off-by: karthik-us <ksubrahm@redhat.com>
* glusterd: fix some coverity issuesBhumika Goyal2018-08-209-17/+21
| | | | | | | | | | | Fixes CID: 1241481 1241482 1274079 1274118 1274121 1274131 1274198 1274214 1274220 1274224 1394663 1394641 382454 1382453 1382449 1288095 Link: https://scan6.coverity.com/reports.htm#v42388/p10714/fileInstanceId=84772667&defectInstanceId=25770661&mergedDefectId=744716 Change-Id: Idaf434186231c8b0fff4b27c57fa23636a89c8a7 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* gnfs: fix gcc warningsRavishankar N2018-08-203-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC) on Fedora 28. Sample warnings: 1) nfs3.c:292:54: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 143 and 250 [-Wformat-truncation=] snprintf (buf, sizeof (buf), "(%s) %s : %s", \ ^~~~~~~~~~~~~~ nfs3.c:295:35: gfid); \ ~~~~ 2) nlm4.c:145:54: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 143 and 250 [-Wformat-truncation=] snprintf (buf, sizeof (buf), "(%s) %s : %s", \ ^~~~~~~~~~~~~~ nlm4.c:148:35: gfid); \ ~~~~ acl3.c:128:54: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 143 and 250 [-Wformat-truncation=] snprintf (buf, sizeof (buf), "(%s) %s : %s", \ ^~~~~~~~~~~~~~ acl3.c:131:35: gfid); \ ~~~~ updates: bz#1193929 Change-Id: I760b8176e48f1f4628a1a98afa54a7994bdf13e9 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* snapshot/handshake: store description after strdupMohammed Rafi KC2018-08-201-3/+14
| | | | | | | | | | | | | | | problem: During a handshake, when we import a friend data snap description variable was just referenced to dictionary value. Solution: snap description should have a separate memory allocated through gf_strdup Change-Id: I94da0c57919e1228919231d1563a001362b100b8 fixes: bz#1618004 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* snapshot:Fix wrong dictionary key in snapshot cleanup codeMohammed Rafi KC2018-08-201-1/+2
| | | | | | | | | | | Snapshot was designed to support multiple volume snapshot, hence the volume name keys are labelled with volume count. So the volume key should have a volume count appended with key Change-Id: I044d73fc86db0e662dc914669aecfb82a6476fb5 fixes: bz#1618004 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* mgmt/glusterd: Code cleanup in glusterd-volgen.cVijay Bellur2018-08-191-20/+17
| | | | | | | | | | | | | | | This patch does the following: 1. Addresses CID: 1124815,124816,1124833,1291724,1325535,1325536,1357858 - by adding some null checks - by handling return values from functions - by using an appropriate buffer length in strncpy 2. Cleans up some commented code Change-Id: I5a7079f34e3e460d5a6267734c3bc84bf4ad72f5 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* snapshot:Fail snapshot creation if an empty description providedMohammed Rafi KC2018-08-191-0/+10
| | | | | | | | | | Snapshot description should have a valid string. Creating a snapshot with null value will cause reading from info file to fail with a null exception Change-Id: I9f84154b8e3e7ffefa5438807b3bb9b4e0d964ca updates: bz#1618004 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* performance/readdir-ahead: keep stats of cached dentries in sync with ↵Krutika Dhananjay2018-08-185-26/+621
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modifications PROBLEM: Stats of dentries that are readdirp'd ahead can become stale due to fops like writes, truncate etc that modify the file pointed by dentries. When a readdir is finally wound at offset corresponding to these entries, the iatts that are returned to the application come from readdir-ahead's cache, which are stale by now. This problem gets further aggravated when caching translators/modules cache and continue to serve this stale information. FIX: * Store the iatt in context of the inode pointed by dentry. * Whenever the inode pointed by dentry undergoes modification, in cbk of modification fop, update the iatt stored in inode-ctx to reflect the modification. * When serving a readdirp response from application, update iatts of dentries with the iatts stored in the context of inodes pointed by these dentries. * Some fops don't have valid iatts in their responses. For eg., write response whose data is still cached in write-behind will have zeroed out stat. In this case keep only ia_type and ia_gfid and reset rest of the iatt members to zero. - fuse-bridge in this case just sends "entry" information back to kernel and attr is not sent. - gfapi sets entry->inode to NULL and zeroes out the entire stat * There is one tiny race between the entry creation and a readdirp on its parent dir, which could cause the inode-ctx setting and inode ctx reading to happen on two different inode objects. To prevent this, when entry->inode doesn't eqaul to linked_inode, - fuse-bridge is made to send only "entry" information without attributes - gfapi sets entry->inode to NULL and zeroes out the entire stat. Change-Id: Ia27ff49a61922e88c73a1547ad8aacc9968a69df BUG: 1390050 Updates: bz#1390050 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
* debug/error-gen: Fix null deref and out of bounds read issuesVijay Bellur2018-08-181-2/+7
| | | | | | | | Addresses CID: 1124492, 1124700, 1124701 Change-Id: If9916df1b0a4e67ad74fe0f6ea6f2544598ddacb updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* block xlator: fix some coverity issuesBhumika Goyal2018-08-182-1/+6
| | | | | | | | Fixes CID: 1128916, 1128917, 1128919, 1192875 Change-Id: I5276b7db4a9650e70c335e25b9b4609a887233c0 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* features/changelog: close htime_fd in fini()Vijay Bellur2018-08-171-0/+5
| | | | | | | | Addresses CID: 1325549 Change-Id: Ib041c7c288db6810b2e13a05a19ee894a47c9b05 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* features/changelog: Fix missing unlocksVijay Bellur2018-08-172-4/+19
| | | | | | | | Addresses CID 1210981 Change-Id: Icd325588ae0639e09d924fdde171931dedd06ca6 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* locks: FORWARD_NULL coverity fixShwetha Acharya2018-08-171-1/+3
| | | | | | | | | | | | | Problem: "dst" could be NULL. Solution: Added a condition check to avoid NULL pointer dereferencing. BUG: 789278 Change-Id: I13ccf3234eda50a197f5fdfaf35b247589302582 Signed-off-by: Shwetha Acharya <shwetha174@gmail.com>
* posix: FORWARD_NULL coverity fixShwetha Acharya2018-08-171-1/+1
| | | | | | | | | | | | Problem: filler could be null. Solution: Modified the condition check to avoid NULL pointer dereferencing. BUG: 789278 Change-Id: I0c3e29ede3c226295a9860ddcb3b432832c381dd Signed-off-by: Shwetha Acharya <shwetha174@gmail.com>
* nfs-server-mount : fix coverity issues in mount3.cSunny Kumar2018-08-171-5/+9
| | | | | | | | Fixes CID 1389033, 1388767, 1288782. Change-Id: I244f88b2ca8487f8926da45d886982558ad45c7a updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* meta : fix coverity in meta-helpers.cSunny Kumar2018-08-171-13/+13
| | | | | | | | | This fixes CID 1214627 and 1257625. updates: bz#789278 Change-Id: I6eb1ccf7b498948d1c41ff830e65437ef818cd55 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* features/acl: Fix a possible null dereferenceVijay Bellur2018-08-171-2/+3
| | | | | | | | Addresses CID 1370952 Change-Id: I1f157dbede32e74e38aed8a1a162e38107f2628d updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* glusterd: coverity defects fix introduced by commit 1f3bfe7Atin Mukherjee2018-08-172-2/+2
| | | | | | | | | | | | | Commit 1f3bfe7 stripped down the total size of certain path related variables in glusterd_brickinfo_t which considered couple of new coverity defects. Fix the following: CID : 1394969 Destination buffer too small CID : 1394968 Out-of-bounds access Change-Id: Ibc30eac4680cc6c83bd89d248f1435cb6a3d1b75 updates: bz#789278 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
* jbr : fix coverity issues in jbrSunny Kumar2018-08-171-0/+6
| | | | | | | | This patch fixes CID 1357875 and 1357869. Change-Id: Ief88523e5ad92a2c884ff1b85cd613992bba0dad updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* glusterd: ignore importing volume which is undergoing a delete operationAtin Mukherjee2018-08-165-6/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem explanation: Assuming in a 3 nodes cluster, if N1 originates a delete operation and while N1's commit phase completes, either glusterd service of N2 or N3 gets disconnected from N1 (before completing the commit phase), N1 will attempt to end up importing the volume which is in-flight for a delete in other nodes as a fresh resulting into an incorrect configuration state. Fix: Mark a volume as stage deleted once a volume delete operation passes it's staging phase and reset this flag during unlock phase. Now during this intermediate phase if the same volume gets imported to other peers, it shouldn't considered to be recreated. An automated .t is quite tough to implement with the current infra. Test Case: 1. Keep creating and deleting volumes in a loop on a 3 node cluster 2. Simulate n/w failure between the peers (ifdown followed by ifup) 3. Check if output of 'gluster v list | wc -l' is same across all 3 nodes during 1 & 2. Change-Id: Ifdd5dc39699120258d7fdd42fe2deb9de25c6246 Fixes: bz#1605077 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
* build: use standard PKG_CHECK_MODULES for libxml2 availabilityNiels de Vos2018-08-161-2/+2
| | | | | | | | | | | | | In case the development parts of libxml2 are not installed, it was required to re-run ./autogen.sh to cleanup the cached values for the check. This is not nice towards users. By using the standard PKG_CHECK_MODULES for libxml-2.0 the results of the check are not cached and will be probed again when running ./configure. Change-Id: I3c4586e5555a521be5d4fb61bdb873ae0317311a Fixes: bz#1599219 Reported-by: Sachidananda Urs <surs@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com>
* trash : fix coverity issues in trash.cSunny Kumar2018-08-161-3/+6
| | | | | | | | This patch fixes CID : 1382380 and 1382428. Change-Id: Ice3c8f5c2d97a0b541665bff744f32fbea9e294f updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cluster/ec: FORWARD_NULL coverity fixSunil Kumar Acharya2018-08-162-1/+5
| | | | | | | | | | | Fixing FORWARD_NULL coverify errors with EC. CID: 1394650 BUG: 789278 Change-Id: I52c99dac3483ca31a86cd7e3a959d4010b195f32 updates: bz#789278 Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
* uss : fix coverity issuesSunny Kumar2018-08-161-2/+1
| | | | | | | | | | | | | | This patch fixes coverity issuse in snapview-server.c CID : 1274119, 1325525 Scan details at [1]. [1]. https://scan6.coverity.com/reports.htm#v42401/p10714/fileInstanceId=84476369&defectInstanceId=25631967&mergedDefectId=778645 Change-Id: I825f09eabf84a2262a079c1f920a673727c5792b updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* performance/md-cache: Use bitwise AND instead of logical ANDVijay Bellur2018-08-161-1/+1
| | | | | | | | Addresses CID: 1394640 Change-Id: I1139222301569d17760df74624acd301594063b9 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* mountbroker : fix coverity issue in glusterd-mountbroker.cSunny Kumar2018-08-151-1/+4
| | | | | | | | | Fixes CID : 1124789 updates: bz#789278 Change-Id: I61c70f05e6377d7ddc8961556274714dd356a117 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* features/changelog: Fix a resource leakVijay Bellur2018-08-151-0/+1
| | | | | | | | Fixes CID 1382359 Change-Id: Iaafbdb9a45496091327e3dc9092e09148fa9a5c5 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* glusterd: fix gcc7 warningsAmar Tumballi2018-08-142-22/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | [sh]$ gcc --version gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) Warnings were of the type below: xlators/mgmt/glusterd/src/glusterd-store.c:3285:33: warning: ‘/options’ directive output may be truncated writing 8 bytes into a region of size between 1 and 4096 [-Wformat-truncation=] snprintf (path, len, "%s/options", conf->workdir); ^~~~~~~~ xlators/mgmt/glusterd/src/glusterd-store.c:1280:39: warning: ‘/snaps/’ directive output may be truncated writing 7 bytes into a region of size between 1 and 4096 [-Wformat-truncation=] snprintf (snap_fpath, len, "%s/snaps/%s/%s", priv->workdir, ^~~~~~~ * Also changed some places where there was issues with key size * Made sure all the 'char buf[SOMESIZE] = {0,};' are changed to 'char buf[SOMESIZE] = "";` - In the files I changed * Also edited coding standard to reflect that. updates: bz#1193929 Change-Id: I04c652624ac63199cea2077e46b3a5def37c3689 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* mgmt/glusterd: Fix possible use after free in glusterd_op_ac_commit_op()Vijay Bellur2018-08-141-1/+3
| | | | | | | | Fixes CID 1391418 Change-Id: I60ce6cd3b2528369f4dc1be81c0c15a1a806982a updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* mgmt/glusterd: Fix buffer length to prevent a memory overrunVijay Bellur2018-08-141-2/+2
| | | | | | | | Fixes CID 1394647, 1394658 Change-Id: I30cf6e793919a08e0a3fe10622351b8316d7767c updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* glusterd: remove the unused databuf in rebalance structureAmar Tumballi2018-08-141-1/+0
| | | | | | | | | While it is a one line fix, it allows a significant unwanted memory being allocated for defrag structure. Updates: bz#1193929 Change-Id: Idda70d1d3dc0e7be56c35e872aa6edfaf752290d Signed-off-by: Amar Tumballi <amarts@redhat.com>
* features/shard: Fix crash and test case in RENAME fopKrutika Dhananjay2018-08-141-2/+5
| | | | | | | | | | | | | | Setting the refresh flag in inode ctx in shard_rename_src_cbk() is applicable only when the dst file exists and is sharded and has a hard link > 1 at the time of rename. But this piece of code is exercised even when dst doesn't exist. In this case, the mount crashes because local->int_inodelk.loc.inode is NULL. Change-Id: Iaf85a5ee3dff8b01a76e11972f10f2bb9dcbd407 Updates: bz#1611692 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
* cluster/dht: Fixed rebalanced filesN Balachandran2018-08-141-1/+1
| | | | | | | | | An error caused skipped files to be counted as rebalanced files. Change-Id: I02333f099fb8b73ba953f41a2922021a1e4da7be fixes: bz#1615474 Signed-off-by: N Balachandran <nbalacha@redhat.com>
* cluster/dht: fix inode ref management in dht_heal_pathSusant Palai2018-08-141-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In dht_heal_path, the inodes are created & looked up from top to down. If the path is "a/b/c", then lookup will be done on a, then b and so on. Here is a rough snippet of the function "dht_heal_path". <snippet> if (bname) { ref_count - loc.inode = create/grep inode 1 - syncop_lookup (loc.inode) - linked_inode = inode_link (loc.inode) 2 /*clean up current loc*/ - loc_wipe(&loc) 1 /*set up parent and bname for next child */ - loc.parent = inode - bname = next_child_name } out: - inode_ref (linked_inode) 2 - loc_wipe (&loc) 1 </snippet> The problem with the above code is if _bname_ is empty ie the chain lookup is done, then for the next iteration we populate loc.parent anyway. Now that bname is empty, the loc_wipe is done in the _out_ section as well. Since, the loc.parent was set to the previous inode, we lose a ref unwantedly. Now a dht_local_wipe as part of the DHT_STACK_UNWIND takes away the last ref leading to inode_destroy. This problenm is observed currently with nfs-ganesha with the nameless lookup. Post the inode_purge, gfapi does not get the new inode to link and hence, it links the inode it sent in the lookup fop, which does not have any dht related context (layout) leading to "invalid argument error" in lookup path done parallely with tar operation. test done in the following way: - create two nfs client connected with two different nfs servers. - run untar on one client and run lookup continuously on the other. - Prior to this patch, invalid arguement was seen which is fixed with the current patch. Change-Id: Ifb90c178a2f3c16604068c7da8fa562b877f5c61 fixes: bz#1610256 Signed-off-by: Susant Palai <spalai@redhat.com>
* mgmt/glusterd: Fix a memory leak in volgenVijay Bellur2018-08-141-0/+1
| | | | | | | | Fixes CID 1325557 Change-Id: I5e33ae19ddf4c44a49a2b3b3dea0c739bc96d3a7 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* All: remove memset() before sprintf()Yaniv Kaul2018-08-1419-375/+69
| | | | | | | | | | | | It's not needed. There's a good chance the compiler is smart enough to remove it anyway, but it can't hurt - I hope. Compile-tested only! Change-Id: Id7c054e146ba630227affa591007803f3046416b updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>