8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 04:03:03 +01:00

Backported fix for bug CORE-3464 : Dirty page could be written without releasing (or downgrading) page lock. It results in "lock denied" or "lock conversion denied" bugcheck

This commit is contained in:
hvlad 2011-05-10 08:57:06 +00:00
parent 6944de1653
commit bcff8823bd

View File

@ -2964,6 +2964,11 @@ static void flushAll(thread_db* tdbb, USHORT flush_flag)
PAGE_LOCK_RELEASE(bdb->bdb_lock);
release_bdb(tdbb, bdb, false, false, false);
}
else // re-post the lock if it was written
if ((bdb->bdb_ast_flags & BDB_blocking) && !(bdb->bdb_flags & BDB_dirty))
{
PAGE_LOCK_RE_POST(bdb->bdb_lock);
}
flush.remove(ptr);
}
else
@ -5556,10 +5561,10 @@ static SSHORT lock_buffer(thread_db* tdbb, BufferDesc* bdb, const SSHORT wait, c
// BufferDesc's in an unfortunate order. Nothing we can do about it, return the
// error, and log it to firebird.log.
fb_msg_format(0, JRD_BUGCHK, 215, sizeof(errmsg), errmsg,
fb_msg_format(0, JRD_BUGCHK, 216, sizeof(errmsg), errmsg,
MsgFormat::SafeArg() << bdb->bdb_page.getPageNum() << (int) page_type);
ERR_append_status(status, Arg::Gds(isc_random) << Arg::Str(errmsg));
ERR_log(JRD_BUGCHK, 215, errmsg); // msg 215 page %ld, page type %ld lock conversion denied
ERR_log(JRD_BUGCHK, 216, errmsg); // msg 216 page %ld, page type %ld lock denied
// CCH_unwind releases all the BufferDesc's and calls ERR_punt()
// ERR_punt will longjump.
@ -5605,10 +5610,10 @@ static SSHORT lock_buffer(thread_db* tdbb, BufferDesc* bdb, const SSHORT wait, c
// BufferDesc's in an unfortunate order. Nothing we can do about it, return the
// error, and log it to firebird.log.
fb_msg_format(0, JRD_BUGCHK, 216, sizeof(errmsg), errmsg,
fb_msg_format(0, JRD_BUGCHK, 215, sizeof(errmsg), errmsg,
MsgFormat::SafeArg() << bdb->bdb_page.getPageNum() << (int) page_type);
ERR_append_status(status, Arg::Gds(isc_random) << Arg::Str(errmsg));
ERR_log(JRD_BUGCHK, 216, errmsg); // msg 216 page %ld, page type %ld lock denied
ERR_log(JRD_BUGCHK, 215, errmsg); // msg 215 page %ld, page type %ld lock conversion denied
CCH_unwind(tdbb, true);
return 0; // Added to get rid of Compiler Warning