mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-09 08:10:09 +08:00
Don't clobber postmaster sigmask in dsm_impl_resize.
Commit4518c798
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, like4518c798
. Discussion: https://postgr.es/m/CA%2BhUKGKNpK%3D2OMeea_AZwpLg7Bm4%3DgYWk7eDjZ5F6YbozfOf8w%40mail.gmail.com
This commit is contained in:
parent
7c0eb3c622
commit
80845b7c0b
@ -362,7 +362,8 @@ dsm_impl_posix_resize(int fd, off_t size)
|
|||||||
* allowed SIGUSR1 to interrupt us repeatedly (for example, due to recovery
|
* allowed SIGUSR1 to interrupt us repeatedly (for example, due to recovery
|
||||||
* conflicts), the retry loop might never succeed.
|
* conflicts), the retry loop might never succeed.
|
||||||
*/
|
*/
|
||||||
PG_SETMASK(&BlockSig);
|
if (IsUnderPostmaster)
|
||||||
|
PG_SETMASK(&BlockSig);
|
||||||
|
|
||||||
pgstat_report_wait_start(WAIT_EVENT_DSM_ALLOCATE);
|
pgstat_report_wait_start(WAIT_EVENT_DSM_ALLOCATE);
|
||||||
#if defined(HAVE_POSIX_FALLOCATE) && defined(__linux__)
|
#if defined(HAVE_POSIX_FALLOCATE) && defined(__linux__)
|
||||||
@ -398,9 +399,12 @@ dsm_impl_posix_resize(int fd, off_t size)
|
|||||||
#endif
|
#endif
|
||||||
pgstat_report_wait_end();
|
pgstat_report_wait_end();
|
||||||
|
|
||||||
save_errno = errno;
|
if (IsUnderPostmaster)
|
||||||
PG_SETMASK(&UnBlockSig);
|
{
|
||||||
errno = save_errno;
|
save_errno = errno;
|
||||||
|
PG_SETMASK(&UnBlockSig);
|
||||||
|
errno = save_errno;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user