aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistbuild.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-09-25 16:09:19 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-09-25 16:09:19 -0400
commit4621c7f7a432fbb24b69c5cf0c877c17832c26ac (patch)
tree7194ddbb34c3dd1561fa76ef150318ee9e188da2 /src/backend/access/gist/gistbuild.c
parent99e90bac4f9f3bd8d7b285a6f4095c2089e09efe (diff)
downloadpostgresql-4621c7f7a432fbb24b69c5cf0c877c17832c26ac.tar.gz
postgresql-4621c7f7a432fbb24b69c5cf0c877c17832c26ac.zip
Avoid SIGBUS on Linux when a DSM memory request overruns tmpfs.
On Linux, shared memory segments created with shm_open() are backed by swap files created in tmpfs. If the swap file needs to be extended, but there's no tmpfs space left, you get a very unfriendly SIGBUS trap. To avoid this, force allocation of the full request size when we create the segment. This adds a few cycles, but none that we wouldn't expend later anyway, assuming the request isn't hugely bigger than the actual need. Make this code #ifdef __linux__, because (a) there's not currently a reason to think the same problem exists on other platforms, and (b) applying posix_fallocate() to an FD created by shm_open() isn't very portable anyway. Back-patch to 9.4 where the DSM code came in. Thomas Munro, per a bug report from Amul Sul Discussion: https://postgr.es/m/1002664500.12301802.1471008223422.JavaMail.yahoo@mail.yahoo.com
Diffstat (limited to 'src/backend/access/gist/gistbuild.c')
0 files changed, 0 insertions, 0 deletions