12491 Commits

Author SHA1 Message Date
Amar Tumballi
088e2cbb5e symlink-cache: remove from the build
symlink-cache was written as an experiment to reduce the load
on 'build' systems, which keep doing symlink resolution to get
the proper header files. But since last 6+ years, there was no
way to add it to the volfile using gluster cli, and hence was
not supported anymore. As it is not maintained, and as announced
on [1], we are planning to remove it from the build system.

[1]- https://lists.gluster.org/pipermail/gluster-users/2018-July/034400.html

updates: bz#1635688
Change-Id: Iaa25069bceed04cf65f79a4b4a02c05cee848eb5
Signed-off-by: Amar Tumballi <amarts@redhat.com>
2018-12-13 06:12:50 +00:00
Mohit Agrawal
fb917bf10b [geo-rep]: Worker still ACTIVE after killing bricks
Problem: In changelog xlator after destroying listener it call's
         unlink to delete changelog socket file but socket file
         reference is not cleaned up from process memory

Solution: 1) To cleanup reference completely from process memory
             serialize transport cleanup for changelog and then
             unlink socket file
          2) Brick xlator will notify GF_EVENT_PARENT_DOWN to next
             xlator only after cleanup all xprts

Test: To test the same run below steps
      1) Setup some volume and enable brick mux
      2) kill anyone brick with gf_attach
      3) check changelog socket for specific to killed brick
         in lsof, it should cleanup completely

fixes: bz#1600145

Change-Id: Iba06cbf77d8a87b34a60fce50f6d8c0d427fa491
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
2018-12-13 04:46:50 +00:00
Ravishankar N
52d3f82db2 afr: some minor itable related cleanups
- this->itable always needs to be allocated, hence move it outside
afr_selfheal_daemon_init().
- Invoke afr_selfheal_daemon_init() only for self-heal daemon case.
- remove redundant itable allocation in afr_discover().
- destroy itable in fini.

Updates bz#1193929
Change-Id: Ib28b50b607386f5a5aa7d2f743c8b506ccb10eae
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
2018-12-12 23:02:56 +00:00
Mohit Agrawal
607bbd935f rpc: Resolve memory leak in mgmt_pmap_signout_cbk
Problem: At the time of submit signout request to mgmt
         rpc_clnt_mgmt_pmap_signout create a frame but in cbk
         frame is not destroyed

Solution: cleanup frame in mgmt_pmap_signout_cbk to avoid leak

Change-Id: I9961cacb2e02c8023c4c99e22e299b8729c2b09f
fixes: bz#1658045
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
2018-12-12 22:58:49 +00:00
Milind Changire
c9d117d54a core: move invalid port logs to DEBUG log level
Stop spamming "invalid port" logs in case sysadmin has reserved a large
number of ports.

Change-Id: I244ef7693560cc404b36cadc6b05d92ec0e908d3
fixes: bz#1656517
Signed-off-by: Milind Changire <mchangir@redhat.com>
2018-12-12 15:59:56 +00:00
Raghavendra Bhat
7dadea15c5 copy_file_range support in GlusterFS
* libglusterfs changes to add new fop

    * Fuse changes:
      - Changes in fuse bridge xlator to receive and send responses

    * posix changes to perform the op on the backend filesystem

    * protocol and rpc changes for sending and receiving the fop

    * gfapi changes for performing the fop

    * tools: glfs-copy-file-range tool for testing copy_file_range fop

      - Although, copy_file_range support has been added to the upstream
	    fuse kernel module, no release has been made yet of a kernel
        which contains the support. It is expected to come in the
        upcoming release of linux-4.20

        So, as of now, executing copy_file_range fop on a fused based
        filesystem results in fuse kernel module sending read on the
	    source fd and write on the destination fd.

	    Therefore a small gfapi based tool has been written to be able
        test the copy_file_range fop. This tool is similar (in functionality)
	    to the example program given in copy_file_range man page.

	    So, running regular copy_file_range on a fuse mount point and
	    running gfapi based glfs-copy-file-range tool gives some idea about
	    how fast, the copy_file_range (or reflink) can be.

	    On the local machine this was the result obtained.

	    mount -t glusterfs workstation:new /mnt/glusterfs
	    [root@workstation ~]# cd /mnt/glusterfs/
	    [root@workstation glusterfs]# ls
	    file
	    [root@workstation glusterfs]# cd
	    [root@workstation ~]# time /tmp/a.out /mnt/glusterfs/file /mnt/glusterfs/new
	    real  0m6.495s
	    user  0m0.000s
	    sys   0m1.439s
	    [root@workstation ~]# time glfs-copy-file-range $(hostname) new /tmp/glfs.log /file /rrr
	    OPEN_SRC: opening /file is success
	    OPEN_DST: opening /rrr is success
	    FSTAT_SRC: fstat on /rrr is success
	    copy_file_range successful

        real  0m0.309s
        user  0m0.039s
        sys   0m0.017s

        This tool needs following arguments
         1) hostname
         2) volume name
         3) log file path
         4) source file path (relative to the gluster volume root)
         5) destination file path (relative to the gluster volume root)

        "glfs-copy-file-range <hostname> <volume> <log file path> <source> <destination>"

      - Added a testcase as well to run glfs-copy-file-range tool

    * io-stats changes to capture the fop for profiling

    * NOTE:

      - Added conditional check to see whether the copy_file_range syscall
        is available or not. If not, then return ENOSYS.

      - Added conditional check for kernel minor version in fuse_kernel.h
        and fuse-bridge while referring to copy_file_range. And the kernel
        minor version is kept as it is. i.e. 24. Increment it in future
        when there is a kernel release which contains the support for
        copy_file_range fop in fuse kernel module.

    * The document which contains a writeup on this enhancement can be found at
      https://docs.google.com/document/d/1BSILbXr_knynNwxSyyu503JoTz5QFM_4suNIh2WwrSc/edit

Change-Id: I280069c814dd21ce6ec3be00a884fc24ab692367
updates: #536
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
2018-12-12 15:56:55 +00:00
karthik-us
5c723ade19 cluster/afr: Do not update read_subvol in inode_ctx after rename/link fop
Since rename/link fops on a file will not change any data in it, it should
not update the read_subvol values in the inode_ctx, which interprets the
data & metadata readable subvols for that file. The old read_subvol values
should be retained even after the rename/link operations.

Change-Id: I068044a426823a566f5bea8aa063cd689199d6dd
fixes: bz#1657783
Signed-off-by: karthik-us <ksubrahm@redhat.com>
2018-12-12 15:41:38 +05:30
Harpreet Kaur
3e3d83ee35 tools: stack-buffer-overflow reported by asan
This patch fixes buffer overflow in $SRC/tools/setgfid2path/src/main.c
Memory access at offset 196 overflows "pgfid" variable
SUMMARY: AddressSanitizer: stack-buffer-overflow (/lib64/libasan.so.5+0x4e935)

updates: bz#1633930

Change-Id: Ib508c57e96c46b628f63c511437b853b39ae7955
Signed-off-by: Harpreet Kaur <hlalwani@redhat.com>
2018-12-12 04:45:01 +00:00
Bhumika Goyal
e41fee7ba3 afr: Resource leak coverity fixes
Problem reported by Coverity: Leak of memory or pointers to
system resources.
Deallocate the memory pointed to by xattr_serz as the memory
reference is not stored anywhere.

Fixes CID: 1124760, 124787, 1382418

Change-Id: Ib9c2ef28c52e2d43de2552cfd959a98b26272bc1
updates: bz#789278
Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
2018-12-11 14:28:04 +00:00
rishubhjain
08adbfb5d2 write-behind/bit-rot: fix identifier
Rename the identifiers, bit-rot-server to bit-rot in bit-rot.c & write-ahead to
write-behind in write-behind.c to ensure GD2 understands the options

Change-Id: Id271ae97de2e54f4e30174482c4e1fb6afc728d3
Fixes: #164
Signed-off-by: rishubhjain <rishubhjain47@gmail.com>
2018-12-11 06:43:38 +00:00
Harpreet Kaur
f50251daee nfs: memory leak issue reported by asan
This patch fixes Direct leaks in exports.c
Leaks are happening in exp_file_parse
SUMMARY: AddressSanitizer: 5120 byte(s) leaked in 20 allocation(s).
SUMMARY: AddressSanitizer: 512 byte(s) leaked in 4 allocation(s).

Updates: bz#1633930

Change-Id: Ib4474f8f6c65d737ed54ed35b4234410d1fd673e
Signed-off-by: Harpreet Kaur <hlalwani@redhat.com>
2018-12-11 06:35:27 +00:00
Amar Tumballi
8b3a1b19fb encryption: remove crypt xlator from build
Based on the proposal to remove few features as they are not
actively maintained [1], removing crypt translator from the build.

[1] - https://lists.gluster.org/pipermail/gluster-users/2018-July/034400.html

Crypt xlator helped in on-disk / at-rest encryption of data. But
currently as there are no maintainers for this, planning to remove
it from master codebase. We are planning to host these experimental/
tech-preview xlators in another repository, so people who want to
contribute can still use the bits.

updates: bz#1635688

Change-Id: I7f2453907a595c34f635a88c49aab0845369c6e7
Signed-off-by: Amar Tumballi <amarts@redhat.com>
2018-12-11 04:16:33 +00:00
Mohit Agrawal
e82bcc33ed posix: posix_health_check_thread_proc crash due to priv is NULL
Problem: posix_fini sends a cancellation request to health_check
         thread and cleanup priv without ensuring health_check thread
         is running

Solution: Make health_check && disk_space thread joinable and call
          gf_thread_cleanup_xint to wait unless thread is not finished

Change-Id: I4d37b08138766881dab0922a47ed68a2c3411f13
fixes: bz#1636570
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
2018-12-11 04:01:40 +00:00
Mohit Agrawal
2b7b6ff28f glusterd: Resolve memory leak in some glusterd functions
Problem: Functions allocate memory for req structure but after submit
         request they missed to cleanup memory

Solution: After submit request cleanup allocated mmeory

Change-Id: I8f995787ed8986b882f008ccd588670b5d4139f5
updates: bz#1633930
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
2018-12-10 15:04:48 +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
Harpreet Kaur
6e92171117 geo-rep: Make slave volume read-only (by default)
Added a command to set "features.read-only" option
to a default value "on" for slave volume.
Changes are made in:
$SRC//extras/hook-scripts/S56glusterd-geo-rep-create-post.sh
for root geo-rep and
$SRC/geo-replication/src/set_geo_rep_pem_keys.sh
for non-root geo-rep.

Fixes: bz#1654187

Change-Id: I15beeae3506f3f6b1dcba0a5c50b6344fd468c7c
Signed-off-by: Harpreet Kaur <hlalwani@redhat.com>
2018-12-07 09:37:54 +00:00
Atin Mukherjee
916df2c12b glusterd: fix get_mux_limit_per_process to read default value
get_mux_limit_per_process () reads the global option dictionary and in
case it doesn't find out a key, assumes that
cluster.max-bricks-per-process option isn't configured however the
default value should be picked up in such case.

Change-Id: I35dd8da084adbf59793d58557e818d8e6c17f9f3
Fixes: bz#1656951
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
2018-12-07 07:08:58 +00:00
Raghavendra Gowdappa
9ee330aaf0 performance/readdir-ahead: update stats from prefetched dentries
stats from prefetched dentries should be invalidated only if the
files pointed to those dentries were written in the window of
prefetching. Otherwise its safe to use these stats.

Change-Id: I9ea5aeea4c75dfa03387fca32c626cb4e693290d
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Fixes: bz#1656348
2018-12-07 06:56:43 +00:00
Aravinda VK
40a9e53a44 New xlator option to control enable/disable of xlators in Gd2
Since glusterd2 don't maintain the xlator option details in code, it
directly reads the xlators options table from `*.so` files. To support
enable and disable of xlator new option added to the option table with
the name same as xlator name itself.

This change will not affect the functionality with glusterd1.

Change-Id: I23d9e537f3f422de72ddb353484466d3519de0c1
updates: #302
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-12-07 05:28:23 +00:00
Mohit Agrawal
f168db1da7 cli: fix memory leak in cli rpc ops
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>
2018-12-07 03:48:21 +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
Amar Tumballi
340e58f9b3 all: add xlator_api to many translators
Fixes: #164
Change-Id: I93ad6f0232a1dc534df099059f69951e1339086f
Signed-off-by: Amar Tumballi <amarts@redhat.com>
2018-12-06 07:54:28 +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
Xie Changlong
ad446dabb8 protocol/server: support server.all-squash
We still use gnfs on our side, so do a little work to support
server.all-squash. Just like server.root-squash, it's also a
volume wide option. Also see bz#1285126

$ gluster volume set <VOLNAME> server.all-squash on

Note: If you enable server.root-squash and server.all-squash
at the same time, only server.all-squash works. Please refer
to following table

+---------------+-----------------+---------------------------+
|               |all_squash       | no_all_squash             |
+-------------------------------------------------------------+
|               |                 |anonuid/anongid for root   |
|root_squash    |anonuid/anongid  |useruid/usergid for no-root|
+-------------------------------------------------------------+
|no_root_squash |anonuid/anongid  |useruid/usergid            |
+-------------------------------------------------------------+

Updates bz#1285126
Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
Signed-off-by: Xue Chuanyu <xuechuanyu@cmss.chinamobile.com>
Change-Id: Iea043318fe6e9a75fa92b396737985062a26b47e
2018-12-05 21:45:49 +00:00
Sunny Kumar
7f7716f819 cli: fix memory leak in cli/src/cli-rpc-ops.c
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>
2018-12-05 21:37:31 +00:00
Atin Mukherjee
d4723bdd30 glusterd: glusterd to regenerate volfiles when GD_OP_VERSION_MAX changes
While glusterd has an infra to allow post install of spec to bring it up
in the interim upgrade mode to allow all the volfiles to be regenerated
with the latest executable, in container world the same methodology is
not followed as container image always point to the specific gluster rpm
and gluster rpm doesn't go through an upgrade process.

This fix does the following:
1. If glusterd.upgrade file doesn't exist, regenerate the volfiles
2. If maximum-operating-version read from glusterd.upgrade doesn't match
with GD_OP_VERSION_MAX, glusterd detects it to be a version where new
options are introduced and regenerate the volfiles.

Tests done:

1. Bring up glusterd, check if glusterd.upgrade file has been created
with GD_OP_VERSION_MAX value.
2. Post 1, restart glusterd and check glusterd hasn't regenerated the
volfiles as there's is no change in the GD_OP_VERSION_MAX vs the
op_version read from the file.
3. Bump up the GD_OP_VERSION_MAX in the code by 1 and post compilation
restart glusterd where the volfiles should be again regenerated.

Note: The old way of having volfiles regenerated during an rpm upgrade
is kept as it is for now but eventually this can be sunset later.

Change-Id: I75b49a1601c71e99f6a6bc360dd12dd03a96414b
Fixes: bz#1651463
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
2018-12-05 21:36:25 +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
Kotresh HR
382ad46bbc tests/geo-rep: Mask failure of geo-rep arbiter test
Comment out the particular test which is failing
arbitrarily. Also changed the code to differentiate
error cases. There could be some race because of
which it's failing arbitrarily. This will be debugged
and fixed in separate patch.

Change-Id: I925df6421737d7a9abd9446a9d85029b4285ad2c
updates: bz#1193929
Signed-off-by: Kotresh HR <khiremat@redhat.com>
2018-12-05 15:34:52 +00:00
Chris Holcombe
5a8a06bc9d debug/io-stats: Fix json output
Summary: The json being output by the io-stats debug xlator
quotes the numbers. This is not necessary and makes parsing
in strongly typed languages more difficult.

Change-Id: I3ac13700e2c52dbdc29d0bcdd39896d7871f36fe
fixes: bz#1654521
Signed-off-by: Chris Holcombe <xfactor973@gmail.com>
2018-12-05 15:04:19 +00:00
Sheetal Pamecha
65dc176e7c rpc-transport/socket: NULL pointer dereferencing clang fix
Problem: res->ai_addr could be NULL

Added a check to address this issue

Change-Id: Iac88a8d6dc1f009836554448afbc228df93decd6
Updates: bz#1622665
Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
2018-12-05 09:14:27 +00:00
Yaniv Kaul
785106e138 xlators/mgmt/glusterd/src/glusterd-volgen.c: use dict_ new functions
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 patches makes use of these functions over
this whole file.

Please review carefully, as there are many many changes there.

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

Change-Id: I2e1ee340300ec330936c31becda6bfe1b6533281
2018-12-05 08:48:32 +00:00
Atin Mukherjee
9c06057bae tests: Mark tests/bugs/shard/zero-flag.t bad
Change-Id: I2f4ca470c6666584e0feb129ab712f06772a86c2
Updates: bz#1656264
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
2018-12-05 08:46:05 +00:00
Atin Mukherjee
239c67d49d glusterd: set cluster.max-bricks-per-process to 250
Commit 6821cec changed this default from 0 to 250 in the option table,
however the same wasn't done in the global option table.

Change-Id: I6075f2ebc51e839510d6492fb62e706deb2d845b
Fixes: bz#1652118
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
2018-12-05 07:52:08 +00:00
Krutika Dhananjay
040a1dbcf6 extras: Add group-distributed-virt for single-brick ovirt-gluster use-case
Change-Id: I930011327332b7ba30cc76f614efaf5932eb4f3d
fixes: bz#1654138
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
2018-12-05 04:00:14 +00:00
Yaniv Kaul
f80d9be732 libglusterfs/src/iobuf.c: small refactor to re-use code.
No functional changes (I hope).
Compile-tested only!

updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>

Change-Id: Ifbec21c18a6dbe27c5271db156bff4d30ca85dbf
2018-12-05 03:59:29 +00:00
Sunny Kumar
f479f46189 cli: fix memory leak in cli-cmd-system.c
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>
2018-12-05 03:49:14 +00:00
Eli Schwartz
82987486a9
configure.ac: fix option to stop automake aborting on pointless error
glusterfs does not follow the GNU coding standards and therefore must
use the "foreign" strictness. Without this, autoreconf -fi would fail to
execute successfully because automake returned non-zero.

This change ensures that people using autoreconf, the GNU preferred
invocation method for the autotools build system, can successfully set
up the build.

Remove the pointless --foreign argument from the autogen.sh invocation
of automake. Not only is configure.ac the preferred way to define such
options (rather than handwritten, piecemeal invocations of every tool in
the autotools toolchain), it was never needed in the autogen.sh as that
script provides no error handling at all and always (incorrectly)
returns successfully as long as autotools itself is installed (no matter
how broken glusterfs itself is).

Change-Id: Ib0246d5368a54594f517a322465cffb9a85c1b49
fixes: bz#1656100
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2018-12-04 12:06:50 -05:00
Milan Zink
9b770760d9 Do not blindly add volume share section to smb.conf
With this change, by default GlusterFS volume share section will
no longer be added to smb.conf for client access unless user.cifs
or user.smb volume set options are enabled. This also fixes the
hook script to check for presence of all configuration possibilities
for those volume set options like 'enable' or 'on'.

Change-Id: Ibecf7fffb4507d7255d963c3b1482afb0d0db984
Signed-off-by: Milan Zink <mzink@redhat.com>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Fixes: bz#1575836
2018-12-04 16:36:53 +00:00
Sanju Rakonde
e48678567a glusterd: migrating profile commands to mgmt_v3 framework
Current profile commands use the op_state machine framework.
Porting it to use the mgmt_v3 framework.

The following tests were performed on the patch:
case 1:
1. On a 3 node cluster, created and started 3 volumes
2. Mounted all the three volumes and wrote some data
3. Started profile operation for all the volumes
4. Ran "gluster v status" from N1,
       "gluster v profile <volname1> info" form N2,
       "gluster v profile <volname2> info" from N3 simultaneously in a
   loop for around 10000 times
5. Didn't find any cores generated.

case 2:
1. Repeat the steps 1,2 and 3 from case 1.
2. Ran "gluster v status" from N1,
       "gluster v profile <volname1> info" form N2(terminal 1),
       "gluster v profile <volname2> info" from N2(terminal 2)
   simultaneously in a loop.
3. No cores were generated.

fixes: bz#1654181
Change-Id: I83044cf5aee3970ef94066c89fcc41783ed468a6
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
2018-12-04 16:21:42 +00:00
Harpreet Kaur Lalwani
8e8f4bf3fa cli: "usage()" and "--help" for gluster cli
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>
2018-12-04 09:28:11 +00:00
Kotresh HR
54ebd47e41 geo-rep: Fix syncing of files with non-ascii filenames
Problem:
  Creation of files/directories with non-ascii names fails
  to sync to the slave. It crashes with below traceback on
  slave.
  ...
  File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/repce.py", line 118, in worker
    res = getattr(self.obj, rmeth)(*in_data[2:])
  File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/resource.py", line 709, in entry_ops
    [ESTALE, EINVAL, EBUSY])
  File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/syncdutils.py", line 546, in errno_wrap
    return call(*arg)
  File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/libcxattr.py", line 83, in lsetxattr
    cls.raise_oserr()
  File "/usr/lib/x86_64-linux-gnu/glusterfs/python/syncdaemon/libcxattr.py", line 38, in raise_oserr
    raise OSError(errn, os.strerror(errn))
  OSError: [Errno 12] Cannot allocate memory

Cause:
  The length calculation arguments passed to blob creation was done before encoding. Hence
  was failing in gfid-access layer.

Fix:
  It appears that the calculating lenght properly fixes this issue. But it will cause
  issues in other places in 'python2' and not in 'python3'. So encoding and decoding
  each required string to make geo-rep compatible with both 'python2' and 'python3'
  is a nightmare and is not fool proof. Hence kept 'python2' code as is with out
  encode/decode and applied encode/decode only to 'python3'

Added non-ascii filename tests to regression

fixes: bz#1650893
Change-Id: I35cfaf848e07b1a0b5cb93c01b98b472f08271a6
Signed-off-by: Kotresh HR <khiremat@redhat.com>
2018-12-04 09:15:44 +00:00
Milind Changire
748e993d1f rpc: bump up server.event-threads
Problem:
A single event-thread causes performance issues in the system.

Solution:
Bump up event-threads to 2 to make the system more performant.
This helps in making the system more responsive and helps avoid the
ping-timer-expiry problem as well. However, setting the event-threads
to 2 is not the only thing required to avoid ping-timer-expiry issues.

Change-Id: Idb0fd49e078db3bd5085dd083b0cdc77b59ddb00
fixes: bz#1653277
Signed-off-by: Milind Changire <mchangir@redhat.com>
2018-12-04 06:38:55 +00:00
Soumya Koduri
b3d88a0904 io-cache: xdata needs to be passed for readv operations
io-cache xlator has been skipping xdata references when the
date needs to be read into page cache. This patch fixes the same.

Note: similar changes may be needed for other fops as well
which are handled by io-cache.

Change-Id: I28d73d4ba471d13eb55d0fd0b5197d222df77a2a
updates: bz#1648768
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
2018-12-04 05:23:03 +00:00
Raghavendra Bhat
9fc6cf898b rpc: check if fini is there before calling it
The rpc_transport_t structure is allocated and filled in the
rpc_transport_load function. If filling the fileds of the rpc
structure fails, then in the failure handling the structure is
freed by rpc_transport_cleanup. There, it unconditionally calls
fini. But, if the failure handling was invoked because of any
failure in between the allocation of rpc_transport_t and filling
the transport->fini (including the failure to fill fini ()), then
rpc_transport_cleanup can lead to a segfault.

Change-Id: I8be9b84cd6b19933c559c9736198a6e440373f68
fixes: bz#1654917
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
2018-12-04 02:27:03 +00:00
Sanju Rakonde
2bb0e89e4b glusterd: perform rcu_read_lock/unlock() under cleanup_lock mutex
Problem: glusterd should not try to acquire locks on any resources,
when it already received a SIGTERM and cleanup is started. Otherwise
we might hit segfault, since the thread which is going through
cleanup path will be freeing up the resouces and some other thread
might be trying to acquire locks on freed resources.

Solution: perform rcu_read_lock/unlock() under cleanup_lock mutex.

fixes: bz#1654270
Change-Id: I87a97cfe4f272f74f246d688660934638911ce54
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
2018-12-03 17:03:57 +00:00
Sunny Kumar
220722b426 cli : Memeory leak fix reported by ASAN
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>
2018-12-03 15:57:38 +00:00
Mohit Agrawal
46c15ea8fa server: Resolve memory leak path in server_init
Problem: 1) server_init does not cleanup allocate resources
            while it is failed before return error
         2) dict leak at the time of graph destroying

Solution: 1) free resources in case of server_init is failed
          2) Take dict_ref of graph xlator before destroying
             the graph to avoid leak

Change-Id: I9e31e156b9ed6bebe622745a8be0e470774e3d15
fixes: bz#1654917
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
2018-12-03 11:34:35 +00:00
Raghavendra Bhat
f77fb6d568 features/bitrot: compare the signature with proper length
* The scrubber was comparing the checksum of the file that it
  calculated (by reading the file) with the on disk signature
  (stored via xattr) wrongly. It was using strlen to calculate
  the signature, while the actual length of the signature is
  given by the brick. Just use the actual length that the brick
  provides instead of trying to calculate the signature length via
  strlen API.

* In posix, gfid2path was using the same string that contains the
  list of all the xattrs of file to save the value of the gfid2path
  xattr as well. This causes confusion when gfid2path xattr is queried
  by scrubber for getting the actual path of a corrupted file. Use
  separate string to fetch the value of the xattr instead of the string
  that contains the list of xattrs.

Change-Id: I2d664ab524d2b312233476cb35863dde3122e9a9
fixes: bz#1654805
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
2018-12-03 08:45:12 +00:00