Gluster volume create command fails to use the hostnames
that starts with `0.`
```
Please provide a valid hostname/ip other than localhost, 127.0.0.1 or
loopback address (0.0.0.0 to 0.255.255.255).
```
For example:
```
gluster volume create vol1 0.s1.dev:/data/gfs/vol1/b1 force
```
Fixes: #4309
Signed-off-by: Aravinda VK <aravinda@kadalu.tech>
The brick process is getting crashed due to stack overflow
while unref namespace inode, the ns inode was introduced by
the patch ((https://github.com/gluster/glusterfs/pull/1763)
Solution: __inode_destroy is calling inode_unref that is again
calling inode_unref become a recursive call and eventually a
brick process is getting crashed. To avoid a crash for namespace
inode call only __inode_ref.
Fixes: #4295
Change-Id: If5deb06b726a5e7dfedd2784bddcef81e6e5d7d9
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Before this patch, the trusted.posix_acl_default xattr was not allowed
to be set or modified on a geo-replicated volume.
This patch allows setting/modifying this xattr.
Fixes: #959
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Now that we are using glfs_open to open directory fd,
we should initialize the dentry list.
Change-Id: I6193eb83d80220ebef6ac4331bf984c8b4d6c49d
Signed-off-by: Mohammed Rafi KC <rafi.kavungal@iternity.com>
GNU grep v3.8 release notes[1] has the following mention about the usage
of backslahes:
"Regular expressions with stray backslashes now cause warnings, as their
unspecified behavior can lead to unexpected results."
As a result we see the warning "grep: warning: stray \ before -" during
script execution. Therefore remove the extra `\` from grep command.
Please note that this exact change was committed into mount_glusterfs.in
via 162d007dae but not here.
[1] https://savannah.gnu.org/forum/forum.php?forum_id=10227
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
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
Change-Id: I8fe801fb536879d13a3c84eb2d935932b44dbaf5
Fixes: #4166
Signed-off-by: Mohammed Rafi KC <rafi.kavungal@iternity.com>
A brick process may crash while it try to send upcall notification
to the client and client disconnect is being process.
Solution: Avoid upcall event notification to the client if disconnect
is being process for the same client.
Fixes: #4255
Change-Id: I80478d7f4a038b04a10fb21a1290b4309e9fe4dd
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
The client is throwing below stacktrace while asan is enabled.
The client is facing an issue while application is trying
to call removexattr in 2x1 subvol and non-mds subvol is down.
As we can see in below stacktrace dht_setxattr_mds_cbk is calling
dht_setxattr_non_mds_cbk and dht_setxattr_non_mds_cbk is trying to
wipe local because call_cnt is 0 but dht_setxattr_mds_cbk is trying
to access frame->local that;s why it is crashed.
x621000051c34 is located 1844 bytes inside of 4164-byte region [0x621000051500,0x621000052544)
freed by thread T7 here:
#0 0x7f916ccb9388 in __interceptor_free.part.0 (/lib64/libasan.so.8+0xb9388)
#1 0x7f91654af204 in dht_local_wipe /root/glusterfs_new/glusterfs/xlators/cluster/dht/src/dht-helper.c:713
#2 0x7f91654af204 in dht_setxattr_non_mds_cbk /root/glusterfs_new/glusterfs/xlators/cluster/dht/src/dht-common.c:3900
#3 0x7f91694c1f42 in client4_0_removexattr_cbk /root/glusterfs_new/glusterfs/xlators/protocol/client/src/client-rpc-fops_v2.c:1061
#4 0x7f91694ba26f in client_submit_request /root/glusterfs_new/glusterfs/xlators/protocol/client/src/client.c:288
#5 0x7f91695021bd in client4_0_removexattr /root/glusterfs_new/glusterfs/xlators/protocol/client/src/client-rpc-fops_v2.c:4480
#6 0x7f91694a5f56 in client_removexattr /root/glusterfs_new/glusterfs/xlators/protocol/client/src/client.c:1439
#7 0x7f91654a1161 in dht_setxattr_mds_cbk /root/glusterfs_new/glusterfs/xlators/cluster/dht/src/dht-common.c:3979
#8 0x7f91694c1f42 in client4_0_removexattr_cbk /root/glusterfs_new/glusterfs/xlators/protocol/client/src/client-rpc-fops_v2.c:1061
#9 0x7f916cbc4340 in rpc_clnt_handle_reply /root/glusterfs_new/glusterfs/rpc/rpc-lib/src/rpc-clnt.c:723
#10 0x7f916cbc4340 in rpc_clnt_notify /root/glusterfs_new/glusterfs/rpc/rpc-lib/src/rpc-clnt.c:890
#11 0x7f916cbb7ec5 in rpc_transport_notify /root/glusterfs_new/glusterfs/rpc/rpc-lib/src/rpc-transport.c:504
#12 0x7f916a1aa5fa in socket_event_poll_in_async /root/glusterfs_new/glusterfs/rpc/rpc-transport/socket/src/socket.c:2358
#13 0x7f916a1bd7c2 in gf_async ../../../../libglusterfs/src/glusterfs/async.h:187
#14 0x7f916a1bd7c2 in socket_event_poll_in /root/glusterfs_new/glusterfs/rpc/rpc-transport/socket/src/socket.c:2399
#15 0x7f916a1bd7c2 in socket_event_handler /root/glusterfs_new/glusterfs/rpc/rpc-transport/socket/src/socket.c:2790
#16 0x7f916a1bd7c2 in socket_event_handler /root/glusterfs_new/glusterfs/rpc/rpc-transport/socket/src/socket.c:2710
#17 0x7f916c946d22 in event_dispatch_epoll_handler /root/glusterfs_new/glusterfs/libglusterfs/src/event-epoll.c:614
#18 0x7f916c946d22 in event_dispatch_epoll_worker /root/glusterfs_new/glusterfs/libglusterfs/src/event-epoll.c:725
#19 0x7f916be8cdec in start_thread (/lib64/libc.so.6+0x8cdec)
Solution: Use switch instead of using if statement to wind a operation, in case of switch
the code will not try to access local after wind a operation for last dht
subvol.
Fixes: #3732
Change-Id: I031bc814d6df98058430ef4de7040e3370d1c677
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
In grep v3.8-3 will raise warning when use glusterfs fuse mount
Warning log:
/usr/bin/mount -t glusterfs -o acl 169.254.0.23:/home /tmp/test
grep: warning: stray \ before -
Fixes: #4198
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>
After upgrade on 10.3 and release-11 the gluster is throwing
ENOSPC error. To fix the original issue we have not received any
reproducer so i have decided to revert the patch.
This reverts commit 9621e3e94c.
Fixes: #3636
Change-Id: Ief1f8a486699895d040bd467c121a33ce2a79acd
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
The len parameter passed to the afr_zerofill() function has type
mismatch in the function prototype and the definition. Correcting
it to use the appropriate type.
Fixes: #3822
Signed-off-by: karthik-us <ksubrahm@redhat.com>
* auth.allow: fix gf_is_ip_in_net
Problem:
When auth.allow is set to a subnet address, the hosts which
belong to the same subnet are not able to mount glusterfs volume.
The hosts outside the subnet are able to mount glusterfs volume.
Cause:
1. When the host ip and subnet ip are converted from string to
long using inet_pton, the output is in host byte order, where the subnet
mask is in network byte order.
2. The subnet mask for ipv4 should contain 1's (x times, for /x) followed
by 0's (32 - x times). The currene implementation gives a different submask.
Fix:
1. Convert the ip addresses to network byte order from host byte order
2. Get correct subnet mask
fixes:#4108
Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>
* Fix clange issueswq
Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>
* addressing review comments
* apply clang format changes
* apply clang format changes
* address review comments
* link -lresolv to libglusterfs
* add changes
* -s
* add lresolv to compile test .c file
* do not link lresolv for freebsd
Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>
* add the lresolv lib changes outside debug section
Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>
* change variable name
---------
Signed-off-by: Sanju Rakonde <sanju.rakonde@phonepe.com>
Rebalance daemon is deleting a data file instead of linkfile which
causes an entire file to be deleted from gluster namespace leading
to a complete data loss.
This data loss occurs in the following situations:-
1) Entire file is deleted
This happens when there is a linkfile on the hashed
subvol. In this case, rebalance daemon will add both
linkfile and data file to the queue. Let's say the
data file entry picked up first to migrate and let's
say the entry is migrated successfully. When the linkfile
is picked up from the queue, when they check that the
added linkfile has both hashed and cached to the same
subvol, then they assume that it is a linfile and then
it got deleted. They check for the linkfile is performed
on the stbuf populated during the rebalance readdir.
So by the time when the check are done, the file is now
migrated and had a datafile
2) Wrong permission and Incorrect size:
Similar to above case, this happens when a linkfile and
data file are picked up to migrate at the same time,
in this case, a failure can happen at different stages of
rebalance process and due to this rebalance failure,
a cleanup might be done on the destination where the rebalance
has incomplete, but by the time the first one might be completed
and the cleanup would have been done on an actual file due to this
either we may end up with the wrong permissions
like "----------." or a data file with incomplete
information.
Change-Id: I22f1c9b35811be83bde08c4f30db9d5582d2d2fc
Fixes: #4148
Signed-off-by: Mohammed Rafi KC <rafi.kavungal@iternity.com>
When glusterfs is complied with --with-ipv6-default option it results
in warning operation not supported when glusterd started, which is
fixed here.
Fixes: #3701
Change-Id: I5221431309311da3008f41db77fb0e48ff448746
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* server: fix authentication module management
Previously the server xlator did reload the authentication modules each
time a configuration change happened. Besides a crash caused by an
incorrect handling of the module's options, this behavior is completely
incorrect in a brick-mux process.
Each brick could use a different authentication module, so we can't just
unload all of them when a new brick is added because this could cause
problems on the other existing bricks.
This patch creates a list of authentication modules and adds newer
modules if not already present, but never destroys/unloads an existing
one (we currently don't have any way to know if it's sill in use by any
brick). The modules are only destroyed during cleanup.
Then, for each brick using the module, the options are added to the
brick's private volume_options list, which is managed and destroyed by
the regular xlator life-cycle.
Fixes: #3600
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
* libglusterfs: prevent a stale pointer to cause a crash
When brick-mux was enabled and the first loaded brick was removed for some
reason, a stale pointer remained in the graph structure, causing a crash
when it was used.
This patch just sets the pointer to NULL when the removed brick is the one
the pointer was referencing. There doesn't seem to be any benefit of
keeping it pointing to some other remaining random brick.
Fixes: #3600
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
---------
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
The test assumes a block size of 512 bytes for direct I/O. It has been
updated to use a block size of 4 KiB.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
The smallest disk access for dispersed volumes is 512 bytes. That's fine
when the underlying disk/filesystem uses 512-bytes blocks. However, if
the block size of the bricks is 4KiB, then direct I/O will fail unless
an explicit bigger block size is used.
To fix the test, just increase the block size used for reads.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
The kill_brick code uses gf_attach to force the brick process to detach
the brick. For non brick-mux tests this is equivalent to stopping the
process. For brick-mux, the selected brick is stopped using an asynhronous
thread. In some cases glusterd may report the brick as stopped even
before the stop has completed.
To avoid races with future restarts, kill_brick needs to wait until the
brick is really stopped, but there's no easy way to know that. For now
I've just added a small delay.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
The commit 5118f1a001 corrects
the distCount value but due to that voltype has changed
because the function get_vol_type is not updated.
Solution: No need to measure voltype if distCount is 1
Fixes: #4107
Change-Id: I16e7e906d64b01398b40c0a634924a5bf9069b58
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
On some systems, the previous method to try to determine if
copy_file_range() is supported was to check the symbol in
/proc/kallsyms. However there are some cases where the symbol
can be found, but still it's not supported, like if fuse doesn't
implement it.
To avoid all possible combinations, just run the test normally and
check for system call availability on first execution. If it's not
there, just skip the remaining tests. Otherwise continue the test.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Fix improper use of negative value issues in
posix-inode-fd-ops.c
CIDs: 1502320, 1502308, 1502290
Change-Id: I2154890a1d58ea842c2e78e0042019bdfd583f93
Updates: #1060
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Do not use __WORDSIZE as a proxy for size_of(time_t), because:
- non-portable, __WORDSIZE only exists in glibc
- unrelated information, there is at best some random overlap
between the size of the machine word and the size of time_t
(e.g. NetBSD has sizeof(time_t) == 8 even on 32bit systems)
Instead modify ./configure to correctly determine sizeof(time_t) at
build time to set a #define and then use this correct value.
Change-Id: Ie8f955241582f56f888af3160fbaba46cdb66c0e
Fixes: #3942
Signed-off-by: Alexander Schreiber <als@thangorodrim.de>
The test assumes that a block size of 1024 bytes is enough for direct
I/O. However filesystems with 4KiB blocks would fail.
Just change the block size to 4KiB.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
The 'fstrim' command has been added to the cleanup function to help
release unused space for devices that support discard operation.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
* [events-api] Write cfg file with exclusive locks
to prevent race cases that might occur when several nodes
are trying to create the config file at the same time
if it is non existent (first run).
Fixes: #3714
Updates: #3715
Signed-off-by: black-dragon74 <niryadav@redhat.com>
* [events-api] Use tempfiles for parallel writes without contention
The tempfile created is different everytime, the logic of which is
encapsulated in `NamedTempOpen` class.
Once we are done writing the data to the file it is then persisted to the
disk with `os.rename()` call under the name of `filename` passed as an arg
when instantiating the class.
This approach saves us the need of fcntl locks and still guarantees the sanity
of the file.
Signed-off-by: black-dragon74 <niryadav@redhat.com>
* [events-api] Close FD before renaming the file
As after rename fop, the already open file descriptor
will be stale and in a bad state which is erroneous.
Signed-off-by: black-dragon74 <niryadav@redhat.com>
* [events-api] Hidden temp file and use dest dir as wd
The temp file created by `NamedTempOpen` is now hidden (prefixed
with a '.'). Additionally the temp file is now created in the dest
dir of the named file, i.e. in case the filepath is /foo/bar, the
temp file will be created inside /foo.
In case the dest dir cannot be determined (cases where the path is just
a filename eg. 'myfile.json`), cwd of the process is used. However, we
will never encounter this use case as we always provide the full path.
Signed-off-by: black-dragon74 <niryadav@redhat.com>
* [events-api] Remove zombie file in case of exception
Signed-off-by: black-dragon74 <niryadav@redhat.com>
* [events-api] Refactor code as per reviews
Signed-off-by: black-dragon74 <niryadav@redhat.com>
* Fix regression failures due to py3 syntax
Change-Id: I976ded40393c6b84c4c08428f3a025df1e21b614
Signed-off-by: black-dragon74 <niryadav@redhat.com>
---------
Signed-off-by: black-dragon74 <niryadav@redhat.com>
In the previous implementation, when the mtime, ctime and atime of an
snapshot virtual directory was requested, the returned time was the
current time.
Apparently, the old versions of kernel's nfs client did ignore this
change during a readdir operation. However, newer versions are checking
it and retrying the whole readdir operation when these times differ from
the previous request (I guess that it assumes that the directory
contents have been changed and tries to get the new contents). This
causes a long delay or even an infinite loop.
The optimal change would be to keep the time of modification and changes
in the inode context of the virtual directories to always return stable
and consistent data, but this requires a significant amount of changes.
For now, just return a constant value for these specific entries.
Fixes: #4071
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
If for some reason there exist a directory named /root/test, the test
was failing. Just use another random path very unlikely to exist.
This patch also replaces the undefined "D0" variable to "B0" to avoid
creating directories in the root of the filesystem.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Glusterd generates some files inside /tmp. In general that shouldn't be
a problem. However during the regression test run, some tests start
several glusterd instances in the same machine. When this happens,
there's a chance that two processes try to update the same file at the
same time, causing errors and spurious test failures.
This patch forces that the filename generated in /tmp is different for
each process, avoiding this problem.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
The test wants to corrupt a disk, but in some cases the data that is
being corrupted is alread cached, so the damaged data is never seen by
the kernel.
This patch forces a drop of the caches to ensure that the corrupted data
is read and the error is triggered.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Some tests are failing spuriously because of a timeout, or running very
near of the default 200 seconds limit.
The timeout of some of the detected tests has been increased to 300
seconds.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
The test has been updated to avoid infinite waits in case that something
goes wrong.
It also uses TERM signal instead of INT signal because INT signal may be
masked in some cases by bash (background processes for example). TERM
always works.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
* [cli-cmd] Fix return type
time_t is signed on UNIX/POSIX compliant systems.
Use time_t for better clarity of return type
Change-Id: I47976d63f122f24e095c1aacf7a50b50e46616b3
Signed-off-by: black-dragon74 <niryadav@redhat.com>
time_t values were being cast to uint32_t values inside gidcache.
This patch addresses this issue.
CID: 1493180
Signed-off-by: black-dragon74 <niryadav@redhat.com>
Apparently newer versions of LVM commands (pvcreate and vgcreate) don't
accept a symbolic link as the device.
This patch just resolves the symbolic link before passing the path to
these commands.
Updates: #4020
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Several Gluster components expect that op_errno is set to ENOENT when
there are no more entries in a directory being read.
Previously, snapview-server returned EINVAL in this case, causing an
infinite loop in some cases.
Updates: #4029
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
* posix: fix directory gfid handle if a rename fails
When a directory is renamed to a non-empty existing directory, the
rename will fail. However, the gfid handle of the old directory was
removed before attempting the rename, at it was not restored in case of
failure.
This patch only removes the gfid handle once the rename has succeeded.
Fixes: #2752
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
One array allocated using alloca() was not using the right size,
corrupting adjacent memory when the array was used.
Also updated the related tests since they were not working correctly.
The test tried to pass some data through a variable that was created in
a child subshell, so the variable was empty in the parent.
To implement the same functionality but supporting passing data between
subshells, a new test command has been created: TEST_WITHIN.
It works like TEST but if the test is not successful, it waits for some
time before marking the test as bad. Once the test succeeds, whatever
data the test has returned during its execution will be available in the
variable TEST_OUTPUT.
Fixes: #4042
Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>