postgresql/src/backend/utils
Tom Lane cf73547075 Avoid potential deadlock in InitCatCachePhase2().
Opening a catcache's index could require reading from that cache's own
catalog, which of course would acquire AccessShareLock on the catalog.
So the original coding here risks locking index before heap, which could
deadlock against another backend trying to get exclusive locks in the
normal order.  Because InitCatCachePhase2 is only called when a backend
has to start up without a relcache init file, the deadlock was seldom seen
in the field.  (And by the same token, there's no need to worry about any
performance disadvantage; so not much point in trying to distinguish
exactly which catalogs have the risk.)

Bug report, diagnosis, and patch by Nikhil Sontakke.  Additional commentary
by me.  Back-patch to all supported branches.
2011-03-22 13:01:17 -04:00
..
adt On further reflection, we'd better do the same in int.c. 2011-03-11 19:04:14 -05:00
cache Avoid potential deadlock in InitCatCachePhase2(). 2011-03-22 13:01:17 -04:00
error Work around a subtle portability problem in use of printf %s format. 2010-05-08 16:40:14 +00:00
fmgr Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:17 +00:00
hash Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
init Arrange to fsync the contents of lockfiles (both postmaster.pid and the 2010-08-16 17:33:07 +00:00
mb Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:12 +02:00
misc Force default wal_sync_method to be fdatasync on Linux. 2010-12-08 20:01:24 -05:00
mmgr Oops, in the previous fix to prevent a cursor that's being used in a FOR 2010-07-13 09:02:46 +00:00
resowner Fix bug in temporary file management with subtransactions. A cursor opened 2009-12-03 11:03:44 +00:00
sort Previous fix for temporary file management broke returning a set from 2009-12-29 17:41:18 +00:00
time Initialize the minimum frozen Xid in vac_update_datfrozenxid using 2008-09-11 14:01:35 +00:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:12 +02:00
Gen_fmgrtab.sh Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
Makefile Replace useless uses of := by = in makefiles. 2007-02-09 15:56:00 +00:00
probes.d Correct two more copyrights found by updated script. 2008-01-02 02:42:06 +00:00