8000 Don't clobber postmaster sigmask in dsm_impl_resize. · postgres/postgres@74a9ee0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74a9ee0

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 39683c6 commit 74a9ee0

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
@@ -417,7 +417,8 @@ dsm_impl_posix_resize(int fd, off_t size)
417417
* allowed SIGUSR1 to interrupt us repeatedly (for example, due to recovery
418418
* conflicts), the retry loop might never succeed.
419419
*/
420-
PG_SETMASK(&BlockSig);
420+
if (IsUnderPostmaster)
421+
PG_SETMASK(&BlockSig);
421422

422423
/* Truncate (or extend) the file to the requested size. */
423424
do
@@ -455,9 +456,12 @@ dsm_impl_posix_resize(int fd, off_t size)
455456
}
456457
#endif /* HAVE_POSIX_FALLOCATE && __linux__ */
457458

458-
save_errno = errno;
459-
PG_SETMASK(&UnBlockSig);
460-
errno = save_errno;
459+
if (IsUnderPostmaster)
460+
{
461+
save_errno = errno;
462+
PG_SETMASK(&UnBlockSig);
463+
errno = save_errno;
464+
}
461465

462466
return rc;
463467
}

0 commit comments

Comments
 (0)
0