Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 17aa39d

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 e73fe6e commit 17aa39d

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
@@ -359,7 +359,8 @@ dsm_impl_posix_resize(int fd, off_t size)
359359
* allowed SIGUSR1 to interrupt us repeatedly (for example, due to recovery
360360
* conflicts), the retry loop might never succeed.
361361
*/
362-
PG_SETMASK(&BlockSig);
362+
if (IsUnderPostmaster)
363+
PG_SETMASK(&BlockSig);
363364

364365
/* Truncate (or extend) the file to the requested size. */
365366
do
@@ -399,9 +400,12 @@ dsm_impl_posix_resize(int fd, off_t size)
399400
}
400401
#endif /* HAVE_POSIX_FALLOCATE && __linux__ */
401402

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

406410
return rc;
407411
}

0 commit comments

Comments
 (0)