1
0
mirror of https://github.com/gluster/glusterfs.git synced 2026-02-06 00:49:30 +01:00

293 Commits

Author SHA1 Message Date
Kaleb S. KEITHLEY
bc838bb710 cli: type mismatch global_quotad_rpc in cli-quotad-client.c
...
[  236s] (.text+0x0): multiple definition of `cli_default_conn_timeout'; cli.o (symbol from plugin):(.text+0x0): first defined here
[  236s] cli-quotad-client.c:13:24: warning: type of 'global_quotad_rpc' does not match original declaration [-Wlto-type-mismatch]
[  236s]    13 | extern struct rpc_clnt global_quotad_rpc;
[  236s]       |                        ^
[  236s] cli.c:80:18: note: 'global_quotad_rpc' was previously declared here
[  236s]    80 | struct rpc_clnt *global_quotad_rpc;
[  236s]       |                  ^
[  236s] cli.c:80:18: note: code may be misoptimized unless '-fno-strict-aliasing' is used
[  239s] collect2: error: ld returned 1 exit status
...

move several global extern decls to cli.h.

Found on SUSE Tumbleweed w/ gcc-10 and LTO.  This bug goes back
at least as far as release-6. Curiously this only popped up as an
error when building 6.9, not 7.4 or 8.0. And not when building
8.0 on Fedora rawhide/33.

Change-Id: I765642cea77b524a36368a7ff1a2976ef049dd0f
Fixes: #1356
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2020-07-09 04:23:57 +00:00
Kotresh HR
8fad76650b bitrot: Make number of signer threads configurable
The number of signing process threads (glfs_brpobj)
is set to 4 by default. The recommendation is to set
it to number of cores available. This patch makes it
configurable as follows

gluster vol bitrot <volname> signer-threads <count>

fixes: bz#1797869
Change-Id: Ia883b3e5e34e0bc8d095243508d320c9c9c58adc
Signed-off-by: Kotresh HR <khiremat@redhat.com>
2020-02-07 12:00:19 +05:30
Shwetha K Acharya
59ed165a60 geo-rep: Note section is required for ignore_deletes
There exists a window of 15 sec, where the deletes are picked up
by history crawl when the ignore_deletes is set to true.
And it eventually deletes the file/s from slave which is/are not
supposed to be deleted. Though it is working as per design, a
note regarding this is needed.

Added a warning message indicating the same.
Also logged info when the worker restarts after ignore-deletes
option set.

fixes: bz#1708603
Change-Id: I103be882fac18b4cef935efa355f5037a396f7c1
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
2020-01-03 15:34:34 +00:00
Dmitry Antipov
d8adc66b79 glfsheal: install as architecture-dependent binary helper
Since glfsheal is a binary helper which is not intented to be
invoked directly, install it under %{libexecdir}/glusterfs rather
than %{sbindir}, adjust invocation from CLI code and RPM spec.

Credits: Ravishankar N <ravishankar@redhat.com>.
Fixes: bz#1780190

Change-Id: I4b41892d96b89c24a332470ac8c1e82f6795159a
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
2019-12-19 11:11:50 +00:00
kshithijiyer
f6e2958543 [Cli] Removing old log rotate command.
The old command for log rotate is still present removing
it completely. Also adding testcase to test the
log rotate command with both the old as well as the new command
and fixing testcase which use the old syntax to use the new
one.

Code to be removed:
1. In cli-cmd-volume.c from struct cli_cmd volume_cmds[]:
{"volume log rotate <VOLNAME> [BRICK]", cli_cmd_log_rotate_cbk,
 "rotate the log file for corresponding volume/brick"
 " NOTE: This is an old syntax, will be deprecated from next release."},

2. In cli-cmd-volume.c from cli_cmd_log_rotate_cbk():
 ||(strcmp("rotate", words[2]) == 0)))

3. In cli-cmd-parser.c from cli_cmd_log_rotate_parse()
if (strcmp("rotate", words[2]) == 0)
   volname = (char *)words[3];
else

fixes: bz#1750387
Change-Id: I56e4d295044e8d5fd1fc0d848bc87e135e9e32b4
Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
2019-12-17 11:33:16 +00:00
Yaniv Kaul
7162c8ad9d cli: defer create_frame() (and dict creation) to later stages.
Where possible, defer create_frame() - whenever possible, after
command line verification, for example.

Change-Id: Id6606e90e7ea6190f30b225c4733b229c519bb2f
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2019-07-16 13:34:56 +00:00
kshithijiyer
c72b3f1345 Removing one top command from gluster v help
The current help show 2 different top commands
intead of one single top command which can be
easily observed when "# gluster v help" command
is issued. Removing one "volume top <VOLNAME>"
and clubbing into them into a single command.

Current help:
volume top <VOLNAME> {open|read|write|opendir|readdir|clear}
[nfs|brick <brick>] [list-cnt <value>] |
volume top <VOLNAME> {read-perf|write-perf}
[bs <size> count <count>] [brick <brick>]
[list-cnt <value>] - volume top operations

Expected help:
volume top <VOLNAME> {open|read|write|opendir|readdir|clear}
[nfs|brick <brick>] [list-cnt <value>] | {read-perf|write-perf}
[bs <size> count <count>] [brick <brick>] [list-cnt <value>]
- volume top operations

fixes: bz#1725034

Change-Id: Ifbc4c95f2558286e27dfc5e9667046b80eb1715d
Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
2019-07-01 14:33:06 +00:00
Vishal Pandey
9b223b15ab glusterd/thin-arbiter: Thin-arbiter integration with GD1
gluster volume create <VOLNAME> replica 2 thin-arbiter 1 <host1>:<brick1> <host2>:<brick2>
<thin-arbiter-host>:<path-to-store-replica-id-file> [force]

The changes have been made in a way that the last brick in the bricks list
will be treated as the thin-arbiter.
GD1 will be manipulated to consider replica count to be as 2 and continue creating the
volume like any other replica 2 volume but since thin-arbiter volumes need ta-brick
client xlator entries for each subvolume in fuse volfile, volfile generation is
modified in a way to inject these entries seperately in the volfile for every subvolume.

Few more additions -
1- Save the volinfo with new fields ta_bricks list and thin_arbiter_count.
2- Introduce a new option client.ta-brick-port to add remote-port to ta-brick xlator entry
   in fuse volfiles. The option can be set using the following CLI syntax -
   gluster volume set <VOLNAME> client.ta-brick-port <PORTNO.>
3- Volume Info will contain a Thin-Arbiter-path entry to distinguish
   from other replicate volumes.

Change-Id: Ib434e2313b29716f32476c6c211d282c4ef39406
Updates #687
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
2019-06-28 17:30:53 +00:00
kshithijiyer
bee5d7bd8a Adding white spaces to description of set group.
The description of set group is missing spaces which
leads to the description look like:
volume set <VOLNAME> group  <GROUP> - This option can be used for
setting multiple pre-defined volume optionswhere group_name is a
file under /var/lib/glusterd/groups containing onekey, value pair
per line

Instead of:
volume set <VOLNAME> group <GROUP> - This option can be used for
setting multiple pre-defined volume options where group_name is a
file under /var/lib/glusterd/groups containing one key value
pair per line

Fixes: bz#1723455

Change-Id: I4957988c0c1f35f043db3f64089c049193e60e8f
Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
2019-06-25 15:23:07 +00:00
Shwetha K Acharya
4d51b878c9 cli: Remove-brick warning seems unnecessary
As force-migration option is disabled by default,
the warning seems unnessary.

Rephrased the warning to make best sense out of it.

fixes: bz#1712668
Change-Id: Ia18c3c5e7b3fec808fce2194ca0504a837708822
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
2019-06-12 21:38:19 +05:30
Shwetha K Acharya
38f23ad833 geo-rep: Geo-rep help text issue
Modified Geo-rep help text for better sanity.

fixes: bz#1652887

Change-Id: I40ef7ef709eaecf0125ab4b4a7517e2c5d1ef4a0
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
2019-05-23 15:25:25 +00:00
Kotresh HR
af4d9131c8 cli: Validate invalid slave url
This patch validates the invalid slave url
in cli itself and throws appropriate error.

fixes: bz#1098991
Change-Id: I278e2a04a4d619d2c2d1db0dd56ab5bdf7e7f469
Signed-off-by: Kotresh HR <khiremat@redhat.com>
2019-05-11 11:09:06 +00:00
Sanju Rakonde
2b86da69df tier/cli: remove tier code to increase code coverage in cli
Change-Id: I56cc09243dab23b3be86a7faac45001dda77181f
updates: bz#1693692
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
2019-04-25 10:38:20 +00:00
Yaniv Kaul
4acf03d304 Multiple files: remove HAVE_BD_XLATOR related code.
The BD translator was removed some time ago,
(in commit a907e468e7).
This completes the work.

Compile-tested only!
updates: bz#1635688
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>

Change-Id: I999df52e479a72d3cc9523f22f9056de17eb559c
2019-03-25 05:34:50 +00:00
Sunny Kumar
eacc48b96b cli : fix mem leak during cli_cmd_volume_gsync_set_cbk
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>
2019-02-19 04:09:33 +00:00
Rinku Kothiya
f87a3e8403 cli: Added the group option for volume set
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>
2019-02-04 12:56:00 +00:00
Yaniv Kaul
3ce7b5dbf0 libglusterfs/src/mem-types.h: remove unused common enums from mem-types.h
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
2018-12-30 11:59:27 +00:00
Sheetal Pamecha
2421453bf3 cli: variable-length array declaration clang fix
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>
2018-12-14 04:38:23 +00:00
Sunny Kumar
74c72d0dd9 cli : fix memory leak in cli-cmd-volume.c
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>
2018-12-10 05:46:00 +00:00
Rinku Kothiya
4bdabc49d0 cli: fix a memory leak reported by ASan.
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>
2018-12-06 17:37:04 +05:30
Kotresh HR
36e1175df6 cli: Fix mem-leaks reported by ASAN
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>
2018-12-06 10:27:37 +00:00
Rinku Kothiya
7ea5f438f6 cli: memory leak issue reported by asan
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>
2018-12-05 22:17:58 +00:00
ShyamsundarR
20ef211cfa libglusterfs: Move devel headers under glusterfs directory
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>
2018-12-05 21:47:04 +00:00
Harpreet kaur
afc3006b46 cli: memory leak issue reported by asan
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>
2018-12-05 21:34:56 +00:00
Harpreet Lalwani
7c0cb6eebd cli: memory leak issue reported by asan
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>
2018-12-03 05:48:28 +00:00
Shwetha K Acharya
0a3540293b geo-rep: Geo-rep help text issue
Modified Geo-rep help text for better sanity.

Change-Id: I48f4d0fd60c1ffcde753b37416e0c73afd0b5702
fixes: bz#1652887
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
2018-11-27 14:01:51 +00:00
Ravishankar N
fc9889d037 glfsheal: add a '--nolog' flag
....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>
2018-11-26 08:36:13 +00:00
Amar Tumballi
74e8328d3f all: fix the format string exceptions
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>
2018-11-05 18:50:59 +00:00
Sanju Rakonde
f054b51105 cli: handle negative scenarios
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>
2018-10-01 08:02:27 +00:00
Gluster Ant
e16868dede Land part 2 of clang-format changes
Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4
Signed-off-by: Nigel Babu <nigelb@redhat.com>
2018-09-12 17:52:45 +05:30
karthik-us
f0bacb2a51 cli: Add warning message while converting to replica 2 configuration
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>
2018-09-11 02:35:35 +00:00
Yaniv Kaul
5276e8f27e multiple files: calloc -> malloc
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
2018-09-04 05:09:09 +00:00
Sunny Kumar
33f53e88c3 cli : fix coverity issue in cli-cmd-volume.c
This patch fixes 1389756.

Change-Id: I72d4f618368545a5dcee0ca59fe87ba6137ab4a1
updates: bz#789278
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
2018-08-31 01:24:40 +00:00
Yaniv Kaul
b2b6ab8eff All: remove memset() before sprintf()
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>
2018-08-14 05:15:04 +00:00
Yaniv Kaul
621138ce76 All: run codespell on the code and fix issues.
Please review, it's not always just the comments that were fixed.
I've had to revert of course all calls to creat() that were changed
to create() ...

Only compile-tested!

Change-Id: I7d02e82d9766e272a7fd9cc68e51901d69e5aab5
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2018-07-22 14:40:16 +00:00
Susant Palai
c63b278947 cli/glusterd: Add warning message in cli for user to check
force-migration config for remove-brick operation.

The cli will take input from the user before starting "remove-brick"
start operation. The message/confirmation looks like the following:

<Running remove-brick with cluster.force-migration enabled can result
in data corruption. It is safer to disable this option so that files
that receive writes during migration are not migrated. Files that are
not migrated can then be manually copied after the remove-brick commit
operation. Do you want to continue with your current
cluster.force-migration settings? (y/n)>

And also question for COMMIT_FORCE is changed.

Fixes: bz#1572586
Change-Id: Ifdb6b108a646f50339dd196d6e65962864635139
Signed-off-by: Susant Palai <spalai@redhat.com>
2018-05-03 17:57:33 +00:00
N Balachandran
fa90317354 cli: Fixed a use_after_free
gf_event in cli_cmd_volume_create_cbk was accessing
memory that had already been freed.

Change-Id: I447c939fa9b31e18819a62c3b356c14cca390787
BUG: 1530910
Signed-off-by: N Balachandran <nbalacha@redhat.com>
2018-01-04 12:26:29 +05:30
Xavier Hernandez
9424a9fcc9 cli: Fix several coverity issues in cli-cmd-volume.c
This patch fixes issues 133, 486, 487 and 691 from [1]

[1] https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/

Change-Id: I1a6ca4870ac105ea4c634fc18293229a56ab8596
BUG: 789278
Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
2017-11-03 05:04:49 +00:00
N Balachandran
89dc54f50c cli: gluster help changes
gluster cli help now shows only the top level
help commands. gluster <component> help will now show
help commands for <component>.

Change-Id: I263f53a0870d80ef4cfaad455fdaa47e2ac4423b
BUG: 1474768
Signed-off-by: N Balachandran <nbalacha@redhat.com>
2017-11-02 12:54:06 +00:00
Mohit Agrawal
d1f15cdeb6 cli/afr: gluster volume heal info "healed" command output is not appropriate
Problem: "gluster volume heal info [healed] [heal-failed]" command
          output on terminal is not appropriate in case of down any volume.

Solution: To make message more appropriate change the condition
          in function "gd_syncop_mgmt_brick_op".

Test : To verify the fix followed below procedure
       1) Create 2*3 distribute replicate volume
       2) set self-heal daemon off
       3) kill two bricks (3, 6)
       4) create some file on mount point
       5) bring brick 3,6 up
       6) kill other two brick (2 and 4)
       7) make self heal daemon on
       8) run "gluster v heal <vol-name>"

Note: After apply the patch options (healed | heal-failed) will deprecate
      from command line.
BUG: 1388509
Change-Id: I229c320c9caeb2525c76b78b44a53a64b088545a
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
2017-10-04 04:33:16 +00:00
Atin Mukherjee
f6775423d7 events : Add brick list in EVENT_VOLUME_CREATE
Change-Id: Ibf87ae5ca57f9d27c036f329a30c8f81b51c52bf
BUG: 1492109
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://review.gluster.org/18306
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
2017-09-18 11:44:57 +00:00
Mohamed Ashiq Liyazudeen
dabfc3116a heal: New feature heal info summary to list the status of brick and count of entries to be healed
Command output:
Brick 192.168.2.8:/brick/1
Status: Connected
Total Number of entries: 363
Number of entries in heal pending: 362
Number of entries in split-brain: 0
Number of entries possibly healing: 1

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cliOutput>
  <healInfo>
    <bricks>
      <brick hostUuid="9105dd4b-eca8-4fdb-85b2-b81cdf77eda3">
        <name>192.168.2.8:/brick/1</name>
        <status>Connected</status>
        <totalNumberOfEntries>363</numberOfEntries>
        <numberOfEntriesInHealPending>362</numberOfEntriesInHealPending>
        <numberOfEntriesInSplitBrain>0</numberOfEntriesInSplitBrain>
        <numberOfEntriesPossiblyHealing>1</numberOfEntriesPossiblyHealing>
      </brick>
    </bricks>
  </healInfo>
  <opRet>0</opRet>
  <opErrno>0</opErrno>
  <opErrstr/>
</cliOutput>

Change-Id: I40cb6f77a14131c9e41b292f4901b41a228863d7
BUG: 1261463
Signed-off-by: Mohamed Ashiq Liyazudeen <mliyazud@redhat.com>
Reviewed-on: https://review.gluster.org/12154
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Karthik U S <ksubrahm@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
2017-09-15 12:21:36 +00:00
hari gowtham
ecef90aa41 Command to identify client process
command: gluster volume status <volname/all> client-list

output:
Client connections for volume v1
Name                                                       count
-----                                                     ------
fuse                                                           2
tierd                                                          1

total clients for volume v1 : 3
-----------------------------------------------------------------

Client connections for volume v2
Name                                                       count
-----                                                     ------
tierd                                                          1
fuse.gsync                                                     1

total clients for volume v2 : 2
-----------------------------------------------------------------

Updates: #178
Change-Id: I0ff2579d6adf57cc0d3bd0161a2ec6ac6c4747c0
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: https://review.gluster.org/18095
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: hari gowtham <hari.gowtham005@gmail.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
2017-09-06 11:52:40 +00:00
hari gowtham
e5db980504 tier: separation of attach-tier from add-brick
PROBLEM: Both attach tier and add brick have the same RPC
and set of code. This becomes a hurdle while tring to implement
add brick on a tiered volume.

FIX: This patch separates the add brick and attach tier
giving them separate RPCs.

Change-Id: Iec57e972be968a9ff00b15b507e56a4f6dc398a2
BUG: 1376326
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: https://review.gluster.org/15503
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: hari gowtham <hari.gowtham005@gmail.com>
Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
2017-08-01 11:08:04 +00:00
Atin Mukherjee
c136024613 cli: error out incomplete CLI commands
cli_cmd_bricks_parse () & cli_cmd_volume_remove_brick_parse () were not
handling the the error cases where the command is incomplete with
missing brick details which could lead to glusterd crashes.

Credit : george.lian@nokia.com

Change-Id: Ia6303457a2aa279465aa75d4e1cfcc948893d5de
BUG: 1396327
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://review.gluster.org/17870
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
2017-07-26 20:37:23 +00:00
Atin Mukherjee
4dba0d5f8d cli: add 'all' option in gluster v get cli usage
Change-Id: If216b13b7f9072f875eb2c5019d3b50b8bf3313e
BUG: 1458582
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://review.gluster.org/17460
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
2017-06-06 11:31:48 +00:00
Samikshan Bairagya
74383e3ec6 glusterd: Make reset-brick work correctly if brick-mux is on
Reset brick currently kills of the corresponding brick process.
However, with brick multiplexing enabled, stopping the brick
process would render all bricks attached to it unavailable. To
handle this correctly, we need to make sure that the brick process
is terminated only if brick-multiplexing is disabled. Otherwise,
we should send the GLUSTERD_BRICK_TERMINATE rpc to the respective
brick process to detach the brick that is to be reset.

Change-Id: I69002d66ffe6ec36ef48af09b66c522c6d35ac58
BUG: 1446172
Signed-off-by: Samikshan Bairagya <samikshan@gmail.com>
Reviewed-on: https://review.gluster.org/17128
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
2017-05-10 18:58:21 +00:00
Michael Scherer
27b04b6c48 Fix 'flush' type, coverity warning
As getchar returna a int, (which is 4 bytes on most
common platforms, and at least 2 bytes), and char being often
1 byte, the conversion would lose information, hence
the warning.

Change-Id: I5b0b39c636ff49ef5c15d51a7f798e21635eca06
BUG: 789278
Signed-off-by: Michael Scherer <misc@redhat.com>
Reviewed-on: https://review.gluster.org/17193
Tested-by: Michael Scherer <misc@fedoraproject.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Zhou Zhengping <johnzzpcrystal@gmail.com>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
2017-05-10 12:34:00 +00:00
Poornima G
f2e7b6800b glusterd: add a cli command to trigger a statedump on a client
With this, we will be able to trigger statedumps on remote Gluster
clients, mainly targetted for applications using libgfapi.

Design:
SIGUSR signal is the most comman way of taking a statedump in Gluster.
But it cannot be used for libgfapi based processes, as the process
loading the library might have already consumed SIGUSR signal. Hence
going by the command way.

One has to issue a Gluster command to initiate a statedump on the
libgfapi based client. The command takes hostname and PID as an
argument. All the glusterds in the cluster, check if they are connected
to the specified hostname, and send an RPC request to all the connected
clients from that hostname (via the mgmt connection).

URL: http://review.gluster.org/16357
Change-Id: Icbe4d2f026b32a2c7d5535e1bfb2cdaaff042e91
BUG: 1169302
Signed-off-by: Poornima G <pgurusid@redhat.com>
[ndevos: minor fixes and split patch in smaller pieces]
Reviewed-on: https://review.gluster.org/9228
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
2017-01-23 19:13:15 -05:00
Xavier Hernandez
7b5b7111c9 cli: keep 'gluster volume status detail' consistent
The output of the command 'gluster volume status <volname> detail' is
not consistent between operating systems. On linux hosts it shows the
file system type, the device name, mount options and inode size of each
brick. However the same command executed on a FreeBSD host doesn't show
all this information, even for bricks stored on a linux.

Additionally, for hosts other than linux, this information is shown as
'N/A' many times. This has been fixed to show as much information as it
can be retrieved from the operating system.

The file contrib/mount/mntent.c has been mostly rewriten because it
contained many errors that caused mount information to not be retrieved
on some operating systems.

Change-Id: Icb6e19e8af6ec82255e7792ad71914ef679fc316
BUG: 1411334
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/16371
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
2017-01-19 15:52:26 -08:00