summaryrefslogtreecommitdiffstats
path: root/xlators
Commit message (Collapse)AuthorAgeFilesLines
...
* debug/error-gen: Prevent a possible null dereferenceVijay Bellur2018-08-241-1/+2
| | | | | | | | Addresses CID: 1124492 Change-Id: I92f807b5e45537e68c318bcbf54ccaa23d18b0dd Updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* block : fix few coverity issueSunny Kumar2018-08-243-6/+9
| | | | | | | | | Fixes 1128923, 1134020 and 1370936. updates: bz#789278 Change-Id: I2cadc09ffd0814a9390ba068006fa56704d3820d Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* features/cloudsync: Fix various resource leaksVijay Bellur2018-08-241-0/+6
| | | | | | | | Addresses CID: 1394648, 1394653 Change-Id: Ie75d4a268bba090faa5c3fe0e87f0e5cef3ff773 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* stripe: FORWARD_NULL coverity fixShwetha Acharya2018-08-241-6/+9
| | | | | | | | | | | | Problem: frame could be NULL. Solution: Added condition checks to avoid NULL pointer dereferencing. CID: 1124478, 1124501, 1124504, 1124510 BUG: 789278 Change-Id: I5c81d912102a7e672386db3fdb820f883d08666f Signed-off-by: Shwetha Acharya <shwetha174@gmail.com>
* locks: coverity fixesBhumika Goyal2018-08-241-4/+21
| | | | | | | | | | Fixes CID: 1356583 1356582 1356581 1356580 Add logs and also replace gf_log with gf_msg_debug. Change-Id: I348dc94f7a52034542d29096c12a2cf60aabe97f updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
* marker: fix for coverity issuesHari Gowtham2018-08-242-12/+15
| | | | | | | | Fixes CID: 1325591 1356503 1325540 1351704 Change-Id: I325b1184baa81402eaa009cb36ab95e5de812f6c updates: bz#789278 Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
* dht/switch: Fix coverity issuesShyamsundarR2018-08-241-4/+19
| | | | | | | | | | | | | | | | CID: 1124779: dup_childs not freed in an err path CID: 1382398: option_string leaked CID: 1382389: memcpy may cause string overflow Also, fixed up NULL termination for the string Potential use after free (or double free in this case) as below, (link split into multiple lines) https://download.gluster.org/pub/gluster/glusterfs/static-analysis/ master/glusterfs-coverity/2018-08-22-0ebaa9c6/html/ 1/427switch.c.html#error Change-Id: I76681af6a8091666918a3d5dff30a152a7b97905 Updates: bz#789278 Signed-off-by: ShyamsundarR <srangana@redhat.com>
* features/snapview-server: validate the fs instance before doing fop thereRaghavendra Bhat2018-08-243-30/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PROBLEM: ======== USS design depends on snapview-server translator communicating with each individual snapshot via gfapi. So, the snapview-server xlator maintains the glfs instance (thus the snapshot) to which a inode belongs to by storing it inside the inode context. Suppose, a file from a snapshot is opened by a application, and the fd is still valid from application's point of view (i.e. application has not yet closed fd). Now, if the snapshot to which the opened file belongs to is deleted, then the glfs_t instance corresponding to the snapshot is destroyed by snapview-server as part of snap deletion. But now, if the application does IO on the fd it has kept open, then snapview server tries to send that request to the corresponding snap via glfs instance for that snapshot stored in the inode context for the file on which the application is sending the fop. And this results in freed up glfs_t pointer being accessed and causes a segfault. FIX: === For fd based operations, check whether the glfs instance that the inode contains in its context, is still valid or not. For non fd based operations, usually lookup should guarantee that. But if the file was already looked up, and the client accessing the snap data (either NFS, or native glusterfs fuse) does not bother to send a lookup and directly sends a path based fop, then that path based fop should ensure that the fs instance is valid. Change-Id: I881be15ec46ecb51aa844d7fd41d5630f0d644fb updates: bz#1602070 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* mgmt/glusterd: Fix resource leak & unused value issues in glusterd-volume-ops.cVijay Bellur2018-08-231-0/+5
| | | | | | | | Addresses CID: 1274132, 1325534 Change-Id: I176612ef5baf5618d543838a5f32db7dcd7002c3 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* performance/write-behind: fix fulfill and readdirp raceRaghavendra G2018-08-231-33/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current invalidation of stats in wb_readdirp_cbk is prone to races. As the deleted comment explains, <snip> We cannot guarantee integrity of entry->d_stat as there are cached writes. The stat is most likely stale as it doesn't account the cached writes. However, checking for non-empty liability list here is not a fool-proof solution as there can be races like, 1. readdirp is successful on posix 2. sync of cached write is successful on posix 3. write-behind received sync response and removed the request from liability queue 4. readdirp response is processed at write-behind. In the above scenario, stat for the file is sent back in readdirp response but it is stale. </snip> The fix is to mark readdirp sessions (tracked in this patch by non-zero value of "readdirps" on parent inode) and if fulfill completes when one or more readdirp sessions are in progress, mark the inode so that wb_readdirp_cbk doesn't send iatts for that in inode in readdirp response. Note that wb_readdirp_cbk already checks for presence of a non-empty liability queue and invalidates iatt. Since the only way a liability queue can shrink is by fulfilling requests in liability queue, wb_fulfill_cbk indicates wb_readdirp_cbk that a potential race could've happened b/w readdirp and fulfill. Change-Id: I12d167bf450648baa64be1cbe1ca0fddf5379521 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> updates: bz#1512691
* glusterd: glusterd_brick_start shouldn't try to bring up brick if ↵Atin Mukherjee2018-08-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | only_connect is true With the latest refactoring in glusterd_brick_start () function in case we run into a situation where is_gf_service_running () return a valid pid which is running but doesn't belong to a gluster process, even in case of only_connect flag passed as gf_true we'd end up trying to start a brick which would cause a deadlock in brick multiplexing as both glusterd_restart_bricks () and glusterd_do_volume_quorum_action () would cause context switching with each other for the same brick. The following bt shows the same: (gdb) t a a bt Thread 8 (Thread 0x7fcced48a700 (LWP 11959)): srch_vol=srch_vol@entry=0xbe0410, comp_vol=comp_vol@entry=0xc03680, brickinfo=brickinfo@entry=0xc14ef0) at glusterd-utils.c:5834 brickinfo=0xc14ef0, volinfo=0xc03680, conf=<optimized out>) at glusterd-utils.c:5902 brickinfo=brickinfo@entry=0xc14ef0, wait=wait@entry=_gf_false, only_connect=only_connect@entry=_gf_true) at glusterd-utils.c:6251 volinfo=0xc03680, meets_quorum=_gf_true) at glusterd-server-quorum.c:402 at glusterd-server-quorum.c:443 iov=iov@entry=0x7fcce0004040, count=count@entry=1, myframe=myframe@entry=0x7fcce00023a0) at glusterd-rpc-ops.c:542 iov=0x7fcce0004040, count=1, myframe=0x7fcce00023a0, fn=0x7fccf12403d0 <__glusterd_friend_add_cbk>) at glusterd-rpc-ops.c:223 ---Type <return> to continue, or q <return> to quit--- at rpc-transport.c:538 Thread 7 (Thread 0x7fccedc8b700 (LWP 11958)): Thread 6 (Thread 0x7fccf1d67700 (LWP 11877)): brickinfo=brickinfo@entry=0xc14ef0) at glusterd-utils.c:5834 at glusterd-utils.c:6251 Thread 5 (Thread 0x7fccf2568700 (LWP 11876)): Thread 4 (Thread 0x7fccf2d69700 (LWP 11875)): Thread 3 (Thread 0x7fccf356a700 (LWP 11874)): Thread 2 (Thread 0x7fccf3d6b700 (LWP 11873)): ---Type <return> to continue, or q <return> to quit--- Thread 1 (Thread 0x7fccf68a8780 (LWP 11872)): Fix: The solution is to ensure we don't restart bricks if only_connect is true and just ensure that the brick is attempted to be connected. Test: Simulated a code change to ensure gf_is_service_running () always return to true to hit the scenario. Change-Id: Iec184e6c9e8aabef931d310f931f4d7a580f0f48 Fixes: bz#1620544 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-utils.c : re-scope message variableYaniv Kaul2018-08-231-1/+1
| | | | | | | | | | The the error message variable changed in scope - defined in a smaller scope. Compile-tested only! Change-Id: I16dda11c30099b0e448b8e44a300f153727ce8da updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-volume-ops.c : reduce size of message ↵Yaniv Kaul2018-08-231-3/+3
| | | | | | | | | | | | | variable Size of error message variable reduced from 2048 bytes to 64 bytes or 128 bytes. Compile-tested only! Change-Id: I393ba03969a6e71ccb0ce382d0e0546192897312 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c : declare err_str as ↵Yaniv Kaul2018-08-231-15/+5
| | | | | | | | | | | | const char declare err_str as const char and intialize it at the time of declaration. Compile-tested only! Change-Id: If07e1130e819ce042905a2d0be650cd7afc2b558 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-replace-brick.c : reduce size of message ↵Yaniv Kaul2018-08-231-1/+1
| | | | | | | | | | | | variable Size of error message variable reduced from 2048 bytes to 256 bytes. Compile-tested only! Change-Id: Ifc0f6af2256bcbec77102767ba651d5d55f8c906 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-volgen.c : reduce size of message variableYaniv Kaul2018-08-231-1/+1
| | | | | | | | | | Size of error message variable reduced from 4096 bytes to 128 bytes. Compile-tested only! Change-Id: I08c87502be791e68ab767ed96657ac89ee77fae0 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* mgmt/glusterd: Fix memory leaks in glusterd-handler.cVijay Bellur2018-08-231-1/+2
| | | | | | | | | | | | Addresses the following CIDs: 1370941: Unconditional memory leak in glusterd_print_snapinfo_by_vol() 1370943: Memory leak when opendir fails for output directory in glusterd_get_state() Change-Id: I9536841629e1ffe1fed79a8e57d266a0e953e5af updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* storage/posix: Increment trusted.pgfid in posix_mknodN Balachandran2018-08-231-4/+14
| | | | | | | | | | The value of trusted.pgfid.xx was always set to 1 in posix_mknod. This is incorrect if posix_mknod calls posix_create_link_if_gfid_exists. Change-Id: Ibe87ca6f155846b9a7c7abbfb1eb8b6a99a5eb68 fixes: bz#1619720 Signed-off-by: N Balachandran <nbalacha@redhat.com>
* afr: common thin-arbiter functionsRavishankar N2018-08-236-12/+173
| | | | | | | | | | | | | | ...that can be used by client and self-heal daemon, namely: afr_ta_post_op_lock() afr_ta_post_op_unlock() Note: These are not yet consumed. They will be used in the write txn changes patch which will introduce 2 domain locking. updates: bz#1579788 Change-Id: I636d50f8fde00736665060e8f9ee4510d5f38795 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-rpc-ops.c : re-scope message variableYaniv Kaul2018-08-231-2/+2
| | | | | | | | | | | The error and/or message variable was changed in scope: defined in a smaller scope. Compile-tested only! Change-Id: I5e46a1992ad35a996aa8ee58da28606ac018ab8e updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-handshake.c : reduce size or re-scope ↵Yaniv Kaul2018-08-231-2/+2
| | | | | | | | | | | | | | | message variable The the error and/or message variable was either: - Reduced in size - from 2048 bytes to 64 bytes, for example. or - Changed in scope - defined in a smaller scope. Compile-tested only! Change-Id: I9c609415667844ee034b7eb2b67bdbc19d38819d updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-handler.c : reduce size or re-scope ↵Yaniv Kaul2018-08-231-23/+19
| | | | | | | | | | | | | | | message variable The the error and/or message variable was either: - Reduced in size - from 2048 bytes to 64 bytes, for example. or - Changed in scope - defined in a smaller scope. Compile-tested only! Change-Id: Iebb92a56d9d0ca53c80d75866bcb7848e08cf6b2 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-geo-rep.c : reduce size of message variableYaniv Kaul2018-08-231-3/+3
| | | | | | | | | | Size of error message variable reduced from 2048 bytes to 64 bytes. Compile-tested only! Change-Id: I65abd9c4f23a64ac9cda5373aff4119458addbc8 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-brick-ops.c : reduce size or re-scope ↵Yaniv Kaul2018-08-231-4/+3
| | | | | | | | | | | | | | | message variable The the error and/or message variable was either: - Reduced in size - from 2048 bytes to 64 bytes, for example. or - Changed in scope - defined in a smaller scope. Compile-tested only! Change-Id: Ib74e5f8f4c2978f670d4708e9382e97edf5df0a7 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* xlators/mgmt/glusterd/src/glusterd-bitrot.c : reduce size of message variableYaniv Kaul2018-08-231-1/+1
| | | | | | | | | | Size of error message variable reduced from 2048 bytes to 256 bytes. Compile-tested only! Change-Id: Ib536451d9b562f932132b99c4eff21fc4f2775bc updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* features/changelog: Fix a file handle leak in htime_create()Vijay Bellur2018-08-231-2/+7
| | | | | | | | | In a few error scenarios, ht_file_hd was not being cleaned up. Addresses CID: 1325549 Change-Id: If9b4388aa700303c1eebbf1410dc35d18c4637df updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* snapview/server: Set uid,gid,and groups for gfapi callMohammed Rafi KC2018-08-231-1/+131
| | | | | | | | | | Before calling gfapi from snapd, we need to set uid, gid and groups in the context. This is required to do the validation from posix acl xlator. Change-Id: I181bea2570a69554ff363bf5a52478ff0363ea47 fixes: bz#1614168 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* mgmt/glusterd: Fix resource leaks in glusterd-handshake.cVijay Bellur2018-08-231-4/+16
| | | | | | | | | | | | | Addresses the following CIDs: 1124768: fd leak in __server_getspec() if spec_fd happens to be 0 1202400: Memory leak in get_snap_volname_and_volinfo() 1214622: Memory leak in glusterd_create_missed_snap() 1214623: Memory leak in an error path of __server_get_volume_info() Change-Id: I33910b4125d25205e76e0d13cf0256d47bd8fc3c updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* features/leases: Initialize op_errno in leases_open()Vijay Bellur2018-08-231-2/+1
| | | | | | | | | Addresses CID: 1356483 by getting rid of an unessential assignment for op_errno Change-Id: I2327ac17b2875b4dd5f79b76be59e2c8e570b031 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* mgmt/glusterd: Fix memory leaks in glusterd-op-sm.cVijay Bellur2018-08-231-13/+5
| | | | | | | | | | | | | | | | | | | | | Addresses the following CIDs: - 1124704: Removed an unessential variable that caused a memory leak in glusterd_op_set_volume(). Nuked an unnecessary log message upon error as well since failure logging is being done in the caller - 1124772: Memory leak in an error path of glusterd_op_ac_send_brick_op() - 1175021: Removed an unessential variable that caused a memory leak in glusterd_op_build_payload() Also addressed a memory leak in an error path of glusterd_dict_set_volid() Change-Id: I060effbbcebe9d58b91f606175080ede517ba239 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* 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>