summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
Commit message (Collapse)AuthorAgeFilesLines
* volgen: add an option to disable aclAmar Tumballi2020-06-172-2/+26
| | | | | | | | | | | | | | | Also add a message saying this is to be used only for 'debug' purpose only. This is helpful to corner the issue to acl. There were recently many issues reported related to permissions, and acl access denied bugs. The bugs were elsewhere, but to validate them and to get people back to service (in certain cases like oVirt, where gluster volumes are used mostly by single user), this option can be used. Updates: #876 Change-Id: I7be4401153607e11c9efb831ab794df4176604df Signed-off-by: Amar Tumballi <amar@kadalu.io>
* glusterd: migrating remove-brick commands to mgmt v3 frameworkSanju Rakonde2020-06-173-9/+136
| | | | | | | | | | | Currently remove-brick commands follow sync-op framework. For code extensibility (like, adding more phases in the trnasaction) we are migrating the command to mgmt v3 framework. fixes: #1164 Change-Id: I5d363223d6f9dc7a70b61adb9d3a5250e84a71b4 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* Indicate timezone offsets in timestampsCsaba Henk2020-06-153-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logs and other output carrying timestamps will have now timezone offsets indicated, eg.: [2020-03-12 07:01:05.584482 +0000] I [MSGID: 106143] [glusterd-pmap.c:388:pmap_registry_remove] 0-pmap: removing brick (null) on port 49153 To this end, - gf_time_fmt() now inserts timezone offset via %z strftime(3) template. - A new utility function has been added, gf_time_fmt_tv(), that takes a struct timeval pointer (*tv) instead of a time_t value to specify the time. If tv->tv_usec is negative, gf_time_fmt_tv(... tv ...) is equivalent to gf_time_fmt(... tv->tv_sec ...) Otherwise it also inserts tv->tv_usec to the formatted string. - Building timestamps of usec precision has been converted to gf_time_fmt_tv, which is necessary because the method of appending a period and the usec value to the end of the timestamp does not work if the timestamp has zone offset, but it's also beneficial in terms of eliminating repetition. - The buffer passed to gf_time_fmt/gf_time_fmt_tv has been unified to be of GF_TIMESTR_SIZE size (256). We need slightly larger buffer space to accommodate the zone offset and it's preferable to use a buffer which is undisputedly large enough. This change does *not* do the following: - Retaining a method of timestamp creation without timezone offset. As to my understanding we don't need such backward compatibility as the code just emits timestamps to logs and other diagnostic texts, and doesn't do any later processing on them that would rely on their format. An exception to this, ie. a case where timestamp is built for internal use, is graph.c:fill_uuid(). As far as I can see, what matters in that case is the uniqueness of the produced string, not the format. - Implementing a single-token (space free) timestamp format. While some timestamp formats used to be single-token, now all of them will include a space preceding the offset indicator. Again, I did not see a use case where this could be significant in terms of representation. - Moving the codebase to a single unified timestamp format and dropping the fmt argument of gf_time_fmt/gf_time_fmt_tv. While the gf_timefmt_FT format is almost ubiquitous, there are a few cases where different formats are used. I'm not convinced there is any reason to not use gf_timefmt_FT in those cases too, but I did not want to make a decision in this regard. Change-Id: I0af73ab5d490cca7ed8d07a2ce7ac22a6df2920a Updates: #837 Signed-off-by: Csaba Henk <csaba@redhat.com>
* glusterd: destroy all volume info locks and mutexesDmitry Antipov2020-06-102-2/+5
| | | | | | | | | | Add destroy calls for 'store_volinfo_lock' and 'lock' of volume info. Move initialization of 'store_volinfo_lock' from glusterd_op_create_volume() to common place, which is glusterd_volinfo_new() indeed. Change-Id: I5fae4469f28eab80c4fa6f5947646528e6aedad7 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1291
* test: Test case brick-mux-validation-in-cluster.t is failing on RHEL-8Mohit Agrawal2020-06-092-2/+8
| | | | | | | | | | | | | | | | | | | | | Brick process are not properly attached on any cluster node while some volume options are changed on peer node and glusterd is down on that specific node. Solution: At the time of restart glusterd it got a friend update request from a peer node if peer node having some changes on volume.If the brick process is started before received a friend update request in that case brick_mux behavior is not workingproperly. All bricks are attached to the same process even volumes options are not the same. To avoid the issue introduce an atomic flag volpeerupdate and update the value while glusterd has received a friend update request from peer for a specific volume.If volpeerupdate flag is 1 volume is started by glusterd_import_friend_volume synctask Change-Id: I4c026f1e7807ded249153670e6967a2be8d22cb7 Credit: Sanju Rakaonde <srakonde@redhat.com> fixes: #1290 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* glusterd: To do full heal in different online node when do ec/afr full healyinkui2020-06-091-3/+36
| | | | | | | | | | | | | | | | | | | For example: We have 3 nodes and create ec 3*(2+1) volume for test-disperse-0/test-disperse-1/test-disperse-2 when we do 'gluster v heal test full' in node-1 that can in node-1/ node-2/node-3 glustershd's get op=GF_EVENT_TRANSLATOR_OP and then do full heal in different disperse group. Let us say we have 2X(2+1) disperse with each brick from different machine m0, m1, m2, m3, m4, m5. and candidate_max is m5. and do full heal so '*index' is 3 and !gf_uuid_compare(MY_UUID, brickinfo->uuid) will be true in m3,and then m3's glustershd will be the heal-xlator. Id: I5c6762e6cfb375aed32d3fc11fe5eae3ee41aab4 Signed-off-by: yinkui <13965432176@163.com> Change-Id: Ic7ef3ddfd30b5f4714ba99b4e7b708c927d68764 fixes: bz#1724948
* glusterd: check for same node while adding bricks in disperse volumeSheetal Pamecha2020-06-064-238/+248
| | | | | | | | | | | | | | | The optimal way for configuring disperse and replicate volumes is to have all bricks in different nodes. During create operation it fails saying it is not optimal, user must use force to over-ride this behavior. Implementing same during add-brick operation to avoid situation where all the added bricks end up from same host. Operation will error out accordingly. and this can be over-ridden by using force same as create. fixes: #1047 Change-Id: I3ee9c97c1a14b73f4532893bc00187ef9355238b Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
* glusterd: fix memory leak in glusterd_store_retrieve_bricks()Dmitry Antipov2020-06-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Found with GCC's address sanitizer: ==67190==ERROR: LeakSanitizer: detected memory leaks Direct leak of 24624 byte(s) in 6 object(s) allocated from: #0 0x7f62535c0837 in __interceptor_calloc (/usr/lib64/libasan.so.6+0xb0837) #1 0x7f62532a1690 in __gf_default_calloc glusterfs/mem-pool.h:122 #2 0x7f62532a20ca in __gf_calloc /path/to/glusterfs/libglusterfs/src/mem-pool.c:144 #3 0x7f62532c8128 in gf_store_iter_new /path/to/glusterfs/libglusterfs/src/store.c:511 #4 0x7f623e2f9ed7 in glusterd_store_retrieve_bricks /path/to/glusterfs/xlators/mgmt/glusterd/src/glusterd-store.c:2389 Direct leak of 8208 byte(s) in 2 object(s) allocated from: #0 0x7f62535c0837 in __interceptor_calloc (/usr/lib64/libasan.so.6+0xb0837) #1 0x7f62532a1690 in __gf_default_calloc glusterfs/mem-pool.h:122 #2 0x7f62532a20ca in __gf_calloc /path/to/glusterfs/libglusterfs/src/mem-pool.c:144 #3 0x7f62532c8128 in gf_store_iter_new /path/to/glusterfs/libglusterfs/src/store.c:511 #4 0x7f623e2f9cf0 in glusterd_store_retrieve_bricks /path/to/glusterfs/xlators/mgmt/glusterd/src/glusterd-store.c:2363 #5 0x7fff5cb70bcf ([stack]+0x15bcf) #6 0x7f623e309113 in glusterd_store_retrieve_volumes /path/to/glusterfs/xlators/mgmt/glusterd/src/glusterd-store.c:3505 #7 0xfffeb96e61d (<unknown module>) #8 0x7f623e4586d7 (/usr/lib64/glusterfs/9dev/xlator/mgmt/glusterd.so+0x2f86d7) Change-Id: I9b2a543dc095f4fa739cd664fd4d608bf8c87d60 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1263
* io-cache,quick-read: deprecate volume options with flawed semantics or namingCsaba Henk2020-06-021-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | - performance.cache-size has a flawed semantics, as it's dispatched on two independent translators, io-cache and quick-read. - performance.qr-cache-timeout has a confusing name, as other options affecting quick-read have an unabbreviated "quick-read-..." prefix in their names. We keep these options with unchanged operation, but in the help output we indicate their deprecation. The following better alternatives are introduced: - performance.io-cache-size to tune cache-size option of io-cache - performance.quick-read-cache-size to tune cache-size option of quick-read - performance.quick-read-cache-timeout as a preferred synonym for performance.qr-cache-timeout Fixes: #952 Change-Id: Ibd04fb638de8cac450ba992ad8a415154f9f4281 Signed-off-by: Csaba Henk <csaba@redhat.com>
* glusterd/snapshot: Improve log message during snapshot cloneMohammed Rafi KC2020-05-221-0/+10
| | | | | | | | | | | While taking a snapshot clone, if the snapshot is not activated, th cli was returning that the bricks are down. This patch clearly print tha the error is due to the snapshot state. Change-Id: Ia840e6e071342e061ad38bf15e2e2ff2b0dacdfa Fixes: #1255 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* glusterd: add missing synccond_broadcast()Xavi Hernandez2020-05-211-1/+3
| | | | | | | | | | After the changes in commit 3da22f8cb08b05562a4c6bd2694f2f19199cff7f, there was a place where synccond_broadcast() was missing. It could cause a hang if another synctask was waiting on the condition variable. Change-Id: I92bfe4e15c5c3591e4854a64aa9e1566d50dd204 Fixes: #1116 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* mgmt/glusterd: Stop old shd before increasing replica countPranith Kumar K2020-05-161-0/+18
| | | | | | | | | | | | | | | | | | Problem: In add-brick that increases replica count SHD was restarted after pending xattrs are set on the new bricks and adding bricks. But before restarting SHD there is a possibility that old SHD would do a scan on root-directory see no heal is needed and delete index for root-dir leading to no heals until lookup is executed on the mount Fix: Stop shd, perform pending-xattr setting/adding new bricks and then restart shd Fixes: #1240 Change-Id: I94fd7c6c909211b597185dfe097a559db6c0d00f Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
* syncop: improve scaling and implement more toolsXavi Hernandez2020-05-139-33/+40
| | | | | | | | | | | | | | | | | | | | The current scaling of the syncop thread pool is not working properly and can leave some tasks in the run queue more time than necessary when the maximum number of threads is not reached. This patch provides a better scaling condition to react faster to pending work. Condition variables and sleep in the context of a synctask have also been implemented. Their purpose is to replace regular condition variables and sleeps that block synctask threads and prevent other tasks to be executed. The new features have been applied to several places in glusterd. Change-Id: Ic50b7c73c104f9e41f08101a357d30b95efccfbf Fixes: #1116 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* mgmt/glusterd: use stat() syscall wrapperDmitry Antipov2020-04-131-2/+3
| | | | | | | | | | | | | | | Found with 0-symbol-check.t: ./tests/basic/0symbol-check.t .. 1..2 ./xlators/mgmt/glusterd/src/.libs/glusterd_la-glusterd-volume-set.o should call sys_stat, not stat ok 1 [ 40/ 41011] < 40> 'find . -name *.o -exec ./tests/basic/symbol-check.sh {} \;' not ok 2 [ 11/ 1] < 42> '[ ! -e ./.symbol-check-errors ]' -> '' Failed 1/2 subtests Change-Id: I8962f487cd88738a1f7a962049d513712687088c Fixes: #1160 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
* mgmt/glusterd: Reduce log level of repetitive logVijay Bellur2020-04-061-1/+1
| | | | | | | | | | | | | | | Noticed that the following message repeats quite a bit in log files when an external monitoring tool queries gluster for list of volumes periodically: "Received get vol req" As there's not much value in having this log message at log level INFO, changing the log level to DEBUG to make glusterd.log a bit quieter. Change-Id: I4e791fc65b9a4f813d295e7b2b6a05f3c0782e69 Updates: #1000 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* glusterd/snapshot: Add a warning message when a volume config changesMohammed Rafi KC2020-03-123-1/+40
| | | | | | | | | | | | While changing a volume configuration, there is a chance that the brick layout on the disk might be changed. If snapshot is present on such volumes that will effects it's working. So this patch adds a warning message if snapshot is present while a volume config change happen. Change-Id: I7256863fef734841fce0bc9ad94d5d201b1813d5 Fixes: bz#1812144 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* mgmt/glusterd: Adding validation for statedump pathyatipadia2020-03-091-2/+29
| | | | | | | | | | | | | | | | | | | | | | | Description of problem: server.statedump-path is the path where statedumps are stored, by default it is /var/run/gluster. And can be set to any valid directory path. It was observed that server.statedump-path was also accepting file, non-existent file and non-existent paths as well. And statedump command was successful even when statedumps with all the invalid paths. a. A file b. A non-existent path Solution: Added a validation function in gluster-volume-set.c which will allow volume set to success if it's a valid directory and in all other cases, volume set should fail. Fixes: bz#1787122 Change-Id: Ia66e2b3d35f23efc5444c829928779a79d827b42 Signed-off-by: yatipadia <ypadia@redhat.com> Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* glusterd: Brick process fails to come up with brickmux onVishal Pandey2020-02-201-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: 1- In a cluster of 3 Nodes N1, N2, N3. Create 3 volumes vol1, vol2, vol3 with 3 bricks (one from each node) 2- Set cluster.brick-multiplex on 3- Start all 3 volumes 4- Check if all bricks on a node are running on same port 5- Kill N1 6- Set performance.readdir-ahead for volumes vol1, vol2, vol3 7- Bring N1 up and check volume status 8- All bricks processes not running on N1. Root Cause - Since, There is a diff in volfile versions in N1 as compared to N2 and N3 therefore glusterd_import_friend_volume() is called. glusterd_import_friend_volume() copies the new_volinfo and deletes old_volinfo and then calls glusterd_start_bricks(). glusterd_start_bricks() looks for the volfiles and sends an rpc request to glusterfs_handle_attach(). Now, since the volinfo has been deleted by glusterd_delete_stale_volume() from priv->volumes list before glusterd_start_bricks() and glusterd_create_volfiles_and_notify_services() and glusterd_list_add_order is called after glusterd_start_bricks(), therefore the attach RPC req gets an empty volfile path and that causes the brick to crash. Fix- Call glusterd_list_add_order() and glusterd_create_volfiles_and_notify_services before glusterd_start_bricks() cal is made in glusterd_import_friend_volume Change-Id: Idfe0e8710f7eb77ca3ddfa1cabeb45b2987f41aa Fixes: bz#1773856 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* volgen: make thin-arbiter name unique in 'pending-xattr' optionAmar Tumballi2020-02-121-2/+12
| | | | | | | | | | 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>
* feature/changelog: Avoid thread creation if xlator is not enabledMohit Agrawal2020-02-091-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Changelog creates threads even if the changelog is not enabled Background: Changelog xlator broadly does two things 1. Journalling - Cosumers are geo-rep and glusterfind 2. Event Notification for registered events like (open, release etc) - Consumers are bitrot, geo-rep The existing option "changelog.changelog" controls journalling and there is no option to control event notification and is enabled by default. So when bitrot/geo-rep is not enabled on the volume, threads and resources(rpc and rbuf) related to event notifications consumes resources and cpu cycle which is unnecessary. Solution: The solution is to have two different options as below. 1. changelog-notification : Event notifications 2. changelog : Journalling This patch introduces the option "changelog-notification" which is not exposed to user. When either bitrot or changelog (journalling) is enabled, it internally enbales 'changelog-notification'. But once the 'changelog-notification' is enabled, it will not be disabled for the life time of the brick process even after bitrot and changelog is disabled. As of now, rpc resource cleanup has lot of races and is difficult to cleanup cleanly. If allowed, it leads to memory leaks and crashes on enable/disable of bitrot or changelog (journal) in a loop. Hence to be safer, the event notification is not disabled within lifetime of process once enabled. Change-Id: Ifd00286e0966049e8eb9f21567fe407cf11bb02a Updates: #475 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* bitrot: Make number of signer threads configurableKotresh HR2020-02-073-0/+100
| | | | | | | | | | | | | 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>
* ec: change error message for heal commands for disperse volumeSheetal Pamecha2020-02-031-1/+3
| | | | | | | | | | | | Currently when we issue a heal statistics or similar commands for disperse volume, it fails with message "Volume is not of type replicate." Adding message "this command is supported for volumes of type replicate" to reflect supportability and better understanding of heal functionality for disperse volumes. fixes: bz#1785998 Change-Id: I9688a9fdf427cb6f657cfd5b8db2f76a6c56f6e2 Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
* multiple files: ensure nfs_svc functions are availableYaniv Kaul2020-01-237-25/+48
| | | | | | | | | | | | When gNFS is disabled in build time, we have to ensure taht the .stop(), .start() and other functions of the nfs_svc are not called, otherwise we'd crash. In addition, #ifdef more code that is gNFS related. updates: bz#1793995 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I5081f1670c04ca306aeaab7208829b0f2f149a42
* dictionary: remove the 'extra_free' parameterYaniv Kaul2020-01-212-4/+6
| | | | | | | | | | | | | | | 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>
* glusterd: fix use after freeXie Changlong2020-01-201-1/+3
| | | | | | updates: bz#789278 Change-Id: I652d8d4428cf6ce61b712a66d309e78030a5f911 Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
* multiple xlators: reduce key lengthYaniv Kaul2020-01-1411-87/+84
| | | | | | | | | | | | | | | In many cases, we were freely allocating long keys with no need. Smaller char arrays are just fine almost anywhere, so just went ahead and looked where they we can use smaller ones. In some cases, annotated the functions as static and the prefixes passed as const as it was easier to read and understand. Where relevant, converted the dict functions to use known key length. Change-Id: I882ab33ea20d90b63278336cd1370c09ffdab7f2 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd-volgen.c: fix to disable property when gNFS disabled.Yaniv Kaul2020-01-131-8/+10
| | | | | | | | | | | | | | | | | | | The code was not ifdef'ed properly when gNFS was not enabled. Strangely, I could not reproduce the failure on my system (Fedora 31), but it was reproduced elsehwere and the fix was verified to correct it. The failure: gluster volume create testvol replica 3 127.0.0.2:/tests/brick{1..3} force gluster v set testvol write-behind off grep -rne write-behind /var/lib/glusterd/vols/testvol/trusted-testvol.tcp-fuse.vol The last grep was supposed to come out empty. The issue was that perfxl_option_handler may not have been called when it should have been. Change-Id: Ie9f8ec87dabeef6624527c2266ddf9af01ca7373 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* afr: expose cluster.optimistic-change-log to CLI.Ravishankar N2020-01-071-0/+5
| | | | | | | | | | | 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>
* mgmt/glusterd: Correct the log path of valgrind.He Min2020-01-061-1/+1
| | | | | | | | | | | | | | | | | Problem: Currently enabling run-with-valgrind will cause the gnfs and quota to fail to start. The phenomenon is as follows. ------------------------------------------------------------------------------ NFS Server on localhost 2049 0 N 48406 Quota Daemon on localhost N/A N/A N 48428 ------------------------------------------------------------------------------ Solution: The cause of the above phenomenon is that the log path of valgrind is set incorrectly. Gnfs and quota can start with valgrind normally after correcting the log path. Updates: #788 Change-Id: Ib91408c08522ff66afff908fbff3fce4b93ea770 Signed-off-by: He Min <hemin@cmss.chinamobile.com>
* Remove some compiler warnings when not compiling gNFSYaniv Kaul2020-01-022-4/+4
| | | | | | | | | | As a follow up to https://review.gluster.org/#/c/glusterfs/+/23799/ When compiling without gNFS, there were some 'unused' warnings by the compiler. This patch fixes them. Change-Id: I621562261f53950e821a450e0e7da304d00ae557 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: deafult options after volume resetSanju Rakonde2020-01-011-0/+23
| | | | | | | | | | | | | | | | | | | Problem: default option itransport.address-family is disappered in volume info output after a volume reset. Cause: with 3.8.0 onwards volume option transport.address-family has default value, any volume which is created will have this option set. So, volume info will show this in its output. But, with reset volume, this option is not handled. Solution: In glusterd_enable_default_options(), we should add this option along with other default options. This function is called by glusterd_options_reset() with volume reset command. fixes: bz#1786478 Change-Id: I58f7aa24cf01f308c4efe6cae748cc3bc8b99b1d Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* [RFC]#ifdef gNFS related code if we are not compiling gNFSYaniv Kaul2019-12-1815-27/+61
| | | | | | | | | | | | | | | | If we are not compiling gNFS (--enable-gnfs is not given in the ./configure script params), there is little point in compiling code that is related to it. This patch tries to eliminate it. My hope (and it's not clear from the code ) is that I did not break the NFS Ganesha support as well. Other than that, tried to compile with and without anad it looks sane. Change-Id: I8d6c98066b9fceab4ec10fc6f5e81ab069e853bd updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: unlink the file after killing the processSanju Rakonde2019-12-181-0/+2
| | | | | | | | | | In glusterd_proc_stop(), after killing the pid we should remove the pidfile. fixes: bz#1784375 Change-Id: Ib6367aed590932c884b0f6f892fc40542aa19686 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* glusterd: set xaatrs after checking the brick orderSanju Rakonde2019-12-051-30/+30
| | | | | | | | | | | | | | | | | | | | | | Problem: When volume creation fails complaining about the bricks from same hosts for replica volumes, the bricks can't be re-used to create any volume without using force at the end. It says, brick is already part of a volume. Reason: When volume create opeartion issued, we set xattrs on the bricks. If the transaction fails in later checks, the xattrs will remain on the brick. When the brick is re-used, by looking at the xattrs, glusterd thinks it is already part of volume. Solution: Check the brick order for replica and disperse volumes before setting the xattrs. fixes: bz#1776801 Change-Id: I44a971b37f520e5a20dc9fad6520286d315063b9 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* glusterd-store: fix Coverity CID 1407767Xie Changlong2019-12-041-0/+2
| | | | | | | | To avoid memory leak. updates: bz#789278 Change-Id: I321c65a66c9ac372d059aa3ca89a989c6089979e Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
* glusterd-op-sm.c (and others) - improve glusterd_op_stage_set_volume()Yaniv Kaul2019-11-295-306/+219
| | | | | | | | | | | | | | | | | | | | | | Multiple changes to the function in the hope to make it somewhat faster. 1. Checking for key length against constant strings before calling strcmp() to save some calls. 2. Verifying if a match was already made against the key to reduce yet more checks. 3. Alignment of error message when they can fit on less lines - just makes 'grep' on the code for error messages easier and it's more readable. 4. Multiple functions where call _gd_get_vmep() one by one. Instead, extracted it to be callable (it was static) and re-used its result, instead of calling it again and again. 5. Removed some unneeded include statement. 6. Removed redundant null checks. Hopefully, no functional changes. Change-Id: Id281224e49adeca6757f96653b4cb13c7c9ba8c9 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* debug/io-stats: add an option to set volume-idAmar Tumballi2019-11-291-0/+9
| | | | | | | | | | | '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>
* store.c/glusterd-store.c: remove sys_stat callsYaniv Kaul2019-11-271-3/+2
| | | | | | | | | | | | | | | 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>
* glusterd-volgen.c: improve volgen_graph_set_options_generic()Yaniv Kaul2019-11-181-11/+12
| | | | | | | | | | | | | | | Skip fetching "skip-CLIOT" unconditionally on every invocation of volgen_graph_set_options_generic(). Instead, fetch only if the vme->key matches to it. We calculate the length of vme->key (but we would have done it anyway in dict_get() later on, so now we can use dict_getn() instead and re-use that key length) and check if the lengths match before doing a strcmp() between them. Lastly, if they match, we actually do the fetch. Change-Id: I9d9a7104f9e920bf81477128adb5fc87f5d30627 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* [WIP]gluster-volgen.c: remove more of JBR and FDL xlatorsYaniv Kaul2019-11-132-139/+1
| | | | | | | | | the JBR and FDL experimental xlators were apparently removed. Removed additional leftovers scattered in the code. Change-Id: I78b6fa5fd9044dc48cdcb1fb094b8c267c2d1323 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: Client Handling of Elastic ClustersMohit Agrawal2019-11-121-0/+49
| | | | | | | | | | | | | | 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
* glusterd/ganesha: fix Coverity CID 1405785Xie Changlong2019-10-301-1/+1
| | | | | | | | | To avoid double free updates: bz#789278 Change-Id: I15ae54ed696295d4cb015668722e77983b062ccb Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
* glusterd: display correct rebalance data size after glusterd restartSanju Rakonde2019-10-181-5/+5
| | | | | | | | | | | | | | | | | | | Problem: After completion of rebalance, if glusterd is restarted, rebalance status displays wrong rebalance data size in its output. Cause: While glusterd restoring the information from /var/lib/glusterd/ into its memory, glusterd fetches rebalance_data from /var/lib/glusterd/vols/volname/node_state.info. This value is converted into an integer using atoi(), which is returning incorrect value for larger values. Solution: use sscanf() instead of atoi() to convert string to integer(in this case it is unsigned long) fixes: bz#1762438 Change-Id: Icbdb096919612b4a1d6fb0e315f09d38900abf4e Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* rpc: align structsYaniv Kaul2019-10-174-203/+197
| | | | | | | | | | | | | squash tens of warnings on padding of structs in afr structures. The warnings were found by manually added '-Wpadded' to the GCC command line. Also made relevant structs and definitions static, where it was applicable. Change-Id: Ib71a7e9c6179378f072d796d11172d086c343e53 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd-volgen.c: fix setting the key export-dirYaniv Kaul2019-10-142-108/+41
| | | | | | | | | | | | | | | | | | | | | | | | The return value of gf_asprintf() was used as the key length, and it was stored into ret. ret was re-used before the dict function was called, therefore was invalid as the real key length and contained a different value. That was masked by the fact the key length was only used in key hash, so while it was incorrect, it was harmless. The hash was consistent and the key length was re-calculated anyway in dict_set_lk(). This patch fixes it, so later on we can use the key length also in dict_set_lk() to save another strlen() (sent in a different patch). However, in the course of this patch I've also decided to reduce the copy-pasta in this code path and put all NFS options in an array and iterate through them. This makes the code shorter and easier to read. (It's also more efficient since once an entry was found, there's no additional strcmp()'s as the previous code did). Change-Id: I968ed50a55f3b1a7ad027c72b06e0fa3788eaa9b updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: Re-alignment of structure attributes in glusterd.Purna Pavan Chandra Aekkaladevi2019-10-147-13/+13
| | | | | | | | | Structures defined in few files of glusterd src have been modified into memory efficient manner. Change-Id: Ie712b41cc74b04d5169bfd2402bff3b9c0d8c95b Updates: bz#1754448 Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkala@redhat.com>
* glusterd-utils.c: attach_brick() - remove dead codeYaniv Kaul2019-10-111-5/+0
| | | | | | | | | pidfile1 and pidfile2 were not used anywhere. Removed the assignment and the variables. Change-Id: Ic5fe091ba28bb500c370410a63440953048fd0b7 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: rebalance start should fail when quorum is not metSanju Rakonde2019-10-101-1/+2
| | | | | | | | | | rebalance start should not succeed if quorum is not met. this patch adds a condition to check whether quorum is met in pre-validation stage. fixes: bz#1760467 Change-Id: Ic7d0d08f69e4bc6d5e7abae713ec1881531c8ad4 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* glusterd: improve loggingSanju Rakonde2019-10-011-3/+3
| | | | | | | updates: bz#1193929 Change-Id: I5b4a39fbdaa43642a322440d550ca24df815cae9 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* read-ahead/io-cache: turn off by defaultRaghavendra Gowdappa2019-09-261-2/+2
| | | | | | | | | | | | | | | | We've found perf xlators io-cache and read-ahead not adding any performance improvement. At best read-ahead is redundant due to kernel read-ahead and at worst io-cache is degrading the performance for workloads that doesn't involve re-read. Given that VFS already have both these functionalities, this patch makes these two translators turned off by default for native fuse mounts. For non-native fuse mounts like gfapi (NFS-ganesha/samba) we can have these xlators on by having custom profiles. Change-Id: Ie7535788909d4c741844473696f001274dc0bb60 Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com> fixes: bz#1676479