1
0
mirror of https://github.com/gluster/glusterfs.git synced 2026-02-05 15:48:40 +01:00

447 Commits

Author SHA1 Message Date
Rafi KC
744c3be74b glusterfsd/mgmt: Connect backup volfile-server in round robin (#4167) (#4579)
Once we establish a connection with volfile-server, if that
connection looses, then we try to connect to the ony be one
till the last one on the list. Once we reach the last one,
we never go back to the first one. So if the last one is down
we will fail to connect to that node until it comes back

  > cherry-picked from commit c2d1fa533a
Change-Id: I8fe801fb536879d13a3c84eb2d935932b44dbaf5
Fixes: #4166

Signed-off-by: Mohammed Rafi KC <rafi.kavungal@iternity.com>
2025-06-10 18:57:14 +05:30
Rafi KC
a06250f35e glfs/open: dentry lists are not initialized (#4284) (#4580)
Now that we are using glfs_open to open directory fd,
we should initialize the dentry list.

  > cherry-picked from commit d53ce415fa
Change-Id: I6193eb83d80220ebef6ac4331bf984c8b4d6c49d

Signed-off-by: Mohammed Rafi KC <rafi.kavungal@iternity.com>
2025-06-10 18:56:48 +05:30
Rafi KC
c5234e0270 api/glfs: Fix use after free in readdir (#4477) (#4581)
There is a code path in glfs readdir where we might end up
using a free'ed memory. A possible case is when we use the
fd to read the offset 0 after reading the content at least
once, and the during the second time, the readdir return 0,
probably due to the contents got deleted.

  > cherry-picked from commit 490e018484
Change-Id: I08fa6cc9b924b90597ef4498e081cae9339fbd6a
Fixes: #3955

Signed-off-by: Mohammed Rafi KC <rafi.kavungal@iternity.com>
2025-06-10 18:56:21 +05:30
mohit84
3d1f3716f3 core: glusterfs encounter a SIGSEGV in __gf_free (#4227)
glusterfs encounter a SIGSEGV in __gf_free called from glusterfs_volfile_fetch_on

The glusterfs(fuse client) is showing a below stacktrace

Program terminated with signal 11, Segmentation fault.
326 if (!num_allocs) {
(gdb) bt
at ../../libglusterfs/src/glusterfs/stack.h:199
at glusterfsd-mgmt.c:2269
at glusterfsd-mgmt.c:2293
at ../sysdeps/unix/sysv/linux/makedev.c:37
(gdb)

Solution: Avoid frame cleanup in case of error return by mgmt_submit_request.

> Fixes: #4190
> Change-Id: I49602280e857108cfe2db7a548818a81d6c605e0
> Credits: Xavi Hernandez <xhernandez@gmail.com>
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
> (Reviwed on upstream link https://github.com/gluster/glusterfs/pull/4191)
> (Cherry picked from commit 89a89cdd70)

Fixes: #4190
Change-Id: I49602280e857108cfe2db7a548818a81d6c605e0
Credits: Xavi Hernandez <xhernandez@gmail.com>

Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
2023-10-26 16:52:49 +05:30
Kaleb S. KEITHLEY
7f1f66bf64 glusterfs: Build with Modern C, change set 2
GCC and Clang communities are hinting that in versions 14 and 16
respectively they will deprecate or disable legacy C89 features,
e.g. K&R1 style function definitions, among others.

In parallel, Fedora is going to start enforcing C99 as the minimum,
expected to land in F40. (I.e. around Spring 2024 IIRC.)

Currently Fedora is recommending that use of -Werror=implicit-int,
-Werror=implicit-function-declaration, -Werror=int-conversion,
-Werror=strict-prototypes, and -Werror=old-style-definition a set
of options to build with in the mean time to clean up code.

This change fixes a subset of the errors found when compiling with
this set of options.

Change-Id: I8271269e4f6d504a7b812f89c7d6b4e60edf661f
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2022-11-02 10:04:27 +01:00
Anoop C S
dfd193aff0 api: Use opendir for directories in glfs_h_open
In addition to files glfs_h_open() is capable of handling directory
opens. But there are various other components like DHT and probably
other client xlators which are tightly coupled to work with directory
opens using just opendir. One such example is the case where fsetxattr()
is called with a file descriptor opened for the directory using
glfs_h_open() resulting in EBADFD.

Therefore we make a differentiation in glfs_h_open() to correctly call
syncop_open() or syncop_opendir() for file and directory entries
respectively to avoid any possible file descriptor errors.

Credits: Xavi Hernandez <xhernandez@redhat.com>
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-10-24 10:45:42 +02:00
Anoop C S
ccc5f3cf12 api: Use opendir for directories in glfs_open and glfs_openat (#3877)
In addition to files glfs_open() and glfs_openat() are capable of
handling directory opens. But there are various other components
like DHT and probably other client xlators which are tightly coupled
to work with directory opens using just opendir. One such example is
the case where fsetxattr() is called with a file descriptor opened for
the directory using glfs_open() or glfs_openat() resulting in EBADFD.

Therefore we make a differentiation within these APIs to correctly
call syncop_open() or syncop_opendir() for file and directory entries
respectively to avoid any possible file descriptor errors.

Fixes: #3876
Credits: Xavi Hernandez <xhernandez@redhat.com>
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-10-20 22:28:54 +02:00
Yaniv Kaul
0b1dcc1b2f Use a flexible array member for data pair key (#3870)
* dictionary data_pair: make key a flexible array member

We always ended up calling allocation - even though we tried to avoid it using the free pair which was supposed to handle
the common case of a single data pair in a dictionary, we still called GF_MALLOC for the key.
Instead, allocate the key together with the data pair, unconditionally, in a single call.
This also simplifies the code a bit by getting rid of the logic around the free pair and removes multiple checks for NULL of pair->key.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>

* Multiple files: remove dict_pair_pool memory pool

It's not needed anymore, now that we allocate the pair (along with the pair->key).

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-18 09:13:12 +02:00
Yaniv Kaul
cda4441799 glfs-fops: turn gio->iov to a flexible array member (#3872)
Allocate the IOV vector as part of the gio struct allocation (and same for deallocation).
Also change from GF_CALLOC() to GF_MALLOC() as we initialize all variables.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-18 09:11:59 +02:00
Yaniv Kaul
683a212b75 multiple files: unify and improve the check for . and .. entries (#3680)
- Don't use strcmp() and compare chars directly
- Reuse across codebase.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-06 08:44:02 +02:00
Anoop C S
64c01f4e87 api: Fix glfs_openat() by linking the inode
Newly added glfs_openat() failed to link inode causing the next
immediate open without a lookup to fail with ENOENT. Therefore
add the missing inode link using glfs_loc_link().

This also reverts a hunk from 8cec218856
as iatt struct is required for glfs_loc_link() in glfs_openat().

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-10-04 11:38:37 +02:00
Yaniv Kaul
8cec218856 syncop: no need to copy iatt structs if you are not going to use them (#3712)
They are optional anyway, so if the caller does not intend on using them later on, just pass NULL instead
and skip copying them.

Updates: #3717
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-09-29 11:58:32 +02:00
Yaniv Kaul
33e89438c3 fd_ctx_get() and fd_ctx_del() should just return the value (#3730)
* multiple files: fd_ctx_get() should just return the value parameter.

There's no point in both 'ret' and 'value' params.

* Multiple files: implement fd_ctx_get_ptr() macro that does the conversion to the relevant struct pointer

Simplifies nicely the code in many places. Thanks Xavi for the suggestion!

* Added __fd_ctx_get_ptr() macro, similar to fd_ctx_get_ptr() functionality

* Fix __fd_ctx_del() to return as soon as the ctx is found and not continue the loop

* Add fd_ctx_del_ptr() macro which will delete the context and return already a cast to a pointer.

* Fix __posix_fd_ctx_get() - ret was not set to 0 on success.

* Fix dht_fd_ctx_set() ret value

* Fix (unrelated to this whole series) pl_check_n_create_fdctx() logic.

it was not really using existing ctx. Luckily(?) it never/rarely(?) had an existing ctx...

* Minor changes

Make refcount 32bit and proper padding for the structure are the main changes

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-09-21 12:52:58 +02:00
Shree Vatsa N
b09d55178f gfapi: Add support for 'AT_EMPTY_PATH' flag (#3707)
Add support for AT_EMPTY_PATH flag for the following fops,
- glfs_fstatat, glfs_linkat, glfs_fchownat.

Acc. to man pages,
If pathname is an empty string, operate on the file referred to by dirfd,
(which may have been obtained using the open(2) O_PATH flag).

Updates: #2717
Sponsored-By: iXsystems, Inc https://www.ixsystems.com/

Signed-off-by: Shree Vatsa N <vatsa@kadalu.tech>
2022-09-07 11:46:40 +05:30
Shree Vatsa N
8a41e0eb1c gfapi: Add support for 'AT_REMOVEDIR' flag (#3703)
Signed-off-by: Shree Vatsa N <vatsa@kadalu.tech>
2022-08-16 10:04:51 +05:30
Anoop C S
260485f88a api: Fix return from glfs_h_open() to honour O_DIRECTORY flag (#3650)
This is more or less the same change done previously for glfs_open().
See commit message from 754a8a8e8e for
more details.

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-07-29 08:08:10 +02:00
Shree Vatsa N
c27bdbeb10 gfapi: Implementation of glfs_*at syscalls (#3634)
* gfapi: Implement glfs_faccessat
* gfapi: Implement glfs_fchmodat
* gfapi: Implement glfs_fchownat
* gfapi: Implement glfs_linkat
* gfapi: Implement glfs_mknodat
* gfapi: Implement glfs_readlinkat
* gfapi: Implement glfs_renameat
* gfapi: Implement glfs_renameat2
* gfapi: Implement glfs_symlinkat
* gfapi: Implement glfs_unlinkat
* gfapi: Implement glfs_mkdirat

* glfs-openat: Use  the common methods
 * Add ENOENT & EEXIST checks

Updates: #2717
Sponsored-By: iXsystems, Inc <https://www.ixsystems.com>
Signed-off-by: Shree Vatsa N <vatsa@kadalu.tech>
2022-07-14 12:19:36 +05:30
Aravinda Vishwanathapura
a005a54a93 gfapi: glfs_fstatat implementation (#3542)
Example:

```c
struct stat stbuf = {
    0,
};
fd1 = glfs_open(fs, "/", O_PATH);
glfs_fstatat(fd1, filename, &stbuf, 0);
printf("Size: %zu\n", stbuf->st_size);
```

Change-Id: I6d4c95ce91191566d2b9a198d5ba382bbad22264
Updates: #2717
Sponsored-By: iXsystems, Inc <https://www.ixsystems.com>
Signed-off-by: Aravinda Vishwanathapura <aravinda@kadalu.tech>
2022-06-30 16:48:15 +05:30
Aravinda Vishwanathapura
f64f400c8d gfapi: Implement glfs_openat()
Example:

```c
const char *buff = "Hello World!";

fd1 = glfs_open(fs, "/", O_PATH);
fd2 = glfs_openat(fd1, filename, O_RDWR, 0);
glfs_write(fd2, buff, strlen(buff), flags);
```

Updates: #2717
Sponsored-By: iXsystems, Inc <https://www.ixsystems.com>
Change-Id: I4f8ad20616587f2d6e5feba4869abec96706a514
Signed-off-by: Aravinda Vishwanathapura <aravinda@kadalu.tech>
2022-06-27 11:12:34 +02:00
Preet Bhatia
6496dd3988 gfapi: change some calloc() to malloc() (#3497)
Converted calloc to malloc as already initialized
all fields after allocation and make changes to ensure
initialization happens in the order variables are in the struct

Updates: #1000
Change-Id: I59784d4e2d2b2903e93724350524824f6447793b
Signed-off-by: Preet Bhatia <pbhatia@redhat.com>
2022-05-25 11:59:47 +02:00
Harshita Shree
151082b364 gcc-warning[glfs.c] (#3391)
* gcc-warning[glfs.c]

Change-Id: Id20554ffff976c10474c755205d3b478f829c3e1

* re-fix

Change-Id: I919f14c4e1b505b5ecddb0fa21ee7ef0f7f5d7f5

* re-fix

Change-Id: Id8f95700af3c1c04e0ff2b9c3b36ef8f4657239f
2022-04-28 12:06:29 +05:30
Anoop C S
754a8a8e8e gfapi: Fix return from glfs_open() to honour O_DIRECTORY flag
As per POSIX[1] specifications honour O_DIRECTORY flag during open as
follows:

O_DIRECTORY
    If path resolves to a non-directory file, fail and set errno to
    [ENOTDIR].

ERRORS

* [EISDIR]
  The named file is a directory and oflag includes O_WRONLY or O_RDWR,
  or includes O_CREAT without O_DIRECTORY
* [ENOTDIR]
  A component of the path prefix names an existing file that is neither
  a directory nor a symbolic link to a directory; or O_CREAT and O_EXCL
  are not specified, the path argument contains at least one non-<slash>
  character and ends with one or more trailing <slash> characters, and
  the last pathname component names an existing file that is neither a
  directory nor a symbolic link to a directory; or O_DIRECTORY was
  specified and the path argument resolves to a non-directory file.

The presence of O_DIRECTORY is to ensure the file being opened is a
directory.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-03-17 09:34:24 +01:00
Dmitry Antipov
cc98f7b3ac api, xlators: fix warnings found by clang-15 (#3239)
Fix the following warnings found by clang-15:

glfs-fops.c:6338:9: warning: logical not is only applied to the left
hand side of this bitwise operator [-Wlogical-not-parentheses]
    if (!xstat->flags_handled & GFAPI_XREADDIRP_STAT)

dht-layout.c:446:14: warning: variable 'overlaps' set but not used
[-Wunused-but-set-variable]
    uint32_t overlaps = 0;

quick-read.c:359:12: warning: variable 'size_pruned' set but not
used [-Wunused-but-set-variable]
    size_t size_pruned = 0;

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2022-02-20 12:53:26 +05:30
Yaniv Kaul
3b00855b0f Multiple files: reduce the number of include statements (#3141)
We have hundreds of redundant, or unused #include statements in the code. I have a WIP patch to remove many of them
We have several that are circular (include A calls B which calls A ...)
We have some unused statements in popular include file (glusterd.h is a good example).
The end goal would be to reduce the no. of include statements, include what's needed,
and thus improve code readability, maintainability and hopefully reduce compilation times.

Note: it is still not pretty, but it's a good step towards really including what is needed, per file/modulex/xlator/...

Updates: #3130
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-02-12 10:06:42 +05:30
Yaniv Kaul
8db0b37ac1 multiple files: remove unused this from gf_link_inode_from_dirent() (#3032)
It's not needed, and there are some callers who used 'THIS' to populate it.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2021-12-21 10:07:29 +05:30
Amar Tumballi
486aaca6a6 listxattr: filter internal virtual xattrs (#3036)
In certain cases, there are some keys set in brick xlators which assume
a corresponding xlator on client side will handle the request and take
appropriate action. As many xlators are optional, and can be turned off,
there are cases where such xattrs will reach client application, causing
errors in application.

Resolve it by filtering out internal keys.

One example of such key is 'glusterfs.skip-cache'.

Updates: #1000
Change-Id: I65d5cbba32d7e8ec6926e7c00d90f780dd9a28b1
Signed-off-by: Amar Tumballi <amar@kadalu.io>
2021-12-21 10:06:01 +05:30
Amar Tumballi
063720d1ee inode: implement namespace at inode level (#1763)
With this PR, specially on the brick side graph, inode table would be
properly set with 'namespace' inode reference. It is not guaranteed
with fuse/client side graph due to subdir mount.

To get 'namespace' for a corresponding inode, all one needs to do is,
check `ns_inode` pointer in inode structure.

Currently only special mounts with `PID < 0` can set the namespace
attribute, and in lookup, if namespace attribute is present, we set
the variable in inode.

By default, the ns_inode is set to 'root' inode when inode gets created.

Fixes: #1757
Change-Id: I69157e388538ea5d4b4e45d543575a04ee9ef221
Signed-off-by: Amar Tumballi <amar@kadalu.io>
2021-12-10 11:05:23 +01:00
Yaniv Kaul
637d54e0ca multiple files: remove the stub pool
It's unused since I've removed its usage in commit 11b7266 - call-stub: remove unused fields (#2055)

Fixes: #2964
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2021-11-23 09:17:46 +01:00
Dmitry Antipov
c6f61bf46b api, xlators, glusterfsd, libglusterfs: fix locking (#2837)
Fix a few typical locking errors, including double initialization,
double destroy, and an attempt to use an unitialized lock here and
there. Free the hostname in 'glusterfs_ctx_destroy()' as well.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2021-10-25 17:40:00 +05:30
mohit84
2936241ea9 Revert "libglusterfs: drop core infrastructure of memory pools (#2675)" (#2777)
In case of glibc_pool it is good to use glusterfs mempool so revert
the commit 9cd6735ff5.

Change-Id: I780f0a1b7dae815becfd8c072735b6fdecb936f8
Updates: #1000
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
2021-09-10 07:26:04 +05:30
Dmitry Antipov
9cd6735ff5 libglusterfs: drop core infrastructure of memory pools (#2675)
Separate memory allocation type tracking from core infrastructure of
memory pools and drop the latter alongside with '--disable-mempool'
configuration option, provide '--disable-allocation-tracking' to control
the former instead.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2021-09-04 12:02:48 +05:30
Xavi Hernandez
dc9bab7959 afr: fix directory entry count (#2233)
AFR may hide some existing entries from a directory when reading it
because they are generated internally for private management. However
the returned number of entries from readdir() function is not updated
accordingly. So it may return a number higher than the real entries
present in the gf_dirent list.

This may cause unexpected behavior of clients, including gfapi which
incorrectly assumes that there was an entry when the list was actually
empty.

This patch also makes the check in gfapi more robust to avoid similar
issues that could appear in the future.

Fixes: #2232
Change-Id: I81ba3699248a53ebb0ee4e6e6231a4301436f763
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
2021-03-09 04:54:07 +05:30
Aravinda Vishwanathapura
72a9fc8ca1 api: Fix a function name in the API doc
Wrong function name was mentioned in API doc
for `glfs_get_volfile`.

Change-Id: Id2251837f53270f1f03b8a5501ea335b7995873b
Updates: #1000
Signed-off-by: Aravinda Vishwanathapura <aravinda@kadalu.io>
2021-03-01 11:51:18 +01:00
Rinku Kothiya
6fcff3901d gfapi: avoid crash while logging message. (#2139)
Breaking parameter into two different parameter
to avoid a crash.

fixes: #2138

Change-Id: Idd5f3631488c1d892748f83e6847fb6fd2d0802a
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
2021-02-09 06:44:49 +05:30
Ravishankar N
b9a4120b2b all: change 'primary' to 'root' where it makes sense
As a part of offensive language removal, we changed 'master' to 'primary' in
some parts of the code that are *not* related to geo-replication via
commits e4c9a14429 and
0fd9246533.

But it is better to use 'root' in some places to distinguish it from the
geo-rep changes which use 'primary/secondary' instead of 'master/slave'.

This patch mainly changes glusterfs_ctx_t->primary to
glusterfs_ctx_t->root. Other places like meta xlator is also changed.
gf-changelog.c is not changed since it is related to geo-rep.

Updates: #1000
Change-Id: I3cd610f7bea06c7a28ae2c0104f34291023d1daf
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
2020-12-02 13:24:13 +01:00
Ravishankar N
9d6c316f35 api: conscious language changes (#1737)
-Removed the occurences of 'master' in api.
-Some changes threw up clang-format errors, so fixed them as well.
-Renamed api/src/{glfs-master.c => glfs-primary.c}

Fixes: #1733
Change-Id: I57aea9d93e219305e87985bc2f81ac47cdebb72f
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
2020-11-04 09:39:12 +05:30
Rinku Kothiya
7ccb1f1878 gfapi: give appropriate error when size exceeds
This patch help generate appropriate error message
when the gfapi tries to write data equal to or
greater than 1 Gb due to the limitation at the
socket layer.

fixes: #1518

Change-Id: I1234a0b5a6e675a0b20c6b1afe0f4390fd721f6f
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
2020-11-03 09:48:06 +01:00
Ravishankar N
e4c9a14429 xlators: misc conscious language changes (#1715)
core:change xlator_t->ctx->master to xlator_t->ctx->primary
afr: just changed comments.
meta: change .meta/master to .meta/primary. Might break scripts.
changelog: variable/function name changes only.

These are unrelated to geo-rep.
Fixes: #1713

Change-Id: I58eb5fcd75d65fc8269633acc41313503dccf5ff
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
2020-11-02 18:03:01 +05:30
mohit84
ecdc77ceb9 core: configure optimum inode table hash_size for shd (#1576)
In brick_mux environment a shd process consume high memory.
After print the statedump i have found it allocates 1M per afr xlator
for all bricks.In case of configure 4k volumes it consumes almost total
6G RSS size in which 4G consumes by inode_tables

[cluster/replicate.test1-replicate-0 - usage-type gf_common_mt_list_head memusage]
size=1273488
num_allocs=2
max_size=1273488
max_num_allocs=2
total_allocs=2

inode_new_table function allocates memory(1M) for a list of inode and dentry hash.
For shd lru_limit size is 1 so we don't need to create a big hash table so to reduce
RSS size for shd process pass optimum bucket count at the time of creating inode_table.

Change-Id: I039716d42321a232fdee1ee8fd50295e638715bb
Fixes: #1538
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
2020-10-11 10:56:57 +05:30
Môshe van der Sterre
8f0dc56556 gfapi: Move the SECURE_ACCESS_FILE check out of glfs_mgmt_init
glfs_mgmt_init is only called for glfs_set_volfile_server, but
secure_mgmt is also required to use glfs_set_volfile with SSL.

fixes: #829
Change-Id: Ibc769fe634d805e085232f85ce6e1c48bf4acc66
2020-09-28 06:12:32 +02:00
Xavi Hernandez
0b512035e3 gfapi: Check the fd argument before accessing it
Some public GFAPI functions did access the fd object without verifying
that it wasn't NULL, causing crashes in some cases.

This patch returns an error code in case it's NULL.

Updates: #1009
Change-Id: I8cadde87ae8d542e0af9b55aa866fe763f97d4fb
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
2020-09-23 12:50:07 +02:00
Kaleb S. KEITHLEY
aed59161bd api: libgfapi symbol versions break LTO in Fedora rawhide/f33
The way symbol versions are implemented is incompatible with gcc-10 and LTO.

Fedora provenpackager Jeff Law (law [at] redhat.com) writes in the
Fedora dist-git glusterfs.spec:
  This package uses top level ASM constructs which are incompatible with LTO.
  Top level ASMs are often used to implement symbol versioning. gcc-10
  introduces a new mechanism for symbol versioning which works with LTO.
  Converting packages to use that mechanism instead of toplevel ASMs is
  recommended.

In particular, note that the version of gluster in Fedora rawhide/f33 is
glusterfs-8.0RC0. Once this fix is merged it will be necessary to backport
it to the release-8 branch.

At the time that gfapi symbol versions were first implemented we copied
the GNU libc (glibc) symbol version implementation following Uli Drepper's
symbol versioning HOWTO.

Now gcc-10 has a symver attribute that can be used instead. (Maybe it
has been there all along?)

Both the original implemenation and this implemenation yield the same
symbol versions. This can be seen by running
  `nm -D --with-symbol-versions libgfapi.so`
on the libgfapi.so built before and after applying this fix.

Change-Id: I05fda580afacfff1bfc07be810dd1afc08a92fb8
Fixes: #1352
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2020-07-02 15:52:15 -04:00
Pranith Kumar K
bd540db1e7 cluster/afr: Delay post-op for fsync
Problem:
AFR doesn't delay post-op for fsync fop. For fsync heavy workloads
this leads to un-necessary fxattrop/finodelk for every fsync leading
to bad performance.

Fix:
Have delayed post-op for fsync. Add special flag in xdata to indicate
that afr shouldn't delay post-op in cases where either the
process will terminate or graph-switch would happen. Otherwise it leads
to un-necessary heals when the graph-switch/process-termination
happens before delayed-post-op completes.

Fixes: #1253
Change-Id: I531940d13269a111c49e0510d49514dc169f4577
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
2020-05-29 14:24:53 +05:30
Xavi Hernandez
6f79c28cf0 syncop: improve scaling and implement more tools
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>
2020-04-30 11:19:01 +02:00
Soumya Koduri
4bff77920d gfapi: Suspend synctasks instead of blocking them
There are certain conditions which blocks the current
execution thread (like waiting on mutex lock or condition
variable or I/O response). In such cases, if it is a
synctask thread, we should suspend the task instead
of blocking it (like done in SYNCOP using synctask_yield)

This is to avoid deadlock like the one mentioned below -

1) synctaskA sets fs->migration_in_progress to 1 and
   does I/O (LOOKUP)
2) Other synctask threads wait for fs->migration_in_progress
  to be reset to 0 by synctaskA and hence blocked
3) but synctaskA cannot resume as all synctask threads are blocked
   on (2).

Note: this same approach is already used by few other components
like syncbarrier etc.

Change-Id: If90f870d663bb242c702a5b86ac52eeda67c6f0d
Fixes: #1146
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
2020-04-06 12:36:44 +05:30
Sunny Kumar
4a29d61734 libgfapi: fix resource leak
This patch fixes resource leak in glfs-fops.c.
CID : 1403873 : Resource leak

updates: bz#789278

Change-Id: I589d4d65d2b074801f7b4b0afd7dc4607d79420e
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
2020-01-31 15:27:46 +00:00
Yaniv Kaul
89c88e45bb multiple xlators: reduce key length
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>
2019-12-09 21:28:00 +02:00
yatipadia
29634da262 api-glfs-fops: structure logging
Convert gf_msg() to gf_smsg()

Change-Id: Iceb40d60a75106c7b4b0a2487b611f7376bccc46
Updates: #657
Signed-off-by: yatipadia <ypadia@redhat.com>
2019-11-25 19:57:09 +05:30
Niklas Hambüchen
aeb0081996 api: Fix documentation path in README
Ref: #84
Updates: bz#1193929
Change-Id: If346dbe421d3e301ae035165b2e01ee0a7176d36
Signed-off-by: Amar Tumballi <amarts@gmail.com>
2019-11-13 12:19:54 +05:30
Yaniv Kaul
d3a0a5c28c rpc: align structs
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>
2019-09-13 21:27:44 +03:00