summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* posix-acl: skip acl_permits check when the owner setting GF_POSIX_ACL_xxxxKinglong Mee2018-08-273-9/+127
| | | | | | Change-Id: Iaeea470d040587027f37e0760ae27c4fc205a189 fixes: bz#1613098 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com>
* ctr: skip ctr xlator init if ctr is not enabledMohit Agrawal2018-08-273-80/+120
| | | | | | | | | | | | Problem: If ctr xlator is not required it consumes resources unnecessarily Solution: Call ctr xlator init only while feature is enabled Fixes: bz#1524323 Change-Id: I378113a390a286be20c4ade1b1bac170a8ef1b14 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* cli : fix coverity cli-rl.cSunny Kumar2018-08-271-1/+1
| | | | | | | | | | This fixes new coverity issue introduced by commit 5acb74d7da. Fixes 1395188. Change-Id: I629e5f214150672e309abb2fc58f55f1f58d8fb7 updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* tests: Preserve tarball of tests when they timeoutShyamsundarR2018-08-272-34/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When tests timeout, the timeout command sends TERM signal to the command being executed. In the case of run-tests.sh it invokes prove, which further invokes perl and finally the test is run using bash. The TERM signal does not seem to be reachnig the end bash that is actually executing the tests, and hence when any test is terminated due to a timeout, the cleanup routine in include.rc does not get a chance to run and preserve the tarball. Further, cleanup invokes tarball generation, but is invoked at the beginning and end of every test, and at times in beteween as well. This caused way too many tarballs in case we decide to preserve the same whenever generated by cleanup. This patch hence moves the tarball generation to run-tests.sh instead, and further stores them named <test>-iteration-<n>.tar and also prints tarball name generated and stored per iteration. This should help relate failed runs to the tarball iteration # and to look at relevant logs. Further the patch also provides a -p option to run-tests.sh for unit testing purposes, where running a test in a loop without the option will generate as many tarballs, and using the option will reduce this to preserving the last tarball, saving space in smaller unit test setups. Fixes: bz#1614062 Change-Id: I0aee76c89df0691cf4d0c1fcd4c04dffe0d7c896 Signed-off-by: ShyamsundarR <srangana@redhat.com>
* mgmt/glusterd: Coverity fixes in glusterd-utils.cVijay Bellur2018-08-271-3/+19
| | | | | | | | | | | | | | | Addresses the following CIDs: 1388821: Unchecked return value from sys_lremovexattr() in glusterd_check_and_set_brick_xattr() 1370957: Unused return value in glusterd_volume_tier_use_rsp_dict() 1370950: Memory leak in glusterd_get_global_options_for_all_vols() 1370946: Redundant gf_strdup() leading to a memory leak in glusterd_get_global_options_for_all_vols() Change-Id: I2ab58207bc43b40f004ee18463430a141126bf94 Updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* storage/posix: Coverity fixes in posix-handle.cVijay Bellur2018-08-251-5/+12
| | | | | | | | | | | Addresses the following CIDs: 1370938: Out of bounds write in posix_make_ancestryfromgfid() 1351642: UnChecked return value from sys_stat() in posix_handle_init() Change-Id: I3483ebcd798793ce6c504e92b4ea203bcf99fc0e Updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* multiple files: move from strlen() to sizeof()Yaniv Kaul2018-08-255-8/+11
| | | | | | | | | | | | {ec-heal|ec-combine|ec-helpers|ec-inode-read}.c For const strings, just do compile time size calc instead of runtime. Compile-tested only! Change-Id: If92ba0a7a20f64b898d01c6e3b6708190ca93e04 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* extras/geo-rep/gsync-sync-gfid.c: move from strlen() to sizeof()Yaniv Kaul2018-08-251-4/+5
| | | | | | | | | | For const strings, just do compile-time size calc instead of runtime. Compile-tested only! Change-Id: I89470016389a4ecb3bed35a1c9e684f5fae79997 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* {mount-common|fusermount|mount_darwin|umountd}.c: strncpy()->sprintf(), ↵Yaniv Kaul2018-08-244-5/+7
| | | | | | | | | | | | | | | | | | | | | reduce strlen()'s 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(). 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: I369209b36d8356c3fe00d32f8bf56e74cf9963db updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* {cli-cmd-parser|cli-rpc-ops||cli-xml-output}.c: strncpy()->sprintf(), reduce ↵Yaniv Kaul2018-08-243-24/+31
| | | | | | | | | | | | | | | | | | | | | | strlen()'s 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(). Also: - save the result of strlen() and re-use it when possible. - move from GF_CALLOC() to GF_MALLOC() for the strings. - move from strlen to sizeof() for const strings. Compile-tested only! Change-Id: I3cf49c5401ee100a5db6a4954c3d699ec1814c17 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glfs-fops.c, glfs.c: strncpy() -> sprintf(), reduce strlen()'sYaniv Kaul2018-08-242-6/+6
| | | | | | | | | | | | | | | | | 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(). Also, save the result of strlen() and re-use it when possible. Compile-tested only! Change-Id: I4ecfb359cf0efaafeab245a8138f526b21613231 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* cli : fix few coverity in cliSunny Kumar2018-08-242-4/+6
| | | | | | | | | | This patch fixes DEADCODE and FORWARD_NULL. CID : 1124495, 1124380, 1124381 Change-Id: I79992e396dbcb1bfe6cd0614d49a8da3f67d648d updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* 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>
* libglusterfs/src/iobuf.c: remove memset(), CALLOC -> MALLOCYaniv Kaul2018-08-241-6/+1
| | | | | | | | | | | | I'm not sure I see the need for those memset(), I've removed them. There's at least one easy to convert CALLOC to MALLOC - converted. Only compile-tested! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: Ia019775ad5255190f5d02d948ea27db7f563387d
* 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-244-30/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* rpc/rpc-lib/src/rpc-clnt-ping.c:move to GF_MALLOC() instead of GF_CALLOC() whenYaniv Kaul2018-08-231-1/+1
| | | | | | | | | | | | | | | | 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. Please review carefully, especially for string allocation, with the terminating NULL string. Only compile-tested! Change-Id: Ifb30412ddf1bfa509f52e0454454929b266e5658 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>
* cli/src/cli-cmd-parser.c:move to GF_MALLOC() instead of GF_CALLOC() whenYaniv Kaul2018-08-231-1/+1
| | | | | | | | | | | | | | | | 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. Please review carefully, especially for string allocation, with the terminating NULL string. Only compile-tested! Change-Id: I01c67fd535ea4a2b8fa7cb4d89bff52642dc009a updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* storage/posix: Increment trusted.pgfid in posix_mknodN Balachandran2018-08-232-4/+71
| | | | | | | | | | 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>
* glusterfind: Fix problems in python2 -> python3 compatKotresh HR2018-08-234-7/+7
| | | | | | | | | 1. Import configparser module correctly 2. Fix issues with urllib usage Updates: #411 Change-Id: I060af29f1ebac3a5e2aeeee2720b7372d4c31697 Signed-off-by: Kotresh HR <khiremat@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-224-37/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* libglusterfs/src/common-utils.c: Move to GF_MALLOC() instead of GF_CALLOC() ↵Yaniv Kaul2018-08-221-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | 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! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I579f5b405bf410aac5ab0452231124d354f94ed1