1
0
mirror of https://github.com/gluster/glusterfs.git synced 2026-02-06 09:48:44 +01:00

16705 Commits

Author SHA1 Message Date
Kaleb S. KEITHLEY
871338543c glusterfs: Build with Modern C, change set 6
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: Ia436ef321ad7963331d5cc813c98880525d0525e
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
v12dev
2022-11-04 10:09:31 +01:00
Aleksey Vasenev
22a507add1 trash: Fixed max file size overflow on 32-bit processors (#3892)
Fixes: #3891
Signed-off-by: Aleksey Vasenev <margtu-fivt@ya.ru>
2022-11-04 09:50:13 +05:30
Kaleb S. KEITHLEY
cef682c03d glusterfs: Build with Modern C, change set 5
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: I2025e39566aeb1f68836226d6d18c43418ca7f95
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2022-11-02 10:05:46 +01:00
Kaleb S. KEITHLEY
798135488e glusterfs: Build with Modern C, change set 4
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: I9c4b4a0b002835d6555d8fef9456fea16c31b28a
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2022-11-02 10:05:35 +01:00
Kaleb S. KEITHLEY
c6901803b4 glusterfs: Build with Modern C, change set 3
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: I4c1726915883e4a9912f41d92644c1e8916a979d
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2022-11-02 10:05:08 +01:00
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
Kaleb S. KEITHLEY
649b782820 glusterfs: Build with Modern C, change set 1
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: Ibb393780e8e6cce70f0f7f9910a91f4b588f70c3
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2022-11-02 10:04:09 +01:00
Xavi Hernandez
9777eb53c2 glusterd: don't force send-gids when manage-gids is off
Currently glusterd always sets send-gids to the negated value of
manage-gids. This is not correct when we just want to check user
permissions in the client side. In this case we don't need to enable
manage-gids, but we also don't need to enable send-gids.

Updates: #3781
Change-Id: Ia42825e7f6993896b1000a07d420b84d1d0422b6
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
2022-10-31 11:39:06 +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
Yaniv Kaul
9a1b8c37a2 iobuf: allocate/deallocate the ptr/freeptr along with the iobuf… (#3868)
Use a flexible array member and allocate the memory (pointed by freeptr/ptr), together with the iobuf itself.

Also, reoder the initialization of the structure's variables (but this could be done separately as well).

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-20 22:30:01 +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
Amar Tumballi
47207afcbf protocol/server: fix the server_getspec to serve the volfiles (#3745)
* protocol/server: fix the server_getspec to serve the volfiles

This commit fixes an option of serving volume files through
brick processes. While this feature is not a required feature
for any deployments using `glusterd`, it would be very useful
in scenarios where glusterd is not present, eg., container usecases,
and in projects like kadalu which only deals with management layer
changes.

few changes done with this commit:

* core: Add 'EVENT_SIGHUP' event to notify framework
* make `volfile` based process also handle SIGHUP
* add port parsing along with server, so we can have process hosted in any port
* test to demonstrate all this.

Updates: #3635, #3668
Change-Id: I5c8dfdee7d06b8d5fced4cc99059dfd8bed65260
Signed-off-by: Amar Tumballi <amar@kadalu.io>
2022-10-20 11:03:13 +05:30
Yaniv Kaul
e40cd0d456 client_t: improve client get/set/del functions (#3874)
Reduce code duplication, simplify, hopefully make faster.

Updates: #1000
Signed-off-by: Yaniv Kaul <mykaul@gmail.com>
2022-10-19 09:34:19 +02:00
Yaniv Kaul
bff9b26d8c memory accounting - reduce code in non DEBUG build (#3854)
- gf_mem_update_acct_info() is not needed when not in DEBUG mode
- re-order variables in the structure according to access pattern
- Turn xlator_mem_acct_unref() into xlator_mem_acct_destroy() and call it only when refcnt euqals 0 - which is quite rare.

Updates: #3855
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-18 10:19:48 +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
572c5e1b02 syncop: use flexible array for synctask's stack (allocate along the t… (#3861)
Use a single allocation for both the task and its stack, for locality.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-17 13:04:43 +02:00
Yaniv Kaul
8973551053 inode.c: dentry->name is now a flexible array member instead of a pointer (#3873)
It was later allocated anyway, via strdup(), so now it's allocated and
deallocated along with the dentry structure. Switched to using malloc()
instead of calloc() as we were initializing all members. Lastly, removed
the (now unused) pool for dentries.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-17 12:30:56 +02:00
Li kunyu
22dbbe1d33 macfuse/mount_darwin: remove a ';' (#3798)
Signed-off-by: Li zeming <zeming@nfschina.com>
2022-10-17 10:52:51 +05:30
Chinaboy
56a8f0682e SC2081: [ .. ] can't match globs. Use [[ .. ]] or grep. (#3791)
Shellcheck check out a problem.

Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
2022-10-17 10:52:22 +05:30
Yaniv Kaul
9f45d4cad1 inode.c/h: use flexible array member for inode _ctx struct (#3859)
* inode.c/h: use flexible array member for inode _ctx struct

We always know the _ctx array size on inode creation - so we can allocate it along with the inode struct itself

This also moves the inode creation from using a memory pool (if memory pool are enabled anyway) to regular GF_CALLOC().

Next patch will remove the inode pool.

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

* inode: remove unused inode_pool memory pool

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-14 10:13:43 +02:00
Yaniv Kaul
89e4f73ad9 iobuf: allocate iobuf arrays along with the arena itself (#3857)
For locality, reduce the no. of calls to CALLOC and the number of NULL checks, it's easier to just allocate
them together (since the no. of iobufs in an arena is known and fixed at the time of arena allocation)

This allows removal of some checks. I've also made the no. of iobufs a 32bit unsigned and ensured the struct is correctly aligned and without padding.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-14 10:09:21 +02:00
Yaniv Kaul
f503085e11 Make client_uid variable a flexible array member of client structure - and allocate / deallocate together (#3865)
* client_t: move scratch structure variables to be directly accessible from the client struct

Easier to read and a step into allocating with the client struct itself.

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

* client_t: remove not needed scratch ctx count

It doesn't change - it's always GF_CLIENTCTX_INITIAL_SIZE

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

* client_t: turn client scratch ctx to a flexible array member variable of client struct

Allocate it along with the whole client structure allocation.
Useful, as it's fixed size, the allocation is done under lock, and for locality.

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

* mem-types.h: remove unused memory type

The code is under #ifdef, commented out at the moment.

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

* client_t.c: move client_uid to be a flexible array member (instead of scratch ctx, which is actually constant size)

It wasn't the best choice to move scratch ctx to be a variable size - it isn't - it's very fixed and constant.
So turned client_uid into such.

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

* Remove additional GF_FREE() that is not needed.

* Fix review comments - remove unused memory type

Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-14 09:41:58 +02:00
Yaniv Kaul
a59eec15a5 Multiple minor changes to index xlator (#3848)
* index xlator: return a pointer instead of passing a variable to store the ctx

Similiar to other patches, we can just return the ctx object and check if it's NULL or not.

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

* index.c: use the return value of snprintf() to save few strlen() calls.

Instead of a strlen(), use the return value of a snprintf() call.

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

* index.c: make all relevant functions static

Updates: #1000
signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-10 11:41:53 +02:00
Yaniv Kaul
8742a8d3d3 changes to start support OpenSSL 3.0 (#3853)
OpenSSL 3.0.x deprecated some functions.
This patches changes one implementation to be compatible with the newer version.

Updates: #2916
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-10 11:38:48 +02:00
Yaniv Kaul
1dff14e52d io-stats.c: allocate io sample struct samples and buffer in a single allocation
Since the number of samples is known in sample struct creation time, we can allocate them in a single allocation call.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-10 08:45:54 +02:00
Yaniv Kaul
b4523b2bf1 epoll - allocate table 0 as part of the event pool allocation (#3862)
* event-epoll: allocate table 0 as part of the event pool object allocation

Since we allocate it initially anyway as part of the event pool allocation process, let's allocate it in the same call.

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

* event-epoll: turn slot_used to slot_avail and make it unsigned 64bit

It's faster to just compare it to 0 (if none are available) and there's no need for the padding - use a 64bit unsigned for it.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-10 08:36:59 +02:00
Yaniv Kaul
9865145667 iobuf.c: add to purge list only when needed (when not destroying the arena) (#3599)
Some minor cleanups as well.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-06 08:59:37 +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
Jaco Kroon
ca856da156 Inode table size fixes (#3716)
[inode.c] alternative hash strategy that grabs different bytes, without
mixing, and then modulo's that into the hash table size.

The old mechanism used the last two bytes only, thus allowing for a
distribution from 0x0 to 0xffff - which since 65536 is too small a hash
table to maintain sensible performance in some use cases is
insufficient. We require a much larger (minimum 4x larger but ideally
16x larger) distribution.

This isn't as predictive, it will use the sizeof(int) which can vary in
theory, but is generally 4 bytes, so we will use the first four completely
random bytes, and just straight modulo that, retaining the requirement
that the modulo must be a power of two (which further improves
performance by eliminating the multi-cycle division).

Glusterfs uses libuuid, which by default the entire 16 bytes is just
random, where time-based is used as a fallback.  Should we be using a
time-based UUID values this might be a problem if a lot of files were
initially created around the same time, or files are created in clusters
around the same time.  Previously if we were falling back to this two
bytes from the node portion of the UUID would have been used, which
would have been extremely bad for performance, as such I believe this
should not be a problem.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2022-10-06 08:07:29 +02:00
Yaniv Kaul
83ded619e7 Libvirt xml changes to gf_test (#3849)
* gftest: domain XML changes

* Reduce the no. of packages installed and repos used in 'yum' command
2022-10-06 08:03:01 +02:00
Xavi Hernandez
29a7be3d3f gftest: fix commit checkout
The specified commit in 'gftest build' command was interpreted as a
branch name instead of a commit hash, which was incorrect and caused
failures when trying to use a it.

Fixes: #3847
Change-Id: I3ae3f255996cced722573fdc9ae189acfb22eb85
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
2022-10-05 09:51:20 +02:00
Yaniv Kaul
bed2c2579d index.c: skip some strcmp() in case entry length is short enough. (#3843)
* index.c: skip some strcmp() in case entry length is short enough.

In most cases we'll calculate - strlen() the length of the entry.
Use that length - only if it's longer than 42, which is 'dirty-<uuid in ascii...>',
then there's a point in checking if it matches 'dirty-...' or 'xattrop-...' string.

(Note: unsure, but I suspect we could have and should have skipped . and .. in as well)

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

* bit-rot-stub-helpers.c: skip checking for stale entries based on file name length.

skip some strcmp() in case entry length is short enough.

In most cases we'll calculate - strlen() the length of the entry.
Use that length - only if it's not 41, which is 'stub-<uuid in ascii...>',
then there's a point in checking if it matches 'stub-...'  string.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-04 12:03:19 +02:00
Yaniv Kaul
f2d38cb88f fuse_readdirp_cbk() - minor modifications (#3846)
1. Reuse gf_fuse_fill_dirent() code
2. Pre-calc the attributes and timeouts - calc_timeout_sec() and calc_timeout_nsec() once.

Updates: #3845
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-10-04 11:55:20 +02:00
Mohit Agrawal
5c3ded20db afr: posix lock behavior is not correct while received an interrupt
The posix lock is not working correctly(1x3) if a process
has received an interrupt after wind a fop and the POSIX lock is
already held by another process.

Suppose there are two processes (P1, P2), P1 has requested an
exclusive POSIX lock on the file and it has received a successful response.
After that a process P2 is also tried to request the same lock and it
has been blocked because a lock is holding by another process.
After requesting the POSIX lock if process P2 received an interrupt then
fuse will send a clear request to the brick process to clear the blocked lock.
The issue is after receiving the error(if it is not EAGAIN) afr winds a fop
on other children. The afr first wind a fop on first active children once
it has received a status then winds a call on other children if it is not EAGAIN.

Solution: Along with EAGAIN afr needs to check EINTR error, the expectation
          is after receive an interrupt the lock should be clear by
          the brick process so avoid to wind a call on other children's
          in case if it has received EINTR error.

Fixes: #3831
Change-Id: I35c07c68708050a7497a1da6b05131e6e5848579
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
2022-10-04 11:48:25 +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
Dmitry Antipov
fb6e641f53 glusterd: cleanup __server_getspec()
Simplify '__server_getspec()' by using 'gf_asprintf()', add
proper error handling.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2022-09-30 12:58:08 +02:00
Xavi Hernandez
1278939a03 tests: new testing tool
A new tool gftest has been created to automate and simplify the
preparation of an environment to run tests. It can also process
the full set of regression tests in parallel to significantly
reduce the total execution time.

It's written in python and requires these components:

- libvirt
- qemu-kvm
- gnupg
- python-click

All other modules should already be present in a default installation.

Using this tool is quite simple:

1. Create the VM

```
gftest create [OPTIONS] <name>

Options:
  --template <name> Template to use (default: centos7)
  --port <num>      Port to access the VM (default: 2222)
  --key <path>      Private key for SSH (default: ~/.ssh/id_rsa)
  --cpus <num>      Number of virtual cores of the VM
  --memory <num>    Memory assigned to the VM in GiB
  --disk <num>      Disk space for the VM in GiB
```

This creates a KVM VM named <name> that can be accessed through the
specified port on the local host (i.e. `ssh -p <port> root@127.0.0.1`)
using the specified private key. All other option will be taken from
the template if not present.

This process also creates a container inside the VM with all the
required packages and configurations to build Gluster and run the
tests.

2. Build the code

```
gftest build [OPTIONS] <name>

Options:
  --commit <id>  SHA/name of the commit to compile
```

This copies the current git repo to the VM and compiles the specified
commit in a container image.

3. Start the workers

```
gftest spawn [OPTIONS] <name>

Options:
  --workers <num>  Number of workers to create
  --space <num>    Space allocated for running tests in GiB
```

This starts the specified number of container instances of the compiled
Gluster image.

4. Run the tests

```
gftest run <name> <output dir>
```

This runs the full set of tests in parallel in all available containers
and puts the results into the <output dir>.

It also collects statistics for each test and CPU and memory state
during the full run.

5. Access the VM or container for manual testing/debugging

```
gftest sh <name> [<idx>]
```

Without `idx` it opens a shell session to the VM. With an index it opens
a shell session to the idx-th testing container.

There are some additional commands:

- `gftest kill <name>`
  Stops and destroys all testing containers.

- `gftest shutdown <name>`
  Gracefully shuts down the VM.

- `gftest poweroff <name>`
  Forcibly stops the VM.

- `gftest poweron <name>`
  Starts the VM.

Updates: #3469
Change-Id: I169877a4c5197d001bf2822ad7116559f7d78754
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
2022-09-30 12:51:17 +02:00
Frédéric Moulins
064328f7dd extras: dynamic bash completion (#3751)
Move bash-completion script for the `gluster` command
in `/usr/share/bash-completion/completions`
instead of `/etc/bash_completion.d`.

Allow bash-completion to dynamically load the script
only when a user tries to tab complete on the `gluster` command.

Fixes: #3750
Change-Id: Ifca300bdf5b14a68726a6fdfdcc19052cf624f85
Signed-off-by: Frédéric Moulins <frederic@moulins.org>
2022-09-30 12:39:18 +02:00
Yaniv Kaul
ca3da2fcc9 posix-inode-fd-ops.c: perform
Exactly the same as in https://github.com/gluster/glusterfs/pull/3150 - we can run
__is_root_gfid() check once, no need to run it within the readdir loop.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-09-30 12:32:00 +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
48c9d3ca29 marker.c: lookup - skip dict ref/unref if marker version is not valid (#3421)
There's no point in doing a dict_ref() (or creating a new dictionary) and then eventually
unref (or deleting) if version <= 0, since no work will be done anyway.

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-09-28 14:02:23 +02:00
Yaniv Kaul
4a10f24888 Multiple files: reduce padding in structures
Examples:
struct gf_log_handle_
        /* size: 208, cachelines: 4, members: 22 */
        /* sum members: 194, holes: 2, sum holes: 8 */
        /* padding: 6 */
        /* last cacheline: 16 bytes */
After:
        /* size: 200, cachelines: 4, members: 22 */
        /* padding: 6 */
        /* last cacheline: 8 bytes */

struct clienttable {
        /* size: 72, cachelines: 2, members: 5 */
        /* sum members: 64, holes: 2, sum holes: 8 */
        /* last cacheline: 8 bytes */
After:
        /* size: 64, cachelines: 1, members: 5 */

struct gf_flock {
       /* size: 1056, cachelines: 17, members: 6 */
        /* sum members: 1052, holes: 1, sum holes: 4 */
        /* last cacheline: 32 bytes */
After:
        /* size: 1056, cachelines: 17, members: 6 */
        /* padding: 4 */
        /* last cacheline: 32 bytes */

struct _call_stack
        /* size: 1864, cachelines: 30, members: 25 */
        /* sum members: 1851, holes: 4, sum holes: 13 */
        /* last cacheline: 8 bytes */
After:
        /* size: 1856, cachelines: 29, members: 25 */
        /* sum members: 1851, holes: 1, sum holes: 5 */

struct _buffer {
        /* size: 80, cachelines: 2, members: 7 */
        /* sum members: 73, holes: 2, sum holes: 7 */
        /* last cacheline: 16 bytes */
After:
        /* size: 80, cachelines: 2, members: 7 */
        /* padding: 7 */
        /* last cacheline: 16 bytes */

struct _inode_table {
        /* size: 256, cachelines: 4, members: 26 */
        /* sum members: 233, holes: 5, sum holes: 20 */
        /* padding: 3 */
After:
        /* size: 240, cachelines: 4, members: 26 */
        /* padding: 7 */
        /* last cacheline: 48 bytes */

struct _fd {
        /* size: 120, cachelines: 2, members: 10 */
        /* sum members: 105, holes: 2, sum holes: 8 */
        /* padding: 7 */
        /* last cacheline: 56 bytes */
After:
        /* size: 112, cachelines: 2, members: 10 */
        /* padding: 7 */
        /* last cacheline: 48 bytes */

struct _client {
      /* size: 200, cachelines: 4, members: 14 */
        /* sum members: 192, holes: 2, sum holes: 8 */
        /* last cacheline: 8 bytes */
After:
       /* size: 192, cachelines: 3, members: 14 */

struct rpc_req {
        /* size: 496, cachelines: 8, members: 10 */
        /* sum members: 488, holes: 1, sum holes: 4 */
        /* padding: 4 */
        /* last cacheline: 48 bytes */
After:
        /* size: 488, cachelines: 8, members: 10 */
        /* last cacheline: 40 bytes */

struct syncenv {
        /* size: 16032, cachelines: 251, members: 12 */
        /* sum members: 16024, holes: 1, sum holes: 4 */
        /* padding: 4 */
        /* last cacheline: 32 bytes */
After:
        /* size: 16024, cachelines: 251, members: 12 */
        /* last cacheline: 24 bytes */

struct glusterd_brickinfo {
        /* size: 25968, cachelines: 406, members: 30 */
        /* sum members: 25953, holes: 2, sum holes: 8 */
        /* padding: 7 */
        /* last cacheline: 48 bytes */
After:
        /* size: 25960, cachelines: 406, members: 30 */
        /* sum members: 25953, holes: 1, sum holes: 4 */
        /* padding: 3 */
        /* last cacheline: 40 bytes */

struct ios_conf {
        /* size: 6792, cachelines: 107, members: 21 */
        /* sum members: 6769, holes: 4, sum holes: 19 */
        /* padding: 4 */
        /* last cacheline: 8 bytes */
After:
        /* size: 6776, cachelines: 106, members: 21 */
        /* sum members: 6769, holes: 2, sum holes: 7 */
        /* last cacheline: 56 bytes */

struct posix_aio_cb {
        /* size: 272, cachelines: 5, members: 9 */
        /* sum members: 264, holes: 2, sum holes: 8 */
        /* last cacheline: 16 bytes */
After:
        /* size: 264, cachelines: 5, members: 9 */
        /* last cacheline: 8 bytes */

Updates: #1000
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-09-28 13:56:51 +02:00
Shwetha Acharya
2621b47f1e tests: daemon-log-level-option.t regression failures (#3837)
Problem: It takes a while for /var/log/glusterfs/glustershd.log
         to get created and populated
         after the volume start command firing.
         Hence, a grep expecting particular value inside
         /var/log/glusterfs/glustershd.log always fails
         when executed soon after firing the volume
         start command

Solution:Verify online_brick_count to make sure volume start is
         complete and the log file is created
         before grepping for the values in it.

Fixes: #3836
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>

Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
2022-09-27 19:47:36 +05:30
Harshita Shree
ba991795b8 afr: reduce variable indirection (#3565)
Sequence to patch #3532

Reducing variable indirection and making use of more scoped variables
when possible in the afr component.

Updates: #2986
Change-Id: Ide73d8b5a679e6edd670110f1e3ac3d39347e0e9
Signed-off-by: harshita-shree <hshree@redhat.com>
2022-09-23 11:06:29 +02:00
Amar Tumballi
76d59aebfb ec: fix the setxattr of simple-quota limit (#3672)
Simple-quota works on the idea that each brick knows what its capacity
at the directory level are. In EC, the brick doesn't have full data but
reduced by a factor of fragments. Thus, in this special case, while
sending the limit itself, good to handle the fragment size part.

Updates: #3638
Change-Id: Id341de5afe59a7348c5eb15c51555243363550ef
Signed-off-by: Amar Tumballi <amar@dhiway.com>
2022-09-22 11:00:14 +02:00
Frédéric Moulins
6dd0d396ad rfc.sh: fix git remote upstream search (#3824)
Force `LANGUAGE` to parse `git remote` output.

Stop the script if the upstream cannot be determined.

Change-Id: Id7bd53d003ebb329b866044ac69fd47f64e4f3d0
Updates: #3823
Signed-off-by: Frédéric Moulins <frederic@moulins.org>
2022-09-22 09:27:23 +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
Yaniv Kaul
6b69f4802d afr-no-fsync.t: disable cluster.lookup-optimize and skip initial FSYNCDIR (#3709)
Per #2253 we need to disable lookup-optimize feature.

More importantly, there are some FSYNCDIR (4 of them) that appear for some reason too soon.
Re-order the profile start - give 5 seconds for those to be done with and then start profiling.

Fixes: #3708
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-09-21 11:46:46 +02:00
JamesWSWu
56815f6529 marker: make synctask's stack size larger (#3711)
The size of the stack for synctasks created by marker xlator was
only 16 KiB. Now they use the default stack size for synctasks.

Fixes: #3710
Signed-off-by: 10255046 <wu.shiwei@zte.com.cn>
2022-09-21 11:27:06 +02:00