Commit 057a6cf7 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-14132 : fix posix_fallocate() calls to workaround some (ancient) Linux bugs

With this patch, parameters passed to posix_fallocate() will be
the same as they were prior to refactoring in  commit b731a5bc

In particular, 'offset' parameter for posix_fallocate is again current_file_size
and 'length' is new_file_size - current_file_size.

This seems to fix crashes on ancient Linux (kernel 2.6).
parent 1792a80a
......@@ -5381,7 +5381,8 @@ os_file_set_size(
# ifdef HAVE_POSIX_FALLOCATE
int err;
do {
err = posix_fallocate(file, 0, size);
os_offset_t current_size = os_file_get_size(file);
err = posix_fallocate(file, current_size, size - current_size);
} while (err == EINTR
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment