summaryrefslogtreecommitdiffstats
path: root/xlators/features/barrier/src/barrier.c
Commit message (Collapse)AuthorAgeFilesLines
* Multiple files: get trivial stuff done before lockYaniv Kaul2019-08-011-1/+1
| | | | | | | | | Initialize a dictionary for example seems to be prefectly fine to be done before taking a lock. Change-Id: Ib29516c4efa8f0e2b526d512beab488fcd16d2e7 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* Multiple files: reduce work while under lock.Yaniv Kaul2019-01-291-3/+6
| | | | | | | | | | | | | | | | | Mostly, unlock before logging. In some cases, moved different code that was not needed to be under lock (for example, taking time, or malloc'ing) to be executed before taking the lock. Note: logging might be slightly less accurate in order, since it may not be done now under the lock, so order of logs is racy. I think it's a reasonable compromise. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I2438710016afc9f4f62a176ef1a0d3ed793b4f89
* fix 32-bit-build-smoke warningsIraj Jamali2019-01-111-1/+1
| | | | | | | fixes: bz#1622665 Change-Id: I777d67b1b62c284c62a02277238ad7538eef001e Signed-off-by: Iraj Jamali <ijamali@redhat.com>
* barrier: replace boolean-switch statement with if/elseNiels de Vos2018-12-281-43/+23
| | | | | | | | | | | | | | | | | | | | | | Squash some ugly warnings, and make the code a little bit simpler by removing some unneeded goto jumps. On Ubuntu 16.04 the following warnings were reported by Amudhan: CC barrier.lo barrier.c: In function ‘notify’: barrier.c:499:33: warning: switch condition has boolean value [-Wswitch-bool] switch (past) { ^ barrier.c: In function ‘reconfigure’: barrier.c:565:25: warning: switch condition has boolean value [-Wswitch-bool] switch (past) { ^ Change-Id: Ifb6b75058dff8c789b729c76530a1358d391f4d1 Updates: bz#1193929 Reported-by: Amudhan P <amudhan83@gmail.com> Signed-off-by: Niels de Vos <ndevos@redhat.com>
* all: add xlator_api to many translatorsAmar Tumballi2018-12-061-0/+15
| | | | | | Fixes: #164 Change-Id: I93ad6f0232a1dc534df099059f69951e1339086f Signed-off-by: Amar Tumballi <amarts@redhat.com>
* libglusterfs: Move devel headers under glusterfs directoryShyamsundarR2018-12-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* all: fix the format string exceptionsAmar Tumballi2018-11-051-2/+2
| | | | | | | | | | | | | | | | Currently, there are possibilities in few places, where a user-controlled (like filename, program parameter etc) string can be passed as 'fmt' for printf(), which can lead to segfault, if the user's string contains '%s', '%d' in it. While fixing it, makes sense to make the explicit check for such issues across the codebase, by making the format call properly. Fixes: CVE-2018-14661 Fixes: bz#1644763 Change-Id: Ib547293f2d9eb618594cbff0df3b9c800e88bde4 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* Land part 2 of clang-format changesGluster Ant2018-09-121-532/+537
| | | | | Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4 Signed-off-by: Nigel Babu <nigelb@redhat.com>
* xlators/features/barrier: Fix RESOURCE_LEAKVarsha Rao2018-06-281-0/+3
| | | | | | | | Free priv to fix the resource_leak coverity issue. Change-Id: I1f93f54d7d59eddb0b9523ac2b67ef0b279122bd updates: bz#789278 Signed-off-by: Varsha Rao <varao@redhat.com>
* barrier: redefine the optionsAtin Mukherjee2017-11-171-2/+6
| | | | | | | | | | | With https://review.gluster.org/18059 introducing new fields into the volume_option structure, this change takes care of the changes required at the barrier side. Updates #302 Change-Id: If991df10b130c762a44883668a00e49943a508f8 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
* all: fixes for clang compile warningsKaleb S KEITHLEY2016-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cli/src/cli-cmd-parser.c (chenk) cli/src/cli-xml-output.c (spandit) cli/src/cli.c (chenk) libglusterfs/src/common-utils.c (vmallika) libglusterfs/src/gfdb/gfdb_sqlite3.c (jfernand +1) rpc/rpc-transport/socket/src/socket.c (?) xlators/cluster/afr/src/afr-transaction.c (?) xlators/cluster/dht/src/dht-common.h (srangana +2) xlators/cluster/dht/src/dht-selfheal.c (srangana +2) xlators/debug/io-stats/src/io-stats.c (R. Wareing) xlators/features/barrier/src/barrier.c (vshastry) xlators/features/bit-rot/src/bitd/bit-rot-scrub.h (vshankar +1) xlators/features/shard/src/shard.c (kdhananj +1) xlators/mgmt/glusterd/src/glusterd-ganesha.c (skoduri) xlators/mgmt/glusterd/src/glusterd-handler.c (atinmu) xlators/mgmt/glusterd/src/glusterd-op-sm.h (atinmu) xlators/mgmt/glusterd/src/glusterd-snapshot.c (spandit) xlators/mgmt/glusterd/src/glusterd-syncop.c (atinmu) xlators/mgmt/glusterd/src/glusterd-volgen.c (atinmu) xlators/protocol/client/src/client-messages.h (mselvaga +1) xlators/storage/bd/src/bd-helper.c (M. Mohan Kumar) xlators/storage/bd/src/bd.c (M. Mohan Kumar) xlators/storage/posix/src/posix.c (nbalacha +1) Change-Id: I85934fbcaf485932136ef3acd206f6ebecde61dd BUG: 1293133 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/13031 CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
* build: do not #include "config.h" in each fileNiels de Vos2015-05-291-5/+0
| | | | | | | | | | | | | | | | | | Instead of including config.h in each file, and have the additional config.h included from the compiler commandline (-include option). When a .c file tests for a certain #define, and config.h was not included, incorrect assumtions were made. With this change, it can not happen again. BUG: 1222319 Change-Id: I4f9097b8740b81ecfe8b218d52ca50361f74cb64 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10808 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
* Avoid conflict between contrib/uuid and system uuidEmmanuel Dreyfus2015-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glusterfs relies on Linux uuid implementation, which API is incompatible with most other systems's uuid. As a result, libglusterfs has to embed contrib/uuid, which is the Linux implementation, on non Linux systems. This implementation is incompatible with systtem's built in, but the symbols have the same names. Usually this is not a problem because when we link with -lglusterfs, libc's symbols are trumped. However there is a problem when a program not linked with -lglusterfs will dlopen() glusterfs component. In such a case, libc's uuid implementation is already loaded in the calling program, and it will be used instead of libglusterfs's implementation, causing crashes. A possible workaround is to use pre-load libglusterfs in the calling program (using LD_PRELOAD on NetBSD for instance), but such a mechanism is not portable, nor is it flexible. A much better approach is to rename libglusterfs's uuid_* functions to gf_uuid_* to avoid any possible conflict. This is what this change attempts. BUG: 1206587 Change-Id: I9ccd3e13afed1c7fc18508e92c7beb0f5d49f31a Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/10017 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* barrier: Correct gfid in statedump of barriered fopsggarg2014-11-061-3/+143
| | | | | | | | | | | | | | | | In brick statedump file the barriered fop's gfid was showing 0 when statedump was taken. This is because of statedump code was not referring to correct gfid. With this change statedump code will use correct gfid and gfid will not be 0 in statedump file when barrier is enable and user takes statedump of volume. Change-Id: Ia296cba7e132402df53c602daa160c1c2cd21245 BUG: 1099369 Reviewed-on: http://review.gluster.org/7893 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
* feature/changelog: Add timeout to changelog barrier.Kotresh H R2014-06-101-1/+1
| | | | | | | | | | | | | | | | | | | This patch introduces configurable 'changelog-barrier-timeout' in changelog. The default changelog-barrier-timeout is set to 120 sec which is same as barrier-timeout of barrier translator. On this timeout, all the barriered fops are unbarriered. It is safe to have this internal timeout for changelog barrier to prevent it from indefinite barrierring of fops if barrier disable notification does not come from snapshot for some reason. Change-Id: Iad07807935f88222cdefcd46312b4b6579186dce BUG: 1094226 Signed-off-by: Kotresh H R <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/7669 Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com>
* glusterd : barrier enable/disable should fail if already enabled/disabledAtin Mukherjee2014-05-121-3/+9
| | | | | | | | | | | | | | | | | In barrier notify function, if we fail to set the barrier option execution goes to default_notify which returns 0 and command returns success. Fix : We need not call the default_notify function when handling GF_EVENT_TRANSLATOR_OP in barrier xlator's notify. Change-Id: Ia2c361b43cca7791c29829d69dcd6fc7923102f6 BUG: 1092841 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/7609 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
* barrier : fsync call over NFS should be barriered when barrier is enabledAtin Mukherjee2014-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | barrier_fsync was not getting hit when fsync call is issued from the application over NFS mount. Investigation reveals that NFS doesn't send an explicit fsync call to the glusterfs server, however NFS converts it with a stable write with O_DSYNC flag, so for a fsync call over NFS mount point, barrier feature always needs to check for writev and its correspoding flags. So to meet all the coditions of write with O_SYNC and fsync getting blocked when barrier is enabled the check has been modified with following: if (!((flags | fd->flags) & (O_SYNC | O_DSYNC))) Point to be noted here is we need to check both fd's flag and the explicit flag as for NFS write fd->flags is 0. Bug ID : 1091902 Change-Id: Ifd5377fca2cc93bb72158dd525b2aab8b4164ca8 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/7633 Reviewed-by: Santosh Pradhan <spradhan@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* barrier : barrier O_SYNC write incorrect flag checkAtin Mukherjee2014-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | barrier_writev function was doing the following check to determine whether its a O_SYNC write or not: if (!(flags & O_SYNC)) The problem here is this flag is not fd's flag and gfapi write does not copy open call fd's flag into write flag because of which O_SYNC writes were not getting barriered even if barrier was enabled. The check has been modified as: if (!(fd->flags & (O_SYNC | O_DSYNC))) Change-Id: I07b23852d150b81c7317100ca6d22d082ad897cd BUG: 1090488 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/7549 Reviewed-by: Varun Shastry <vshastry@redhat.com> Reviewed-by: Santosh Pradhan <spradhan@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* Barrier: Barrier translator options configurationAtin Mukherjee2014-04-271-3/+3
| | | | | | | | | | | barrier enable/disable, barrier-timeout configuration in barrier translator. Change-Id: I7cbf9cd4f5e55d42dcc6b7cd6827234566c7b6f3 BUG: 1060002 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/7177 Reviewed-by: Kaushal M <kaushal@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* glusterfs-server : barrier timeout tuning fixAtin Mukherjee2014-04-221-12/+70
| | | | | | | | | | | | | | | | | | | | | | | | | Problem : Reconfiguration of barrier timeout through gluster volume set shows a success but it never changes the default timeout value which is 120 seconds. After digging into the code deeper, it was found that timeout is never modified in reconfigure() as the first check i.e. whether barrier is already enabled or disabled always fails since barrier option is not modified in this request. Fix : Introduced notify() in barrier translator which will take care of the rpc request to enable/disable barrier. reconfigure() will simply set barrier enable/disable and timeout options blindly without any validation. Please note this patch only contains the changes in barrier translator however from complete code flow perspective the caller in the glusterfsd mgmt should call notify instead of reconfigure to fix this problem. Change-Id: I1371b294935f6054da7c1dc6a9a19f1d861e60fb BUG: 1085671 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/7428 Reviewed-by: Varun Shastry <vshastry@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* feature/barrier: Add statedump supportKaushal M2014-04-071-1/+81
| | | | | | | | | | | | This patch adds statedump support for barrier. This currently dumps barrier xlators private information and the queue of barriered fops. Change-Id: I273eb6e676db02c40c363feeff58a79737dc041e BUG: 1060002 Reviewed-on: http://review.gluster.org/7136 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* features/barrier: add barrier translatorVarun Shastry2014-04-071-0/+520
gluster feature page: http://www.gluster.org/community/documentation/index.php/Features/Server-side_Barrier_feature Change-Id: Ia9f8802a54d1ffbd1cf789b80f5d30819bf65f64 BUG: 1060002 Signed-off-by: Varun Shastry <vshastry@redhat.com> Reviewed-on: http://review.gluster.org/6928 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>