Skip to content

Commit a715c20

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 c4a617e commit a715c20

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
/* Truncate (or extend) the file to the requested size. */
368369
do
@@ -402,9 +403,12 @@ dsm_impl_posix_resize(int fd, off_t size)
402403
}
403404
#endif /* HAVE_POSIX_FALLOCATE && __linux__ */
404405

405-
save_errno = errno;
406-
PG_SETMASK(&UnBlockSig);
407-
errno = save_errno;
406+
if (IsUnderPostmaster)
407+
{
408+
save_errno = errno;
409+
PG_SETMASK(&UnBlockSig);
410+
errno = save_errno;
411+
}
408412

409413
return rc;
410414
}

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