Don't clobber postmaster sigmask in dsm_impl_resize.
Commit 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
Discussion:
@@ -352,6 +352,7 @@ 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.
*/
+ if (IsUnderPostmaster)
PG_SETMASK(&BlockSig);
/* Truncate (or extend) the file to the requested size. */
@@ -390,9 +391,12 @@ dsm_impl_posix_resize(int fd, off_t size)
}
#endif /* HAVE_POSIX_FALLOCATE && __linux__ */
+ if (IsUnderPostmaster)
+ {
save_errno = errno;
PG_SETMASK(&UnBlockSig);
errno = save_errno;
+ }
return rc;
}
