12516 Commits

Author SHA1 Message Date
Raghavendra Gowdappa
d50f22e6ae performance/io-cache: update pages with write data
Currently io-cache invalidate pages falling in the range of write. But
instead it can update pages with same data so that reads can make use
of the cache.

credits: Xavi Hernandez <xhernandez@redhat.com>

Change-Id: I932bd3da97ddfd464187f3009b1013eb334f00a7
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
updates: bz#1659869
2018-12-18 09:19:16 +00:00
Raghavendra Gowdappa
51ff065b8b performance/ob: make open-behind as a child of quick-read
With read-after-open being set to yes by default, if open-behind sees
any reads, it'll do an open on backend (and hence flush/release
later). This means with the current order of quick-read and
open-behind, open-behind sees all reads and hence also does open
bringing down performance for small file reads.

Since for small files, reads are absorbed by quick-read, if quick-read
is made a parent of open-behind, ob doesn't witness any reads. For
read-only workloads, this means ob doen't do any opens (even with
read-after-open yes and use-anonymous-fd no).

Change-Id: I138a42b006d104cff43ee6f07829e39c36f6f234
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Fixes: bz#1659327
2018-12-18 09:12:27 +00:00
Yaniv Kaul
f9859218da xlators/cluster/afr/src/afr-self-heal-common.c: remove a variable array.
Added '-Wvla' and saw this - gcc doesn't like variable arrays.
There are plenty of others in the EC code, but this seems OK to remove:
there is no use for the array members (I hope - that was from reading
the code).

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

Change-Id: I350f4520e52b86c8bbcd60eea1b27ef99cd119aa
2018-12-18 06:54:53 +00:00
Atin Mukherjee
f9220c89ae glusterd: define max-port to 60999
As glusterd scans through all the ports in its defined range, with RHEL
7.3 onwards any port beyond 60999 isn't within the ephemeral port range
and following AVC denial message is seen.

type=AVC msg=audit(1471946614.154:109): avc:  denied  { name_bind } for
pid=2302 comm="glusterd" src=61000 scontext=system_u:system_r:glusterd_t:s0
tcontext=system_u:object_r:ephemeral_port_t:s0 tclass=tcp_socket

Fix is to define the max port range to 60999 in glusterd.vol file. The
port range can be tweaked through a reconfigure of this configuration
file though.

Fixes: bz#1659857
Change-Id: I60fd4a421d8509b8dca4ca13b73999ae33965f72
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
2018-12-18 04:42:31 +00:00
Sanju Rakonde
0b4b111fbd glusterd: migrating rebalance commands to mgmt_v3 framework
Current rebalance commands use the op_state machine framework.
Porting it to use the mgmt_v3 framework.

Change-Id: I6faf4a6335c2e2f3d54bbde79908a7749e4613e7
fixes: bz#1655827
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
2018-12-18 04:01:52 +00:00
Poornima G
9ff080382c mem-pool: Add api to mem_get based on requested size
Currently mem-pool implementation provides api to get from the
mem pool based on the struct type. This is to retain api
compatibility with the old implementation of mem pool. Internally
in the mem pool structure there is a mapping from struct to size
based pools.

In this patch, we are adding new APIs to fetch memory from mem pool,
given a size.

Change-Id: Ib220ee45ebd134a7be8f6482db5a592dbb7b9211
Updates: #325
Signed-off-by: Poornima G <pgurusid@redhat.com>
2018-12-17 17:26:59 +00:00
Sunny Kumar
822779332e geo-rep : fix slave volume read-only option
Problem: When separate ssh key is given for non root user setting slave volume
         read-only option results in failure.

Solution: Check for extra param in case separate key is given for non-root user
          and take action accordingly.

Change-Id: Iafe9a2aa6b86cde1dcd7d63771048a6ae33c2cde
fixes: bz#1659971
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
2018-12-17 17:21:51 +00:00
Pranith Kumar K
c228f0c2d9 Don't depend on string options to be valid always
updates bz#1650403
Change-Id: Ib5a11e691599ce4bd93c1ed5aca6060592893961
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
2018-12-17 17:19:00 +00:00
Raghavendra Bhat
bdcb2d8497 features/snapview-client: access priv->path inside lock
To handle the race condition of a fop or a function accessing priv->path
and a reconfigure changing priv->path (because entry point directory
changed), the private structure's path is guarded by the lock.

updates bz#1650403
Change-Id: I61c539da06d68d38eafcf2155699c7702f31323e
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
2018-12-17 12:25:33 +00:00
Yaniv Kaul
403c69d358 AFR xlator: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}
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 xlators to use it.

- In some cases, moved strlen() of the key length outside of locks,
which is usually a good thing. Please verify it's safe to do so.
- In some cases, created a prefix for the keys, replacing something like
"%d-%d" with a "%s" in snprintf(). Not sure it adds value, but improves
readability.

Please review carefully.

Compile-tested only!

Change-Id: I04f2a1eb2ecfc3283d849d150d10d088ae7aa7f1
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2018-12-17 11:39:14 +00:00
Jiffin Tony Thottan
f0c46df09f selinux/glusterd : add "features.selinux" to glusterd-volume-set.c
Fixes: bz#1659868
Change-Id: I38675ba4d47c8ba7f94cfb4734692683ddb3dcfd
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
2018-12-17 06:45:46 +00:00
Kotresh HR
152907d438 cluster/afr: Fix mem leak reported by ASAN
Traceback:

Direct leak of 765 byte(s) in 9 object(s) allocated from:
    #0 0x7ffb9cad2c48 in malloc (/lib64/libasan.so.5+0xeec48)
    #1 0x7ffb9c5f8949 in __gf_malloc ./libglusterfs/src/mem-pool.c:136
    #2 0x7ffb9c5f91bb in gf_vasprintf ./libglusterfs/src/mem-pool.c:236
    #3 0x7ffb9c5f938a in gf_asprintf ./libglusterfs/src/mem-pool.c:256
    #4 0x7ffb826714ab in afr_get_heal_info ./xlators/cluster/afr/src/afr-common.c:6204
    #5 0x7ffb825765e5 in afr_handle_heal_xattrs ./xlators/cluster/afr/src/afr-inode-read.c:1481
    #6 0x7ffb825765e5 in afr_getxattr ./xlators/cluster/afr/src/afr-inode-read.c:1571
    #7 0x7ffb9c635af7 in syncop_getxattr ./libglusterfs/src/syncop.c:1680
    #8 0x406c78 in glfsh_process_entries ./heal/src/glfs-heal.c:810
    #9 0x408555 in glfsh_crawl_directory ./heal/src/glfs-heal.c:898
    #10 0x408cc0 in glfsh_print_pending_heals_type ./heal/src/glfs-heal.c:970
    #11 0x408fc5 in glfsh_print_pending_heals ./heal/src/glfs-heal.c:1012
    #12 0x409546 in glfsh_gather_heal_info ./heal/src/glfs-heal.c:1154
    #13 0x403e96 in main ./heal/src/glfs-heal.c:1745
    #14 0x7ffb99bc411a in __libc_start_main ../csu/libc-start.c:308

The dictionary is referenced by caller to print the status.
So set it as dynstr, the last unref of dictionary will free it.

updates: bz#1633930
Change-Id: Ib5a7cb891e6f7d90560859aaf6239e52ff5477d0
Signed-off-by: Kotresh HR <khiremat@redhat.com>
2018-12-17 04:46:08 +00:00
ShyamsundarR
b40bb5394d dht: Fix clang warnings in dht-common.c
Change-Id: I0894d62edd68e13d123aaa5ca1827b98283f0d3e
Updates: bz#1622665
Signed-off-by: ShyamsundarR <srangana@redhat.com>
2018-12-16 03:20:15 +00:00
Csaba Henk
eb77d69be5 fuse: SETLKW interrupt
Use the (f)getxattr based clearlocks interface to
interrupt a pending lock request.

updates: #465
Change-Id: I4e91a4d8791fc688fed400a02de4c53487e61be2
Signed-off-by: Csaba Henk <csaba@redhat.com>
2018-12-14 18:11:01 +00:00
Amar Tumballi
d49b41e817 fuse: add --lru-limit option
The inode LRU mechanism is moot in fuse xlator (ie. there is no
limit for the LRU list), as fuse inodes are referenced from
kernel context, and thus they can only be dropped on request of
the kernel. This might results in a high number of passive
inodes which are useless for the glusterfs client, causing a
significant memory overhead.

This change tries to remedy this by extending the LRU semantics
and allowing to set a finite limit on the fuse inode LRU.

A brief history of problem:

When gluster's inode table was designed, fuse didn't have any
'invalidate' method, which means, userspace application could
never ask kernel to send a 'forget()' fop, instead had to wait
for kernel to send it based on kernel's parameters. Inode table
remembers the number of times kernel has cached the inode based
on the 'nlookup' parameter. And 'nlookup' field is not used by
no other entry points (like server-protocol, gfapi etc).

Hence the inode_table of fuse module always has to have lru-limit
as '0', which means no limit. GlusterFS always had to keep all
inodes in memory as kernel would have had a reference to it.
Again, the reason for this is, kernel's glusterfs inode reference
was pointer of 'inode_t' structure in glusterfs. As it is a
pointer, we could never free it (to prevent segfault, or memory
corruption).

Solution:

In the inode table, handle the prune case of inodes with 'nlookup'
differently, and call a 'invalidator' method, which in this case is
fuse_invalidate(), and it sends the request to kernel for getting
the forget request.

When the kernel sends the forget, it means, it has dropped all
the reference to the inode, and it will send the forget with the
'nlookup' parameter too. We just need to make sure to reduce the
'nlookup' value we have when we get forget. That automatically
cause the relevant prune to happen.

Credits: Csaba Henk, Xavier Hernandez, Raghavendra Gowdappa, Nithya B

fixes: bz#1560969
Change-Id: Ifee0737b23b12b1426c224ec5b8f591f487d83a2
Signed-off-by: Amar Tumballi <amarts@redhat.com>
2018-12-14 17:34:28 +00:00
N Balachandran
fc74ef85e0 performance/rda: Fixed dict_t memory leak
Removed all references to dict_t xdata_from_req which is
allocated but not used anywhere. It is also not cleaned up
and hence causes a memory leak.

Change-Id: I2edb857696191e872ad12a12efc36999626bacc7
fixes: bz#1659432
Signed-off-by: N Balachandran <nbalacha@redhat.com>
2018-12-14 15:22:11 +00:00
Iraj Jamali
5ec271c316 glusterfsd: Fix coverity issue
Problem reported: value assigned to a variable is never used

Fixes CID : 1274230

updates: bz#789278

Change-Id: I7afcb411876dea81c6820c5b31ae0a2896f9ca15
Signed-off-by: Iraj Jamali <ijamali@redhat.com>
2018-12-14 12:05:28 +00:00
Anoop C S
a6a5f7aa6f extras: New group volume set command for Samba integration
# gluster volume set <VOLNAME> group samba

List of volume set options from group-samba are aimed at improving the below
workloads which consumes time and network hops in SMB world:

* Listing of large directories
* Negative lookups during creation of files  

Caching the necessary metadata required for these workloads saves us time and
network hops. On the other side we have to ensure correctness(avoiding stale
cache) in caching(via md-cache) with the help of cache invalidation in an
environment where multiple client access is expected.

Change-Id: Icdd2d8e5eb290e12bc509105418c668f432f4eae
fixes: bz#1656771
Signed-off-by: Anoop C S <anoopcs@redhat.com>
2018-12-14 05:13:40 +00:00
Csaba Henk
930d8b7061 locks: handle "clear locks" xattr in fgetxattr too
The lock clearing procedure was kicked in only in
getxattr context. We need it to work the same way
if it's triggered via fgetxattr (as is the case
with interrupt handling).

Also cleaned up the instrumentation a bit (more logs,
proper management of allocated data).

updates: #465
Change-Id: Icfca26ee181da3b8e15ca3fcf61cd5702e2730c8
Signed-off-by: Csaba Henk <csaba@redhat.com>
2018-12-14 04:54:28 +00:00
Yaniv Kaul
e3d01793a3 Multiple posix related files: several modifications
Just looked at posix.c and related code and performed
some changes and cleanups. The only important one is #3 below,
but surely the others (#2 and #4) need careful review.
Changes to other files are as they were related to code paths
in posix.c.

I'll send a separate patch for other posix related files.

Main changes:
1. Proper initializtion for parameters, where it made sense.
2. Logged outside the lock in several places.
3. Moved from CALLOC to MALLOC where it made sense.
4. Aligned structures.
5. moved dictionary functions to use _sizen where possible.
(dict_get() -> dict_get_sizen() for example)

Compile-tested only!

Change-Id: Ia84699fb495e06d095339c91c1ba770d1393bb6c
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2018-12-14 04:53:36 +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
Sheetal Pamecha
64d800940e cluster/ec: NULL pointer deferencing clang fix
Removing VALIDATE_OR_GOTO check on "this"

Change-Id: I154deaca5302b41c1cafd87077de880dd03ec613
Updates: bz#1622665
Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
2018-12-14 04:33:45 +00:00
ShyamsundarR
bfe2b5e153 clang: Fix various missing checks for empty list
When using list_for_each_entry(_safe) functions, care needs
to be taken that the list passed in are not empty, as these
functions are not empty list safe.

clag scan reported various points where this this pattern
could be caught, and this patch fixes the same.

Additionally the following changes are present in this patch,
- Added an explicit op_ret setting in error case in the
macro MAKE_INODE_HANDLE to address another clang issue reported
- Minor refactoring of some functions in quota code, to address
possible allocation failures in certain functions (which in turn
cause possible empty lists to be passed around)

Change-Id: I1e761a8d218708f714effb56fa643df2a3ea2cc7
Updates: bz#1622665
Signed-off-by: ShyamsundarR <srangana@redhat.com>
2018-12-14 04:33:15 +00:00
Amar Tumballi
8293d21280 all: remove code which is not being considered in build
These xlators are now removed from build as per discussion/announcement
done at https://lists.gluster.org/pipermail/gluster-users/2018-July/034400.html

* move rot-13 to playground, as it is used only as demo
  purpose, and is documented in many places.

* Removed code of below xlators:
  - cluster/stripe
  - cluster/tier
  - features/changetimerecorder
  - features/glupy
  - performance/symlink-cache
  - encryption/crypt
  - storage/bd
  - experimental/posix2
  - experimental/dht2
  - experimental/fdl
  - experimental/jbr

updates: bz#1635688
Change-Id: I1d2d63c32535e149bc8dcb2daa76236c707996e8
Signed-off-by: Amar Tumballi <amarts@redhat.com>
2018-12-13 17:10:00 +00:00
Amar Tumballi
af7e957b49 xlator: make 'xlator_api' mandatory
* Remove the options to load old symbol.
* keep only 'xlator_api' symbol from being exported using xlator.sym
* add xlator_api to all the xlators where its missing

NOTE: This covers all the xlators which has at least a test case
to validate its loading. If there is a translator, which doesn't
have any test, then we should probably remove that from codebase.

fixes: #164
Change-Id: Ibcdc8c9844cda6b4463d907a15813745d14c1ebb
Signed-off-by: Amar Tumballi <amarts@redhat.com>
2018-12-13 14:41:50 +05:30
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