Skip to content

Commit

Permalink
Revert the removal of umask setting in xtrabckup.cc
Browse files Browse the repository at this point in the history
Allow resetting the umask for xtrabackup, otherwise it should be set only once as from upstream.
  • Loading branch information
Aibek Bukabayev committed Jul 29, 2024
1 parent a08de37 commit 5880fef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions storage/innobase/include/os0file.h
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,12 @@ private to this module, and to the file creation methods, so it should not be
used directly. */
constexpr mode_t os_innodb_umask_default = std::numeric_limits<mode_t>::max();

#ifdef XTRABACKUP
/** We need to allow resetting the umask in case of xtrabackup.
*/
void os_file_allow_reset_umask();
#endif /* XTRABACKUP */

#endif

/** Free storage space associated with a section of the file.
Expand Down
11 changes: 8 additions & 3 deletions storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ still created. See Kernel Bugzilla Bug 218049 */
Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to my_umask.
It is a global value and can't be modified once it is set. */
static mode_t os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
static bool umask_was_already_set{false};
#else
/** On Windows when using native AIO the number of AIO requests
that a thread can handle at a given time is limited to 32
Expand Down Expand Up @@ -7884,11 +7885,15 @@ void os_aio_print_pending_io(FILE *file) { AIO::print_to_file(file); }

#ifndef _WIN32
void os_file_set_umask(mode_t umask) {
static bool was_already_set{false};
ut_a(!was_already_set);
was_already_set = true;
ut_a(!umask_was_already_set);
umask_was_already_set = true;
os_innodb_umask = umask;
}

#ifdef XTRABACKUP
void os_file_allow_reset_umask() { umask_was_already_set = false; }
#endif /* XTRABACKUP */

#endif

/** Check if the path is a directory. The file/directory must exist.
Expand Down
4 changes: 4 additions & 0 deletions storage/innobase/xtrabackup/src/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,10 @@ static bool innodb_init_param(void) {
}
}

os_file_allow_reset_umask();

os_file_set_umask((ulint)0664);

/* Setup the memory alloc/free tracing mechanisms before calling
any functions that could possibly allocate memory. */
ut_new_boot();
Expand Down

0 comments on commit 5880fef

Please sign in to comment.