- Notifications
You must be signed in to change notification settings - Fork28
Commit4621c7f
committed
Avoid SIGBUS on Linux when a DSM memory request overruns tmpfs.
On Linux, shared memory segments created with shm_open() are backed byswap 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 createthe segment. This adds a few cycles, but none that we wouldn't expendlater anyway, assuming the request isn't hugely bigger than the actualneed.Make this code #ifdef __linux__, because (a) there's not currently areason to think the same problem exists on other platforms, and (b)applying posix_fallocate() to an FD created by shm_open() isn't veryportable anyway.Back-patch to 9.4 where the DSM code came in.Thomas Munro, per a bug report from Amul SulDiscussion:https://postgr.es/m/1002664500.12301802.1471008223422.JavaMail.yahoo@mail.yahoo.com1 parent99e90ba commit4621c7f
File tree
5 files changed
+60
-4
lines changed- src
- backend/storage/ipc
- include
5 files changed
+60
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13024 | 13024 | | |
13025 | 13025 | | |
13026 | 13026 | | |
13027 | | - | |
| 13027 | + | |
13028 | 13028 | | |
13029 | 13029 | | |
13030 | 13030 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1430 | 1430 | | |
1431 | 1431 | | |
1432 | 1432 | | |
1433 | | - | |
| 1433 | + | |
1434 | 1434 | | |
1435 | 1435 | | |
1436 | 1436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
322 | | - | |
| 323 | + | |
| 324 | + | |
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
| |||
392 | 394 | | |
393 | 395 | | |
394 | 396 | | |
395 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
396 | 446 | | |
397 | 447 | | |
398 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
396 | 399 | | |
397 | 400 | | |
398 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| |||
0 commit comments
Comments
(0)