summaryrefslogtreecommitdiffstats
path: root/libglusterfs
Commit message (Collapse)AuthorAgeFilesLines
* Posix: Optimize posix code to improve file creationMohit Agrawal2020-04-063-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Before executing a fop in POSIX xlator it builds an internal path based on GFID.To validate the path it call's (l)stat system call and while .glusterfs is heavily loaded kernel takes time to lookup inode and due to that performance drops Solution: In this patch we followed two ways to improve the performance. 1) Keep open fd specific to first level directory(gfid[0]) in .glusterfs, it would force to kernel keep the inodes from all those files in cache. In case of memory pressure kernel won't uncache first level inodes. We need to open 256 fd's per brick to access the entry faster. 2) Use at based call's to access relative path to reduce path based lookup time. Note: To verify the patch we have executed kernel untar 100 times on 6 different clients after enabling metadata group-cache and some other option.We were getting more than 20 percent improvement in kenel untar after applying the patch. Credits: Xavi Hernandez <xhernandez@redhat.com> Change-Id: I1643e6b01ed669b2bb148d02f4e6a8e08da45343 updates: #891 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* core[brick_mux]: brick crashed when creating and deleting volumes over timeMohit Agrawal2020-03-271-8/+26
| | | | | | | | | | | | | | | | | Problem: In brick_mux environment, while volumes are created/stopped in a loop after running a long time the main brick is crashed.The brick is crashed because the main brick process was not cleaned up memory for all objects at the time of detaching a volume. Below are the objects that are missed at the time of detaching a volume 1) xlator object for a brick graph 2) local_pool for posix_lock xlator 3) rpc object cleanup at quota xlator 4) inode leak at brick xlator Solution: To avoid the crash resolve all leak at the time of detaching a brick Change-Id: Ibb6e46c5fba22b9441a88cbaf6b3278823235913 updates: #977 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* Posix: Use simple approach to close fdMohit Agrawal2020-03-202-11/+2
| | | | | | | | | | | | | | | Problem: posix_release(dir) functions add the fd's into a ctx->janitor_fds and janitor thread closes the fd's.In brick_mux environment it is difficult to handle race condition in janitor threads because brick spawns a single janitor thread for all bricks. Solution: Use synctask to execute posix_release(dir) functions instead of using background a thread to close fds. Credits: Pranith Karampuri <pkarampu@redhat.com> Change-Id: Iffb031f0695a7da83d5a2f6bac8863dad225317e Fixes: bz#1811631 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* utime: resolve an issue of permission denied logsAmar Tumballi2020-03-131-1/+2
| | | | | | | | | | | | In case where uid is not set to be 0, there are possible errors from acl xlator. So, set `uid = 0;` with pid indicating this is set from UTIME activity. The message "E [MSGID: 148002] [utime.c:146:gf_utime_set_mdata_setxattr_cbk] 0-dev_SNIP_data-utime: dict set of key for set-ctime-mdata failed [Permission denied]" repeated 2 times between [2019-12-19 21:27:55.042634] and [2019-12-19 21:27:55.047887] Change-Id: Ieadf329835a40a13ac0bf908dac776e66954466c Fixes: #832 Signed-off-by: Amar Tumballi <amar@kadalu.io>
* Segmentation fault occurs during truncatekinsu2020-02-241-0/+8
| | | | | | | | | | | | | | | | | | | | Problem: Segmentation fault occurs when bricks are nearly full 100% and in parallel truncate of a file is attempted (No space left on device). Prerequicite is that performance xlators are activated (read-ahead, write-behind etc) while stack unwind of the frames following an error responce from brick (No space left on device) frame->local includes a memory location that is not allocated via mem_get but via calloc. The destroyed frame is always ra_truncate_cbk winded from ra_ftruncate and the inode ptr is copied to the frame local in the wb_ftruncate. Fix: extra check is added for the pool ptr Change-Id: Ic5d3bd0ab7011e40b2811c6dece063b256e4d9d1 Fixes: bz#1797882 Signed-off-by: kinsu <vpolakis@gmail.com>
* core: Prevent crash on process terminationXavi Hernandez2020-02-191-19/+11
| | | | | | | | | | | | | | | A previous patch (ce61da816a) has fixed a use-after-free issue, but it doesn't work well when the final cleanup is done at process termination because gluster doesn't stop other threads before calling exit(). For this reason, the final cleanup is removed to avoid the crash, at least until the termination sequence properly stops all gluster threads before exiting the program. Change-Id: Id7cfb4407fcf208e28f03a7c3cdc3ef9c1f3bf9b Fixes: bz#1801684 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* core: fix memory pool management racesXavi Hernandez2020-02-185-106/+146
| | | | | | | | | | | | | | | | | | | | | | Objects allocated from a per-thread memory pool keep a reference to it to be able to return the object to the pool when not used anymore. The object holding this reference can have a long life cycle that could survive a glfs_fini() call. This means that it's unsafe to destroy memory pools from glfs_fini(). Another side effect of destroying memory pools from glfs_fini() is that the TLS variable that points to one of those pools cannot be reset for all alive threads. This means that any attempt to allocate memory from those threads will access already free'd memory, which is very dangerous. To fix these issues, mem_pools_fini() doesn't destroy pool lists anymore. Only at process termination the pools are destroyed. Change-Id: Ib189a5510ab6bdac78983c6c65a022e9634b0965 Fixes: bz#1801684 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* libglusterfs-xlator: structure loggingyatipadia2020-02-144-135/+141
| | | | | | | | convert all gf_msg() to gf_smsg() Change-Id: Id542e05faadb8041b472a2298c71fe62730e65fc Updates: #657 Signed-off-by: yatipadia <ypadia@redhat.com>
* volgen: make thin-arbiter name unique in 'pending-xattr' optionAmar Tumballi2020-02-121-0/+1
| | | | | | | | | | Thin-arbiter module makes use of 'pending-xattr' name for the translator as the filename which gets created in thin-arbiter node. By making this unique, we can host single thin-arbiter node for multiple clusters. Updates: #763 Change-Id: Ib3c732e7e04e6dba229e71ae3e64f1f3cb6d794d Signed-off-by: Amar Tumballi <amar@kadalu.io>
* libglusterfs-options: structure loggingyatipadia2020-02-093-82/+100
| | | | | | | | convert all gf_msg() to gf_smsg() Change-Id: I8f1ff462b9c8012ed676c51450930a65ac403bf3 Updates: #657 Signed-off-by: yatipadia <ypadia@redhat.com>
* bitrot: Make number of signer threads configurableKotresh HR2020-02-071-0/+1
| | | | | | | | | | | | | 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>
* libglusterfs-event-epoll: structure loggingyatipadia2020-02-064-109/+114
| | | | | | | | convert gf_msg() to gf_smsg() Change-Id: Idf5bfc826b0c9f1a2674eea2a2e6164f30806b00 Updates: #657 Signed-off-by: yatipadia <ypadia@redhat.com>
* glusterfsd: structure loggingyatipadia2020-02-062-19/+23
| | | | | | | | convert gf_msg() to gf_smsg() Change-Id: I1cd6a5ac6f4361195d5d925efb2cc194045d0bba Updates: #657 Signed-off-by: yatip <ypadia@redhat.com>
* libglusterfs/common-utils: structure loggingyatipadia2020-02-042-122/+130
| | | | | | | | changes all the gf_msg() to gf_smgs() Change-Id: I3524bbd8f8070df2f2c888ea9b0fb7db1ee44453 Updates: #657 Signed-off-by: yatipadia <ypadia@redhat.com>
* dictionary: remove the 'extra_free' parameterYaniv Kaul2020-01-212-2/+0
| | | | | | | | | | | | | | | This parameter may have been used in the past, but is no longer needed. Removing it and the few locations it was actually referenced. This allows to remove an extra memdup as well, that was not needed in the 1st place in server_setvolume() and unserialize_rsp_direntp() functions. A followup separate patch will remove extra_stdfree parmeter from the dictionary structure. Change-Id: Ica0ff0a330672373aaa60e808b7e76ec489a0fe3 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* events: fix IPv6 memory corruptionXavi Hernandez2020-01-171-41/+15
| | | | | | | | | | | | | When an event was generated and the target host was resolved to an IPv6 address, there was a memory overflow when that address was copied to a fixed IPv4 structure (IPv6 addresses are longer than IPv4 ones). This fix correctly handles IPv4 and IPv6 addresses returned by getaddrinfo() Change-Id: I5864a0c6e6f1b405bd85988529570140cf23b250 Fixes: bz#1790870 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* dict: use the free_pair's key presence or NULL as a sign of use.Yaniv Kaul2020-01-132-18/+15
| | | | | | | | | | | | | Instead of using a boolean parameter, we can use the key variable. If it's NULL, the pair is not used and can be used. Otherwise, it's in use - don't use. It saves this annoying boolean, which causes the compiler (or us explicitly) to pad with additional bytes the dict struct. Change-Id: I89f52db57f35b3ef8acf57b7de2cee37f5d18e06 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* afr: expose cluster.optimistic-change-log to CLI.Ravishankar N2020-01-071-0/+1
| | | | | | | | | | | This volume option was not made avaialble to `gluster volume set` CLI. Reported-by: epolakis(https://github.com/kinsu) in https://github.com/gluster/glusterfs/issues/781 fixes: bz#1787554 Change-Id: I7141bdd4e53ee99e22b354edde8d023bfc0b2cd7 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* cli, libglusterfs: rely on libpthread static initializersDmitry Antipov2020-01-011-26/+11
| | | | | | | | | | | | cli-cmd.c: drop cli_cmd_cond_init() because static mutex and condition variable are initialized with PTHREAD_xxx_INITIALIZERs. syncop-utils.c: since assignment PTHREAD_xxx_INITIALIZERs are never failed, a few overengineered bits may be simplified. Change-Id: Ic4d250a1697047386989f73f058b0abc8b55627b Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: bz#1193929
* posix-entry-ops.c: remove some tier related codeYaniv Kaul2020-01-011-1/+0
| | | | | | | | | | | Remove TIER_LINKFILE_GFID related code from posix Tier xlator was removed, but there are some code related to it scattered around in DHT and Posix xlators. Remove some of it. Change-Id: I3a878b31ed4a045ed419f936aa1d567ded1a273f updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* Avoid buffer overwrite due to uuid_utoa() misuseDmitry Antipov2019-12-271-5/+7
| | | | | | | | | | | | | | | Code like: f(..., uuid_utoa(x), uuid_utoa(y)); is not valid (causes undefined behaviour) because uuid_utoa() uses the only static thread-local buffer which will be overwritten by the subsequent call. All such cases should be converted to use uuid_utoa_r() with explicitly specified buffer. Change-Id: I5e72bab806d96a9dd1707c28ed69ca033b9c8d6c Updates: bz#1193929 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
* timer: fix event destruction raceXavi Hernandez2019-12-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In current timer implementation, each event has an absolute time at which it will be fired. When the first timer of the queue has not elapsed yet, a pthread_cond_timedwait() is used to wait until the expected time. Apparently that's fine. However the time passed to that function was a pointer to the timespec structure contained in the event itself. This is problematic because of how pthread_cond_timedwait() works internally. Simplifying a bit, pthread_cond_timedwait() basically queues itself as a waiter for the given condition variable and releases the mutex. Then it does the timed wait using the passed value. With that in mind, the follwing case is possible: Timer Thread Other Thread ------------ ------------ gf_timer_call_cancel() pthread_mutex_lock() | + pthread_mutex_lock() event = current_event() | pthread_cond_timedwait(&event->at) | + pthread_mutex_unlock() | | + remove_event() | + destroy_event() + timed_wait(&event->at) As we can see, the time is used after it has been destroyed, which means we have a use-after-free problem. This patch fixes the problem by copying the time to a local variable before calling pthread_cond_timedwait() Change-Id: I0f4e8eded24fe3a1276dc75c6cf093bae973d26b Signed-off-by: Xavi Hernandez <xhernandez@redhat.com> Fixes: bz#1785208
* Revert "store.c: remove a sys_stat() call - just open the file"Sanju Rakonde2019-12-251-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit da735ad9b58b76d27c580a9feb63f14b2cc0669d. This commit is changing the behaviour of glusterd during its initialization. The removed piece of code checks whether the file mentioned in the path exists or not, if not it returns -1. This return value is considered for the sub sequent operations. By removing this code, we always return 0 and some part of the code will not be executed in the following code path. glusterd_options_init() -> glusterd_store_retrieve_options() -> gf_store_handle_retrieve() In glusterd_options_init(), we are not executing any code if the ret value is 0. ret = glusterd_store_retrieve_options(this); if (ret == 0) { goto out; } as we are not executing any code if the return value is 0, we are unable to enable the brick-multiplex feature using volume set. fixes: bz#1786459 Change-Id: I4f52b7b2ea8adb8df5087bb96927e9bb7db5b491
* libglusterfs/logger - code cleaningBarak Sason2019-12-201-56/+35
| | | | | | | | | | | Fixes: bz#1765186 1 - Removed code duplication of 'log_levles' array 2 - Declared all static methods at the begining of the .c file 3 - Removed unused structs that existed in the .c file Change-Id: I37330cb133fc65deac69b7ca60779f70501c24ea Signed-off-by: Barak Sason <bsasonro@redhat.com>
* store.c: remove a sys_stat() call - just open the fileYaniv Kaul2019-12-201-10/+1
| | | | | | | | | I don't see the value on performing a sys_stat() on a path instead of just trying to open the file. Change-Id: Ib3f88d8c45aea091eafea17c4be02e2acdb713f1 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: refactoring long methodBarak Sason Rofman2019-12-191-1/+1
| | | | | | | | | | | - Refactored set_fuse_mount_options(...) in order to shorten it. - Removed dead code and moved some method to it's apropriate location. - Converted loggin in set_fuse_mount_options(...) to structured logs fixes: bz#1768896 Change-Id: If865833d4c60d517da202871978691ef21235fe4 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
* call-stub.c: remove redundant validationYaniv Kaul2019-12-181-163/+0
| | | | | | | | | | | | GF_VALIDATE_OR_GOTO("call-stub", frame, out) is removed. It's not needed, since we are testing via the creation of a stub, in stub_new() that frame is not NULL. Removed all redundant checks, which saves >10% in object size. Change-Id: If4ce3a3dc506a5e65e98b59fa51b1fdd389a85ba updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* afr: make heal info locklessRavishankar N2019-12-121-0/+2
| | | | | | | | | | | | | | | | | | | Changes in locks xlator: Added support for per-domain inodelk count requests. Caller needs to set GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS key in the dict and then set each key with name 'GLUSTERFS_INODELK_DOM_PREFIX:<domain name>'. In the response dict, the xlator will send the per domain count as values for each of these keys. Changes in AFR: Replaced afr_selfheal_locked_inspect() with afr_lockless_inspect(). Logic has been added to make the latter behave same as the former, thus not breaking the current heal info output behaviour. fixes: bz#1774011 Change-Id: Ie9e83c162aa77f44a39c2ba7115de558120ada4d Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* rpc: event_slot_alloc converted infinite loop after reach slot_used to 1024Mohit Agrawal2019-12-101-1/+1
| | | | | | | | | | | | | Problem: In the commit faf5ac13c4ee00a05e9451bf8da3be2a9043bbf2 missed one condition to come out from the loop so after reach the slot_used to 1024 loop has become infinite loop Solution: Correct the code path to avoid the infinite loop Change-Id: Ia02a109571f0d8cc9902c32db3e9b9282ee5c1db Fixes: bz#1781440 Credits: Xavi Hernandez <xhernandez@redhat.com> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* ctime: Fix ctime inconsisteny with utimensatKotresh HR2019-12-101-0/+2
| | | | | | | | | | | | | | | | | | | | Problem: When touch is used to create a file, the ctime is not matching atime and mtime which ideally should match. There is a difference in nano seconds. Cause: When touch is used modify atime or mtime to current time (UTIME_NOW), the current time is taken from kernel. The ctime gets updated to current time when atime or mtime is updated. But the current time to update ctime is taken from utime xlator. Hence the difference in nano seconds. Fix: When utimesat uses UTIME_NOW, use the current time from kernel. fixes: bz#1773530 Change-Id: I9ccfa47dcd39df23396852b4216f1773c49250ce Signed-off-by: Kotresh HR <khiremat@redhat.com>
* core: fix spelling mistakesSanju Rakonde2019-12-091-1/+1
| | | | | | | | | fixes: bz#1728554 credits: Patrick Matthäi <pmatthaei@debian.org> Change-Id: Id08dabf54a529dbb86666b544b1f0859aab75aac Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* core: avoid NULL pointer dereferenceDmitry Antipov2019-12-051-4/+13
| | | | | | | | | Since low-level __gf_xxx allocation function may be called before ctx is initialized, add extra check for NULL where appropriate. Fixes: bz#1776784 Change-Id: I3127fa4b93f8e3e5846106aadcfed1baa27ac43f Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
* debug/io-stats: add an option to set volume-idAmar Tumballi2019-11-291-0/+1
| | | | | | | | | | | 'volume-id' is good to have for a graph for uniquely identifying it. Add it to graph->volume_id while generating volfile itself. This can be further used in many other places. Updates: #763 Change-Id: I80516d62d28a284e8ff4707841570ced97a37e73 Signed-off-by: Amar Tumballi <amar@kadalu.io>
* Revert "afr: make heal info lockless"Ravishankar N2019-11-281-2/+0
| | | | | | | | This reverts commit fce5f68bc72d448490a0d41be494ac54a9181b3c. I merged the wrong patch by mistake! Hence reverting it. updates: bz#1774011 Change-Id: Id7d6ed1d727efc02467c8a9aea3374331261ebd5
* afr: make heal info locklessRavishankar N2019-11-281-0/+2
| | | | | | | | | | | | | | | | | | | Changes in locks xlator: Added support for per-domain inodelk count requests. Caller needs to set GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS key in the dict and then set each key with name 'GLUSTERFS_INODELK_DOM_PREFIX:<domain name>'. In the response dict, the xlator will send the per domain count as values for each of these keys. Changes in AFR: Replaced afr_selfheal_locked_inspect() with afr_lockless_inspect(). Logic has been added to make the latter behave same as the former, thus not breaking the current heal info output behaviour. fixes: bz#1774011 Change-Id: I9ae08ce768b39aeb6ee230207b5b7fa744176952 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* common-utils.c: add gf_strn2boolean() functionYaniv Kaul2019-11-273-1/+71
| | | | | | | | | | | | | | | | | | | | | The function takes a string and its length and based on it returns if it's a boolean. It's identical in functionality to gf_string2boolean only with far less string comparisons since it takes into account the length of the string. dict_get_str_boolean() has been converted to use it. Other cases of gf_string2boolean() across the code base can be converted as well, but more importantly, they should be converted from dict_get_str() and then calling to gf_string2boolean to simply call dict_get_str_boolean(), which would take care of this for them. This is therefore a first step in the conversion. Change-Id: I9ee93abfc676f6e123a3919d8df8c25e8848b799 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* store.c/glusterd-store.c: remove sys_stat callsYaniv Kaul2019-11-272-65/+10
| | | | | | | | | | | | | | | Instead of querying for the file size and allocating a char array according to its size, let's just use a fixed size. Those calls are not really needed, and are either expensive or cached anyway. Since we do dynamic allocation/free, let's just use a fixed array instead. I'll see if there are other sys_stat() calls that are not really useful and try to eliminate them in separate patches. Change-Id: I76b40e78a52ab38f613fc0cdef4be60e6253bf20 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* libglusterfs: remove unused gfdb specific files from repoAmar Tumballi2019-11-1814-5634/+1
| | | | | | Updates: bz#1193929 Change-Id: Idb98394c51917e9b132aeb32facccd112effe672 Signed-off-by: Amar Tumballi <amarts@gmail.com>
* Revert "dict.c: remove redundant checks"MOHIT AGRAWAL2019-11-151-27/+103
| | | | | | | | | | This patch floods of dict_log at the time accessing key from dict if dict is not valid so revert the patch. This reverts commit ccf33e789f2cbd202e21340f684e2140d844a129. Change-Id: I81fa3b080a2f784254b519044ad284858583ec66 updates: bz#1193929
* libglusterfs/dict.c: Fix memory leaks.Xi Jinyu2019-11-121-0/+11
| | | | | | fixes: bz#1771365 Change-Id: Id31687c4704cbbfea1084f912ed0420c7d1cc1ec Signed-off-by: Xi Jinyu <xijinyu@cmss.chinamobile.com>
* glusterd: Client Handling of Elastic ClustersMohit Agrawal2019-11-121-1/+1
| | | | | | | | | | | | | | Configure the list of gluster servers in the key GLUSTERD_BRICK_SERVERS at the time of GETSPEC RPC CALL and access the value in client side to update volfile serve list so that client would be able to connect next volfile server in case of current volfile server is down Updates #741 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Change-Id: I23f36ddb92982bb02ffd83937a8bd8a2c97e8104
* dict.c: remove redundant checksYaniv Kaul2019-11-071-103/+27
| | | | | | | | | It removes ~2% of the object size, and did not add meaningful checks whatsoever or to readability (IMHO). Change-Id: I54346c2af47dcab13bd8d5c8ad52fc765e6afad4 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* iobuf.c, h: minor fixesYaniv Kaul2019-11-072-61/+37
| | | | | | | | | | | | | | - Align structures - gf_iobuf_get_pagesize() will now also return the index, reducing the need for an additional very similar call. - Removal of an inefficient loop I've inadvertently added previously. It was harmless, but just inefficient. - New pool initialization does not need to be done under lock - no one can touch that pool yet, so no need to protect it. Change-Id: I61c50f2f14fa79edc131e515e9615a9928ee2dca updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix-helpers.c (and others): minor changes to posix_xattr_fill()Yaniv Kaul2019-11-062-5/+2
| | | | | | | | | | | | | | | | posix_xattr_fill() is called from several POSIX functions. Made minor changes to it and the functions called from it: 1. Dict functions to use known lengths (dict_getn() instead of dict_get(), etc.) 2. Re-ordered some static char[] arrays, to account (hopefully) to the frequency of the xattrs usage (based on grep in the code...) 3. Before strcmp(), check if the strings lengths match. 4. Removed some dead code. Hopefully, no functional changes. Change-Id: I510c0d2785e54ffe0f82c4c449782f2302d63a32 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* dict.c: remove one strlen() done under lock.Yaniv Kaul2019-11-051-10/+12
| | | | | | | | It's not needed in some cases, where we can pass the key length. Change-Id: I2e8ed0b69c50a35f5858bae7c1755a0dfd2c77e5 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* gf-event: Handle unix volfile-serversPranith Kumar K2019-10-301-1/+10
| | | | | | | | | | | | | | | Problem: glfsheal program uses unix-socket-based volfile server. volfile server will be the path to socket in this case. gf_event expects this to be hostname in all cases. So getaddrinfo will fail on the unix-socket path, events won't be sent in this case. Fix: In case of unix sockets, default to localhost fixes: bz#1765017 Change-Id: I60d27608792c29d83fb82beb5fde5ef4754bece8 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
* rpc: Synchronize slot allocation codeMohit Agrawal2019-10-221-33/+41
| | | | | | | | | | | | | Problem: Current slot allocation/deallocation code path is not synchronized.There are scenario when due to race condition in slot allocation/deallocation code path brick is crashed. Solution: Synchronize slot allocation/deallocation code path to avoid the issue Change-Id: I4fb659a75234218ffa0e5e0bf9308f669f75fc25 Fixes: bz#1763036 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* dict.{c,h}: remove the lock from the _data structYaniv Kaul2019-10-112-5/+0
| | | | | | | | | I'm not sure why it was there and I did not see any use for it. In the hope I did not miss anything, I removed it. Change-Id: I02fa2e8e2a598b488fddbff4c7168dc4a41929b2 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* protocol/handshake: pass volume-id for extra checkAmar Tumballi2019-09-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With added check of volume-id during handshake, we can be sure to not connect with a brick if this gets re-used in another volume. This prevents any accidental issues which can happen with a stale client process lurking along. Also added test case for testing same volume name which would fetch a different volfile (ie, different bricks, different type), and a different volume name, but same brick. For reference: Currently a client<->server handshake happens in glusterfs through protocol/client translator (setvolume) to protocol/server using a dictionary which containes many keys. Rejection happens in server side if some of the required keys are missing in handshake dictionary. Till now, there was no single unique identifier to validate for a client to tell server if it is actually talking to a corresponding server. All we look in protocol/client is a key called 'remote-subvolume', which should match with a subvolume name in server volume file, and for any volume with same brick name (can be present in same cluster due to recreate), it would be same. This could cause major issue, when a client was connected to a given brick, in one volume would be connected to another volume's brick if its re-created/re-used. To prevent this behavior, we are now passing along 'volume-id' in handshake, which would be preserved for the life of client process, which can prevent this accidental connections. NOTE: This behavior wouldn't be applicable for user-snapshot enabled volumes, as snapshotted volume's would have different volume-id. Fixes: bz#1620580 Change-Id: Ie98286e94ce95ae09c2135fd6ec7d7c2ca1e8095 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* eventsapi: Set IPv4/IPv6 family based on input IPAravinda VK2019-09-171-1/+4
| | | | | | | | | | | | server.sin_family was set to AF_INET while creating socket connection, this was failing if the input address is IPv6(`::1`). With this patch, sin_family is set by reading the ai_family of `getaddrinfo` result. Fixes: bz#1752330 Change-Id: I499f957b432842fa989c698f6e5b25b7016084eb Signed-off-by: Aravinda VK <avishwan@redhat.com>