summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2018-08-21 16:36:05 +1000
committerLuke Chen <luke.chen@mongodb.com>2018-08-21 16:36:05 +1000
commit3f3785e865aaa1140c625e4becef34ed0160e5da (patch)
tree04fe1591eb60d9dbd3af837ab4683f68bd360ae9
parent581a10bcfc9b755a099a59f8489a5b0e6d5a1746 (diff)
downloadmongo-3f3785e865aaa1140c625e4becef34ed0160e5da.tar.gz
Import wiredtiger: 7a6598ca9b54c358803aa6290dce618f0abed63f from branch mongodb-3.4
ref: 65d96ccb97..7a6598ca9b for: 3.4.17 WT-3637 Fix a heap use after free from evicting of a page that just split.
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_write.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index d7df48cee9a..9db71335d7b 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -1,5 +1,5 @@
{
- "commit": "65d96ccb972b239c8af5aa24a03d215eb143b0e4",
+ "commit": "7a6598ca9b54c358803aa6290dce618f0abed63f",
"github": "wiredtiger/wiredtiger.git",
"vendor": "wiredtiger",
"branch": "mongodb-3.4"
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_write.c b/src/third_party/wiredtiger/src/reconcile/rec_write.c
index 688efa10398..b76192c0cf9 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_write.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_write.c
@@ -391,6 +391,18 @@ __wt_reconcile(WT_SESSION_IMPL *session, WT_REF *ref,
*/
WT_PAGE_LOCK(session, page);
+ /*
+ * Now that the page is locked, if attempting to evict it, check again
+ * whether eviction is permitted. The page's state could have changed
+ * while we were waiting to acquire the lock (e.g., the page could have
+ * split).
+ */
+ if (LF_ISSET(WT_EVICTING) &&
+ !__wt_page_can_evict(session, ref, NULL)) {
+ WT_PAGE_UNLOCK(session, page);
+ return (EBUSY);
+ }
+
oldest_id = __wt_txn_oldest_id(session);
if (LF_ISSET(WT_EVICTING))
mod->last_eviction_id = oldest_id;