You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2024/12/24 02:38:11 UTC
(cloudberry) 14/38: Don't clobber postmaster sigmask in dsm_impl_resize.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit f47d859fcd19d6e8b483a0f594b630b1f6292a73
Author: Thomas Munro <tm...@postgresql.org>
AuthorDate: Fri Jul 15 01:23:29 2022 +1200
Don't clobber postmaster sigmask in dsm_impl_resize.
Commit 4518c798 intended to block signals in regular backends that
allocate DSM segments, but dsm_impl_resize() is also reached by
dsm_postmaster_startup(). It's not OK to clobber the postmaster's
signal mask, so only manipulate the signal mask when under the
postmaster.
Back-patch to all releases, like 4518c798.
Discussion: https://postgr.es/m/CA%2BhUKGKNpK%3D2OMeea_AZwpLg7Bm4%3DgYWk7eDjZ5F6YbozfOf8w%40mail.gmail.com
---
src/backend/storage/ipc/dsm_impl.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c
index d13d6e8a41..873ed80e32 100644
--- a/src/backend/storage/ipc/dsm_impl.c
+++ b/src/backend/storage/ipc/dsm_impl.c
@@ -362,7 +362,8 @@ dsm_impl_posix_resize(int fd, off_t size)
* allowed SIGUSR1 to interrupt us repeatedly (for example, due to recovery
* conflicts), the retry loop might never succeed.
*/
- PG_SETMASK(&BlockSig);
+ if (IsUnderPostmaster)
+ PG_SETMASK(&BlockSig);
/* Truncate (or extend) the file to the requested size. */
do
@@ -402,9 +403,12 @@ dsm_impl_posix_resize(int fd, off_t size)
}
#endif /* HAVE_POSIX_FALLOCATE && __linux__ */
- save_errno = errno;
- PG_SETMASK(&UnBlockSig);
- errno = save_errno;
+ if (IsUnderPostmaster)
+ {
+ save_errno = errno;
+ PG_SETMASK(&UnBlockSig);
+ errno = save_errno;
+ }
return rc;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org