From a4c02bee2c39196cd699d2e85484d012f2708f7e Mon Sep 17 00:00:00 2001 From: yan_gao <> Date: Sat, 15 Jan 2022 20:45:08 +0000 Subject: [PATCH] Update libqb to version 2.0.4+20211112.a2691b9 / rev 33 via SR 946348 https://build.opensuse.org/request/show/946348 by user yan_gao + dimstar_suse - Retry if posix_fallocate is interrupted with EINTR (#453) (gh#ClusterLabs/libqb#451, bsc#1193737, bsc#1193912) * bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch - IPC: server: avoid temporary channel priority loss, up to deadlock-worth (gh#ClusterLabs/libqb#352, rh#1718773, bsc#1188212) (forwarded request 946347 from yan_gao) --- packages/libq/libqb/.files | Bin 330 -> 443 bytes packages/libq/libqb/.rev | 11 +++ packages/libq/libqb/.servicemark | 2 +- ...allocate-is-interrupted-with-EINTR-4.patch | 78 ++++++++++++++++++ packages/libq/libqb/libqb.changes | 8 +- packages/libq/libqb/libqb.spec | 4 +- 6 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 packages/libq/libqb/bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch diff --git a/packages/libq/libqb/.files b/packages/libq/libqb/.files index 9fa93e14b08374a2e51cfcb8bc3f39c10a222b7f..8c1df5a87c5814c6dbc8e16b3ae5158c57a3eddb 100644 GIT binary patch delta 239 zcmXBOO-ckY5Cz~K2N8Pk4ub16l~npC2XHY6E(Z5fNh)@r>1jI=^%#ve@EYF0g=aG0 z?k(QOdp{T7`@@nlT-N)ls;;)*Zg$3@)zov45*W$QfYNx|qGteAYWFs|TPY3p*b4xV z;>3CV5HX15oZ|aaplLcg$}D0Man8K1uS;ex-eMlb-SOe^By_V-cH`%6cf|T8p!MDZ zb;`0)vQ{66h>wH@mV z*0wdqZ03D~5(7rZnM)GyycQ4^a3L^2QpK`Fd%xvpKGac*-HFrG6KB-kp~iu{5)Mj1 YnLV9(`Q87Qt2{1R=TieyhtvD`0}YEJMgRZ+ diff --git a/packages/libq/libqb/.rev b/packages/libq/libqb/.rev index c58bf7e989e..a24de7bb7e5 100644 --- a/packages/libq/libqb/.rev +++ b/packages/libq/libqb/.rev @@ -306,4 +306,15 @@ 934505 + + 941b4ec244454a8f052a8aff54f815bf + 2.0.4+20211112.a2691b9 + + dimstar_suse + - Retry if posix_fallocate is interrupted with EINTR (#453) (gh#ClusterLabs/libqb#451, bsc#1193737, bsc#1193912) + * bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch + +- IPC: server: avoid temporary channel priority loss, up to deadlock-worth (gh#ClusterLabs/libqb#352, rh#1718773, bsc#1188212) (forwarded request 946347 from yan_gao) + 946348 + diff --git a/packages/libq/libqb/.servicemark b/packages/libq/libqb/.servicemark index 530708a96eb..a44ec661477 100644 --- a/packages/libq/libqb/.servicemark +++ b/packages/libq/libqb/.servicemark @@ -1 +1 @@ -5a390c9d7dabed3b2b8fc6657b866996 +40d05350c69408103d3e6fc4feba4211 diff --git a/packages/libq/libqb/bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch b/packages/libq/libqb/bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch new file mode 100644 index 00000000000..a477b83b6a1 --- /dev/null +++ b/packages/libq/libqb/bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch @@ -0,0 +1,78 @@ +From 176eae8f13278a5a3dab3699b84e1dc9a8d4ae11 Mon Sep 17 00:00:00 2001 +From: Jakub Jankowski +Date: Fri, 14 Jan 2022 08:57:25 +0100 +Subject: [PATCH] Retry if posix_fallocate is interrupted with EINTR (#453) + +Every now and then Pacemaker reports errors: + + (pcmk__new_client) debug: New IPC client 3efdbecf-c2d9-44bc-b4a6-9bcd48021ba1 for PID 27492 with uid 0 and gid 0 + (handle_new_connection) debug: IPC credentials authenticated (/dev/shm/qb-7271-27492-12-hfPbKY/qb) + (qb_ipcs_shm_connect) debug: connecting to client [27492] + (qb_rb_open_2) debug: shm size:524301; real_size:528384; rb->word_size:132096 + (qb_rb_open_2) debug: shm size:524301; real_size:528384; rb->word_size:132096 + (qb_sys_mmap_file_open) error: couldn't allocate file /dev/shm/qb-7271-27492-12-hfPbKY/qb-event-cib_rw-data: Interrupted system call (4) + (qb_rb_open_2) error: couldn't create file for mmap + (qb_ipcs_shm_rb_open) error: qb_rb_open:/dev/shm/qb-7271-27492-12-hfPbKY/qb-event-cib_rw: Interrupted system call (4) + (qb_rb_close_helper) debug: Free'ing ringbuffer: /dev/shm/qb-7271-27492-12-hfPbKY/qb-response-cib_rw-header + (qb_rb_close_helper) debug: Free'ing ringbuffer: /dev/shm/qb-7271-27492-12-hfPbKY/qb-request-cib_rw-header + (qb_ipcs_shm_connect) error: shm connection FAILED: Interrupted system call (4) + (handle_new_connection) error: Error in connection setup (/dev/shm/qb-7271-27492-12-hfPbKY/qb): Interrupted system call (4) + +While it probably might be addressed in Pacemaker code, a simple retry +loop in case posix_fallocate(3) returns EINTR seems to be a decent +workaround. + +Fixes: #451 + +Signed-off-by: Jakub Jankowski +Reviewed-by: Christine Caulfield +--- + lib/unix.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + +diff --git a/lib/unix.c b/lib/unix.c +index 2fb53d0..b631cbf 100644 +--- a/lib/unix.c ++++ b/lib/unix.c +@@ -81,6 +81,9 @@ qb_sys_mmap_file_open(char *path, const char *file, size_t bytes, + int32_t i; + #endif + char *is_absolute = strchr(file, '/'); ++#ifdef HAVE_POSIX_FALLOCATE ++ int32_t fallocate_retry = 5; ++#endif + + if (is_absolute) { + (void)strlcpy(path, file, PATH_MAX); +@@ -121,12 +124,22 @@ qb_sys_mmap_file_open(char *path, const char *file, size_t bytes, + } + #endif + #ifdef HAVE_POSIX_FALLOCATE +- if ((res = posix_fallocate(fd, 0, bytes)) != 0) { +- errno = res; +- res = -1 * res; +- qb_util_perror(LOG_ERR, "couldn't allocate file %s", path); +- goto unlink_exit; +- } ++ /* posix_fallocate(3) can be interrupted by a signal, ++ so retry few times before giving up */ ++ do { ++ fallocate_retry--; ++ res = posix_fallocate(fd, 0, bytes); ++ if (res == EINTR) { ++ qb_util_log(LOG_DEBUG, "got EINTR trying to allocate file %s, retrying...", path); ++ continue; ++ } else if (res != 0) { ++ errno = res; ++ res = -1 * res; ++ qb_util_perror(LOG_ERR, "couldn't allocate file %s", path); ++ goto unlink_exit; ++ } ++ break; ++ } while (fallocate_retry > 0); + #else + if (file_flags & O_CREAT) { + long page_size = sysconf(_SC_PAGESIZE); +-- +2.31.1 + diff --git a/packages/libq/libqb/libqb.changes b/packages/libq/libqb/libqb.changes index 71ebd3c160e..a6d934c3808 100644 --- a/packages/libq/libqb/libqb.changes +++ b/packages/libq/libqb/libqb.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 14 08:06:10 UTC 2022 - Yan Gao + +- Retry if posix_fallocate is interrupted with EINTR (#453) (gh#ClusterLabs/libqb#451, bsc#1193737, bsc#1193912) + * bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch + ------------------------------------------------------------------- Thu Nov 25 15:05:06 UTC 2021 - Dominique Leuenberger @@ -86,7 +92,7 @@ Mon May 04 11:17:51 UTC 2020 - Yan Gao - log: Set errno when qb_log_target_alloc() fails - ipc: Remove kqueue EOF log message - ipc: fix force-filesystem-sockets -- IPC: server: avoid temporary channel priority loss, up to deadlock-worth (rh#1718773) +- IPC: server: avoid temporary channel priority loss, up to deadlock-worth (gh#ClusterLabs/libqb#352, rh#1718773, bsc#1188212) - ipc: Use mkdtemp for more secure IPC files ------------------------------------------------------------------- diff --git a/packages/libq/libqb/libqb.spec b/packages/libq/libqb/libqb.spec index a10fa272322..167b3c3b096 100644 --- a/packages/libq/libqb/libqb.spec +++ b/packages/libq/libqb/libqb.spec @@ -1,7 +1,7 @@ # # spec file for package libqb # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -29,6 +29,7 @@ Group: Development/Libraries/C and C++ URL: https://github.com/ClusterLabs/libqb Source0: %{name}-%{version}.tar.xz Source1: baselibs.conf +Patch1: bsc#1193737-0001-Retry-if-posix_fallocate-is-interrupted-with-EINTR-4.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf @@ -75,6 +76,7 @@ features. It provides logging, tracing, IPC, and polling. %prep %setup -q -n %{name}-%{version} +%patch1 -p1 %build if [ ! -f .tarball-version ]; then