summaryrefslogtreecommitdiffstats
path: root/cli
Commit message (Collapse)AuthorAgeFilesLines
* rpc/transport: Missing a ref on dict while creating transport objectMohammed Rafi KC2019-03-201-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | while creating rpc_tranpsort object, we store a dictionary without taking a ref on dict but it does an unref during the cleaning of the transport object. So the rpc layer expect the caller to take a ref on the dictionary before passing dict to rpc layer. This leads to a lot of confusion across the code base and leads to ref leaks. Semantically, this is not correct. It is the rpc layer responsibility to take a ref when storing it, and free during the cleanup. I'm listing down the total issues or leaks across the code base because of this confusion. These issues are currently present in the upstream master. 1) changelog_rpc_client_init 2) quota_enforcer_init 3) rpcsvc_create_listeners : when there are two transport, like tcp,rdma. 4) quotad_aggregator_init 5) glusterd: init 6) nfs3_init_state 7) server: init 8) client:init This patch does the cleanup according to the semantics. Change-Id: I46373af9630373eb375ee6de0e6f2bbe2a677425 updates: bz#1659708 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* inode: don't dump the whole table to CLIAmar Tumballi2019-03-201-0/+22
| | | | | | | | | | | dumping the whole inode table detail to screen doesn't solve any purpose. We should be getting only toplevel details on CLI, and then if one wants to debug further, then they need to get to 'statedump' to get full details. Fixes: bz#1580315 Change-Id: Iaf3de94602f9c76832c3c918ffe2ad13c0b0e448 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* geo-rep: IPv6 supportAravinda VK2019-03-152-0/+12
| | | | | | | | | | | | | `address_family=inet6` needs to be added while mounting master and slave volumes in gverify script. New option introduced to gluster cli(`--inet6`) which will be used internally by geo-rep while calling `gluster volume info --remote-host=<ipv6>`. Fixes: bz#1688833 Change-Id: I1e0d42cae07158df043e64a2f991882d8c897837 Signed-off-by: Aravinda VK <avishwan@redhat.com>
* cli : fix mem leak during cli_cmd_volume_gsync_set_cbkSunny Kumar2019-02-191-20/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes mem-leak due to excessive use of gf_asprintf to form dynamic growing string. Problem: each call to asprintf/vsprintf for extending existing string causes a memory leak, because the blob at the original address of existing string is not freed and a new location is generated by asprintf. Tracebacks: #2 0x7fdf191b8b3b in gf_vasprintf ../libglusterfs/src/mem-pool.c:236 #3 0x7fdf191b8d0a in gf_asprintf ../libglusterfs/src/mem-pool.c:256 #4 0x420cd3 in cli_cmd_volume_gsync_set_cbk ../cli/src/cli-cmd-volume.c:2576 SUMMARY: AddressSanitizer: 255 byte(s) leaked in 3 allocation(s). .... SUMMARY: AddressSanitizer: 431 byte(s) leaked in 4 allocation(s). .... SUMMARY: AddressSanitizer: 449 byte(s) leaked in 4 allocation(s). .... SUMMARY: AddressSanitizer: 397 byte(s) leaked in 4 allocation(s). .... SUMMARY: AddressSanitizer: 160 byte(s) leaked in 2 allocation(s). .... updates: bz#1633930 Change-Id: I7e8902f0ed23e640dc17e3dcbdab7ae0579d2dc6 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* socket: socket event handlers now return voidMilind Changire2019-02-181-2/+2
| | | | | | | | | | | | | | Problem: Returning any value from socket event handlers to the event sub-system doesn't make sense since event sub-system cannot handle socket sub-system errors. Solution: Change return type of all socket event handlers to 'void' Change-Id: I70dc2c57f12b7ea2fae41120f71aa0d7fe0b2b6f Fixes: bz#1651246 Signed-off-by: Milind Changire <mchangir@redhat.com>
* cli: Added the group option for volume setRinku Kothiya2019-02-041-0/+5
| | | | | | | | | | | gluster volume set <VOLUME> group <GROUP> is used for setting multiple pre-defined volume options, but this was undocumented. This patch doc- ments this feature. fixes: bz#1243991 Change-Id: Id346cf2537f85179caff32479f09555ce2e72e76 Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
* cli: Added a welcome and help messageRinku Kothiya2019-01-212-0/+6
| | | | | | | | | | When gluster command is fired without any arguments it just shows the prompt, so added a welcome message and info to get help. fixes: bz#1535528 Change-Id: I627b66b67443716e9270025c1e47b98b6facba13 Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
* core: Feature added to accept CidrIp in auth.allowRinku Kothiya2019-01-182-4/+4
| | | | | | | | | | | | | | | Added functionality to gluster volume set auth.allow command to accept CIDR IP addresses. Modified few functions to isolate cidr feature so that it prevents other gluster commands such as peer probe to use cidr format ip. The functions are modified in such a way that they have an option to enable accepting of cidr format for other gluster commands if required in furture. updates: bz#1138841 Change-Id: Ie6734002a7078f1820e5df42d404411cce945e8b Credits: Mohit Agrawal Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
* libglusterfs/src/mem-types.h: remove unused common enums from mem-types.hYaniv Kaul2018-12-301-8/+1
| | | | | | | | | | | | | | | | | They were not used at all, just taking space. I've also marked all those that are not common really, but used in just one place - they probably should move there (in follow-up patches) As a test, I've removed from the stripe xlator unused private enums and moved one that was in the common list, but only used in the stripe code, to be a private enum. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I1158dc1d259f1fd3f69904336c46c9d83cea799f
* cli: fix memory leakSunny Kumar2018-12-261-23/+72
| | | | | | | | This patch fixes memory leak in cli/src/cli.c. Change-Id: I4956c4180b34d4a9e3e6e60eeafba8cb2031896e updates: bz#1633930 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: variable-length array declaration clang fixSheetal Pamecha2018-12-141-2/+5
| | | | | | | | | | | Problem: Declared variable-length array can have zero size Added a goto statement to address this issue. Updates: bz#1622665 Change-Id: Ibf80643490367a5f7e50f66f87e4296380be45de Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
* cli : fix memory leak in cli-cmd-volume.cSunny Kumar2018-12-101-6/+6
| | | | | | | | | | | | | | | | | | | This patch fixes ememory leak reported by ASan. Tracebacks: Direct leak of 84 byte(s) in 1 object(s) allocated from: #0 0x7f71ea107848 in __interceptor_malloc (/lib64/libasan.so.5+0xef848) #1 0x7f71e9e2ac49 in __gf_malloc ./libglusterfs/src/mem-pool.c:136 #2 0x7f71e9e2b4bb in gf_vasprintf ./libglusterfs/src/mem-pool.c:236 #3 0x7f71e9e2b68a in gf_asprintf ./libglusterfs/src/mem-pool.c:256 #4 0x41e8ec in cli_cmd_bitrot_cbk ./cli/src/cli-cmd-volume.c:1847 #5 0x410b39 in cli_cmd_process ./cli/src/cli-cmd.c:137 #6 0x40fe9d in cli_batch ./cli/src/input.c:29 #7 0x7f71e989558d in start_thread (/lib64/libpthread.so.0+0x858d) updates: bz#1633930 Change-Id: I8977e45add742e67047291f398f0ee79eb09afe4 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: fix memory leak in cli rpc opsMohit Agrawal2018-12-071-0/+4
| | | | | | | | | | | | | Problem: In some of the cli fops dict_allocate_and_serialize allocate memory for req structure but after submit request it missed to cleanup memory fo req.dict.dict_val Solution: Call GF_FREE for req.dict.dict_val after submit cli request Change-Id: I76c6b3082fa0be21dc595f87701550a318734ea5 updates: bz#1633930 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* cli: fix a memory leak reported by ASan.Rinku Kothiya2018-12-061-0/+2
| | | | | | | | | | | Fixed a leak in cli_cmd_volume_remove_brick_cbk. SUMMARY: AddressSanitizer: 1152 byte(s) leaked in 8 allocation(s) updates: bz#1633930 Credits: Mohit Agrawal Change-Id: Idb59c3880329fde59c415c84d7f0bb09ae879a1a Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
* cli: Fix mem-leaks reported by ASANKotresh HR2018-12-061-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Tracebacks: Direct leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7f3acf9eac48 in malloc (/lib64/libasan.so.5+0xeec48) #1 0x7f3acf510949 in __gf_malloc ./libglusterfs/src/mem-pool.c:136 #2 0x7f3acf5111bb in gf_vasprintf ./libglusterfs/src/mem-pool.c:236 #3 0x7f3acf51138a in gf_asprintf ./libglusterfs/src/mem-pool.c:256 #4 0x421611 in cli_cmd_volume_set_cbk ./cli/src/cli-cmd-volume.c:868 #5 0x410599 in cli_cmd_process ./cli/src/cli-cmd.c:135 #6 0x40f90d in cli_batch ./cli/src/input.c:29 #7 0x7f3acd78c593 in start_thread pthread_create.c:463 Direct leak of 73 byte(s) in 1 object(s) allocated from: #0 0x7f3acf9eac48 in malloc (/lib64/libasan.so.5+0xeec48) #1 0x7f3acf510949 in __gf_malloc ./libglusterfs/src/mem-pool.c:136 #2 0x421519 in gf_strndup ../../libglusterfs/src/mem-pool.h:167 #3 0x421519 in gf_strdup ../../libglusterfs/src/mem-pool.h:184 #4 0x421519 in cli_cmd_volume_set_cbk cli/src/cli-cmd-volume.c:859 #5 0x410599 in cli_cmd_process cli/src/cli-cmd.c:135 #6 0x40f90d in cli_batch cli/src/input.c:29 #7 0x7f3acd78c593 in start_thread pthread_create.c:463 Change-Id: I3312751c1e3178672360a678fe15b1f7f1054b22 updates: bz#1633930 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* cli: memory leak issue reported by asanRinku Kothiya2018-12-051-0/+2
| | | | | | | | | | This patch fixes dict leak in cli_cmd_volume_stop_cbk. SUMMARY: AddressSanitizer: 640 byte(s) leaked in 4 allocation(s) Credits: Mohit Agrawal Change-Id: If14983b8588e68d16d6bbb04b87e2f06fb97023d fixes: bz#1633930 Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
* libglusterfs: Move devel headers under glusterfs directoryShyamsundarR2018-12-0512-43/+43
| | | | | | | | | | | | | | | | | | | | | | | | libglusterfs devel package headers are referenced in code using include semantics for a program, this while it works can be better especially when dealing with out of tree xlator builds or in general out of tree devel package usage. Towards this, the following changes are done, - moved all devel headers under a glusterfs directory - Included these headers using system header notation <> in all code outside of libglusterfs - Included these headers using own program notation "" within libglusterfs This change although big, is just moving around the headers and making it correct when including these headers from other sources. This helps us correctly include libglusterfs includes without namespace conflicts. Change-Id: Id2a98854e671a7ee5d73be44da5ba1a74252423b Updates: bz#1193929 Signed-off-by: ShyamsundarR <srangana@redhat.com>
* cli: fix memory leak in cli/src/cli-rpc-ops.cSunny Kumar2018-12-051-0/+3
| | | | | | | | | | | | This Patch fixes memory leak reported by ASan. Leaks are in gf_cli_status_cbk as a result of allocatating memory using gf_asprintf in loop. SUMMARY: AddressSanitizer: 535 byte(s) leaked in 7 allocation(s). Change-Id: If2fd76c7c1ea6fc44baca295050800074f9d1323 updates: bz#1633930 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: memory leak issue reported by asanHarpreet kaur2018-12-051-0/+4
| | | | | | | | | | | | This patch fixes Indirect leaks in cli-cmd-volume.c Leaks are happening in cli_cmd_quota_cbk and cli_cmd_quota_handle_list_all. SUMMARY: AddressSanitizer: 1152 byte(s) leaked in 8 allocation(s) Updates: bz#1633930 Change-Id: Ia6c0306e88bd81f74d1220303ead8095fbcf5623 Signed-off-by: Harpreet kaur <hlalwani@redhat.com>
* cli: fix memory leak in cli-cmd-system.cSunny Kumar2018-12-051-4/+11
| | | | | | | | | | This patch fixes memory leak reported by ASan. SUMMARY: AddressSanitizer: 384 byte(s) leaked in 2 allocation(s). updates: bz#1633930 Change-Id: I93ebddcfeea3d51547e00775db2c9d99f5dfafea Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: "usage()" and "--help" for gluster cliHarpreet Kaur Lalwani2018-12-043-3/+33
| | | | | | | | | | | Added a usage message which will be shown when a user enters an "unrecognized word" or an "unrecognized command" on the cli. Also added a "--help" option for gluster cli. fixes: bz#1535495 Change-Id: Ibcfb3d1c84daa1054e09c5cdfa6a5dab19f534a6 Signed-off-by: Harpreet Kaur Lalwani <hlalwani@redhat.com>
* cli : Memeory leak fix reported by ASANSunny Kumar2018-12-031-0/+22
| | | | | | | | | | | | | This patch fixes memory leak in cli-rpc-ops.c. Functions: gf_cli_create_volume_cbk, gf_cli_delete_volume_cbk, gf_cli_start_volume_cbk, gf_cli_remove_tier_brick_cbk, gf_cli_list_volume_cbk. updates: bz#1633930 Change-Id: I68a650fb972db18c90e6581a960eae3018f32d40 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: memory leak issue reported by asanHarpreet Lalwani2018-12-031-0/+3
| | | | | | | | | | | This patch fixes Indirect leaks in tests/bugs/heal-symlinks.t. Leaks are happening in cli_cmd_volume_heal_cbk. SUMMARY: AddressSanitizer: 640 byte(s) leaked in 4 allocation(s). Updates: bz#1633930 Change-Id: I970b4229630fdaf01aec66581c1287beef7560a3 Signed-off-by: Harpreet Lalwani <hlalwani@redhat.com>
* cli : Memeory leak fix reported by ASANSunny Kumar2018-12-021-0/+3
| | | | | | | | | | | | This patch fixes memory leak in cli-rpc-ops.c. All leaks are happening in gf_cli_remove_brick_cbk. SUMMARY: AddressSanitizer: 2944 byte(s) leaked in 22 allocation(s). updates: bz#1633930 Change-Id: I1e58d538eb9135f1aadcdb54d10b72f55e8a53d1 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* rpcsvc: provide each request handler thread its own queueRaghavendra Gowdappa2018-11-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A single global per program queue is contended by all request handler threads and event threads. This can lead to high contention. So, reduce the contention by providing each request handler thread its own private queue. Thanks to "Manoj Pillai"<mpillai@redhat.com> for the idea of pairing a single queue with a fixed request-handler-thread and event-thread, which brought down the performance regression due to overhead of queuing significantly. Thanks to "Xavi Hernandez"<xhernandez@redhat.com> for discussion on how to communicate the event-thread death to request-handler-thread. Thanks to "Karan Sandha"<ksandha@redhat.com> for voluntarily running the perf benchmarks to qualify that performance regression introduced by ping-timer-fixes is fixed with this patch and patiently running many iterations of regression tests while RCAing the issue. Thanks to "Milind Changire"<mchangir@redhat.com> for patiently running the many iterations of perf benchmarking tests while RCAing the regression caused by ping-timer-expiry fixes. Change-Id: I578c3fc67713f4234bd3abbec5d3fbba19059ea5 Fixes: bz#1644629 Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
* geo-rep: Geo-rep help text issueShwetha K Acharya2018-11-271-4/+6
| | | | | | | | Modified Geo-rep help text for better sanity. Change-Id: I48f4d0fd60c1ffcde753b37416e0c73afd0b5702 fixes: bz#1652887 Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
* glfsheal: add a '--nolog' flagRavishankar N2018-11-263-3/+11
| | | | | | | | | | | | | | | | | | | | | ....and if set, change the log level to GF_LOG_NONE. This is useful for monitoring applications which invoke the heal info set of commands once every minute, leading to un-necessary glfsheal* logs in /var/log/glusterfs/. For example, we can now run `gluster volume heal <VOLNAME> info --nolog` `gluster volume heal <VOLNAME> info split-brain --nolog` etc. The default log level is still retained at GF_LOG_INFO. The patch also changes glfsheal internally to accept '--xml' instead of 'xml'. Note: The --nolog flag is *not* displayed in the help anywhere, for the sake of consistency in how the other flags are not displayed anywhere in the help. fixes: bz#1643519 Change-Id: Ia08b6aa6e4a0548379db7e313dd4411ebc66f206 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* geo-rep: validate the config checkpoint date formatShwetha Acharya2018-11-221-1/+1
| | | | | | | | Added a strlen check to ensure that the format is (Y-m-d H:M:S). Change-Id: I8844aaa33418d43ffe2320c4a05eb1eddd306903 updates: bz#1651584 Signed-off-by: Shwetha Acharya <sacharya@gmail.com>
* cli : fix coverity issue in cli-xml-output.cSunny Kumar2018-11-181-0/+10
| | | | | | | | This patch fixes 1124659, 1241480 and 1274196. Change-Id: Ib89f53b8e34fcc47184d08ad57f2ee32fd00d78c updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: avoid unnecessary strtail for geo rep config.Ravishankar N2018-11-111-20/+20
| | | | | | | | | | Found while looking at this function for another patch. Compile Tested Only! Updates bz#1193929 Change-Id: I46a9e95bf4d6609bc122edf86418659369258abe Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* cli: add a warning/confirmation message in peer detach code pathAtin Mukherjee2018-11-091-1/+13
| | | | | | | | | | | | | | | | | On a multi node cluster if one of the node is detached which had active clients mounted through the same server address, this can cause all the clients to loose any volfile changes. This is due to the lack of infra in glusterd to let client know the list of IPs and attempt to connect to other active nodes as failback. Such framework does exist in GD2 but not in GD1. This patch ensures to take a preventive measure to have a warning message thrown to user to ensure all such connected clients are remounted through a different IP. Change-Id: I740b01868abbd75bf0a609cfaf00114d4d78aa96 Fixes: bz#1647074 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
* all: fix the format string exceptionsAmar Tumballi2018-11-051-1/+1
| | | | | | | | | | | | | | | | 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>
* stripe: remove the translator from build and glusterdAmar Tumballi2018-10-312-77/+7
| | | | | | | | | | | | | | | | Based on the proposal to remove few features as they are not actively maintained [1], removing stripe translator from the build. Also make sure there are no regression tests involving stripe translator. [1] https://lists.gluster.org/pipermail/gluster-users/2018-July/034400.html Note that this patch aims at removing the translator from build, and a followup patch is needed to remove the code from repository. Updates: bz#1364707 Change-Id: I235b305338f138e29e9f30cba65bc0dadbebbbd5 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* cluster/ec : Prevent volume create without redundant brickSunil Kumar Acharya2018-10-241-3/+3
| | | | | | | | | | | | | Problem: EC volumes can be created without any redundant brick. Solution: Updated the conditional check to avoid volume create without redundant brick. fixes: bz#1642448 Change-Id: I0cb334b1b9378d67fcb8abf793dbe312c3179c0b Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
* glusterd: set integer instead of stringSanju Rakonde2018-10-241-2/+2
| | | | | | | | | | | | | | dict_get_str_boolean expects a integer, so we need to set all the boolean variables as integers to avoid log messages like below: [2018-09-10 03:55:19.236387] I [dict.c:2838:dict_get_str_boolean] (-->/usr/local/lib/libgfrpc.so.0(rpc_clnt_reconnect+0xc2) [0x7ff7a83d0452] -->/usr/local/lib/glusterfs/4.2dev/rpc-transport/socket.so(+0x65b0) [0x7ff7a06cf5b0] -->/usr/local/lib/libglusterfs.so.0(dict_get_str_boolean+0xcf) [0x7ff7a85fc58f] ) 0-dict: key transport.socket.ignore-enoent, integer type asked, has string type [Invalid argument] This patch addresses all such instances in glusterd. Change-Id: I7e1979fcf381363943f4d09b94c3901c403727da updates: bz#1193929 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* cli: Fix heap-buffer-overflow issue reported by ASANKotresh HR2018-10-241-1/+4
| | | | | | | | | | | | | | | | | | | | GF_MALLOC was being used to allocate memory which is not initialized. strcat is used on it which could result in buffer overflow if it contains garbage before '\0'. So changed it to GF_CALLOC. Traceback: ==23427==ERROR: AddressSanitizer: heap-buffer-overflow ... WRITE of size 5 at 0x6080000083fe thread T3 #0 0x7fb60966991c in __interceptor_strcat ... #1 0x48adc0 in config_parse ... #2 0x48cde8 in cli_cmd_gsync_set_parse ... ... Updates: bz#1633930 Change-Id: I3710f011d8139984b1898265d84d150c9bdc962b Signed-off-by: Kotresh HR <khiremat@redhat.com>
* cli: Fix memory leaks reported by ASANKotresh HR2018-10-121-0/+38
| | | | | | | | | This patch addresses memory leaks other than 'gf_cli_rsp' response structure. Updates: bz#1633930 Change-Id: Idc5940dca623e33bc01004a9324bc435fc60b006 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* cli: Fix memory leaks reported by ASANKotresh HR2018-10-121-64/+52
| | | | | | | | | | 'gf_cli_rsp' structure has 'op_errstr' and 'dict.dict_val' which could get allocated by xdr and should be freed. This patch takes care of all instances of the same. Updates: bz#1633930 Change-Id: I2a5d129ffe85cfca743c89edb45b658f3ce688cb Signed-off-by: Kotresh HR <khiremat@redhat.com>
* cli: memory leak issues reported by asanAmar Tumballi2018-10-092-4/+16
| | | | | | | | | With this fix, a run on 'rpc-coverage.t' passes properly. This should help to get started with other fixes soon! Change-Id: I257ae4e28b9974998a451d3b490cc18c02650ba2 updates: bz#1633930 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* cli: Resource leak coverity fixSanju Rakonde2018-10-081-0/+1
| | | | | | | | This patch fixes CID 1175017. Change-Id: I4968c35489aeb5bfa0461b2edf2a0d73b7f03c14 updates: bz#789278 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* cli : coverity fix in cli-rl.cSunny Kumar2018-10-051-3/+1
| | | | | | | | | | This patch fixes CID 1395248. Issue : Resource leak updates: bz#789278 Change-Id: I2fd4e36ac2c2a034e56883436abfc5199b095026 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: fix glusterd memory leak cause by "gluster v status volume_name"shujun100862018-10-031-0/+1
| | | | | | | | | | | If use this command every some seconds for example 15s to check gluster brick status, the glusterd will use about 1G memory in a year. free the value of rsp in gf_cli_status_cbk. glusterd allocate the value of rsp and send it to cli, but cli do not free the value, that cause glusterd memory leak. fixes: bz#1635480 Change-Id: I3f19cd0d4b791ae1b35f9664b3a668b1579f1178 Signed-off-by: shujun10086 <shujun.huang@nokia-sbell.com>
* cli: handle negative scenariosSanju Rakonde2018-10-014-17/+79
| | | | | | | | | | | When control flow reaches negative case code block, we added "goto out" statement without assigning ret to -1. This patch assigns return value to -1, before going to the lable "out". Change-Id: I6db651a3c9ca285ade9ee1ca23d0abe6b36fda3a updates: bz#1193929 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* Quota related files: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}Yaniv Kaul2018-09-262-6/+13
| | | | | | | | | | | | | | 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
* Land part 2 of clang-format changesGluster Ant2018-09-1215-25123/+24747
| | | | | Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4 Signed-off-by: Nigel Babu <nigelb@redhat.com>
* Land clang-format changesGluster Ant2018-09-124-350/+364
| | | | Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
* cli: Add warning message while converting to replica 2 configurationkarthik-us2018-09-113-15/+59
| | | | | | | | | | | | | | Currently while creating replica 2 volume we display a warning message of ending up in split-brain. But while converting an existing volume from other configuration to replica 2 by add-brick or remove-brick operations we do not show any such messages. With this fix in add-brick and remove-brick cases also we will display the same warning message and prompt for confirmation if the configuration changes to replica 2. Change-Id: Ifc4ed6994a087d2403894f4e743c4eb41633276b fixes: bz#1627044 Signed-off-by: karthik-us <ksubrahm@redhat.com>
* cli/src/cli-cmd-parser.c: Move to GF_MALLOC() instead of GF_CALLOC() when ↵Yaniv Kaul2018-09-051-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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: Ic1531afbf614823628cc8d70bae782d4db7ec033
* cli : fix coverity issue in cli-cmd-parser.cSunny Kumar2018-09-051-13/+8
| | | | | | | | | | | | This patch fixes 1175017 and 1382401. This patch fixes resource leak by validating brick_count is valid or not. If brick_count is not valid we are coming out in "cli_cmd_bricks_parse" without allocating memory to "brick_str" which is eventually pointed by bricks. Change-Id: I8ed0f29495379ec49484c5c4069865db3653506f updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* multiple files: calloc -> mallocYaniv Kaul2018-09-047-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xlators/cluster/stripe/src/stripe-helpers.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible xlators/cluster/dht/src/tier.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible xlators/cluster/dht/src/dht-layout.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible xlators/cluster/dht/src/dht-helper.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible xlators/cluster/dht/src/dht-common.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible xlators/cluster/afr/src/afr.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible xlators/cluster/afr/src/afr-inode-read.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible tests/bugs/replicate/bug-1250170-fsync.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible tests/basic/gfapi/gfapi-async-calls-test.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible tests/basic/ec/ec-fast-fgetxattr.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible rpc/xdr/src/glusterfs3.h: Move to GF_MALLOC() instead of GF_CALLOC() when possible rpc/rpc-transport/socket/src/socket.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible rpc/rpc-lib/src/rpc-clnt.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible extras/geo-rep/gsync-sync-gfid.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible cli/src/cli-xml-output.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible cli/src/cli-rpc-ops.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible cli/src/cli-cmd-volume.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible cli/src/cli-cmd-system.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible cli/src/cli-cmd-snapshot.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible cli/src/cli-cmd-peer.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible cli/src/cli-cmd-global.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! updates: bz#1193929 Original-Author: Yaniv Kaul <ykaul@redhat.com> Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Signed-off-by: Amar Tumballi <amarts@redhat.com> Change-Id: I16274dca4078a1d06ae09a0daf027d734b631ac2