Skip to content

Commit 80845b7

Browse files
committed
Don't clobber postmaster sigmask in dsm_impl_resize.
Commit 4518c79 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 4518c79. Discussion: https://postgr.es/m/CA%2BhUKGKNpK%3D2OMeea_AZwpLg7Bm4%3DgYWk7eDjZ5F6YbozfOf8w%40mail.gmail.com
1 parent 7c0eb3c commit 80845b7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/backend/storage/ipc/dsm_impl.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ dsm_impl_posix_resize(int fd, off_t size)
362362
* allowed SIGUSR1 to interrupt us repeatedly (for example, due to recovery
363363
* conflicts), the retry loop might never succeed.
364364
*/
365-
PG_SETMASK(&BlockSig);
365+
if (IsUnderPostmaster)
366+
PG_SETMASK(&BlockSig);
366367

367368
pgstat_report_wait_start(WAIT_EVENT_DSM_ALLOCATE);
368369
#if defined(HAVE_POSIX_FALLOCATE) && defined(__linux__)
@@ -398,9 +399,12 @@ dsm_impl_posix_resize(int fd, off_t size)
398399
#endif
399400
pgstat_report_wait_end();
400401

401-
save_errno = errno;
402-
PG_SETMASK(&UnBlockSig);
403-
errno = save_errno;
402+
if (IsUnderPostmaster)
403+
{
404+
save_errno = errno;
405+
PG_SETMASK(&UnBlockSig);
406+
errno = save_errno;
407+
}
404408

405409
return rc;
406410
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy