Skip to content

Commit

Permalink
Backported fix for bug CORE-3464 : Dirty page could be written withou…
Browse files Browse the repository at this point in the history
…t releasing (or downgrading) page lock. It results in "lock denied" or "lock conversion denied" bugcheck
  • Loading branch information
hvlad committed May 10, 2011
1 parent 6944de1 commit bcff882
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/jrd/cch.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bcff882

Please sign in to comment.