diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-06-27 15:05:12 +1000 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-06-27 15:05:12 +1000 |
commit | e11e3c1b9c9ce3f7b4a79493e16f5e4504e01140 (patch) | |
tree | cc4ed0e6e7f0776892b127b2ca938e5f85105659 | |
parent | e5bc4afbe4529e54dc658bf724e51a8e94dde1b3 (diff) | |
download | mongo-e11e3c1b9c9ce3f7b4a79493e16f5e4504e01140.tar.gz |
Import wiredtiger: b8f590dea0400666ef26e21adf11c5997bb5ef1b from branch mongodb-3.2r3.2.15-rc0r3.2.15
ref: 534677a2ea..b8f590dea0
for: 3.2.15
WT-3373 Access violation due to a bug in internal page splitting
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_split.c | 32 |
2 files changed, 30 insertions, 4 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index d797dadef6e..abf3fe5cb9c 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "534677a2eab033bf817588704417bb25f0d19551", + "commit": "b8f590dea0400666ef26e21adf11c5997bb5ef1b", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-3.2" diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c index 627e6b9cb48..92be2125b88 100644 --- a/src/third_party/wiredtiger/src/btree/bt_split.c +++ b/src/third_party/wiredtiger/src/btree/bt_split.c @@ -1256,12 +1256,12 @@ err: switch (complete) { } /* - * __split_internal_lock -- + * __split_internal_lock_worker -- * Lock an internal page. */ static int -__split_internal_lock(WT_SESSION_IMPL *session, WT_REF *ref, bool trylock, - WT_PAGE **parentp, bool *hazardp) +__split_internal_lock_worker(WT_SESSION_IMPL *session, + WT_REF *ref, bool trylock, WT_PAGE **parentp, bool *hazardp) { WT_DECL_RET; WT_PAGE *parent; @@ -1340,6 +1340,32 @@ err: WT_PAGE_UNLOCK(session, parent); } /* + * __split_internal_lock -- + * Lock an internal page. + */ +static int +__split_internal_lock(WT_SESSION_IMPL *session, + WT_REF *ref, bool trylock, WT_PAGE **parentp, bool *hazardp) +{ + WT_DECL_RET; + + /* + * There's no lock on our parent page and we're about to acquire one, + * which implies using the WT_REF.home field to reference our parent + * page. As a child of the parent page, we prevent its eviction, but + * that's a weak guarantee. If the parent page splits, and our WT_REF + * were to move with the split, the WT_REF.home field might change + * underneath us and we could race, and end up attempting to access + * an evicted page. Set the session page-index generation so if the + * parent splits, it still can't be evicted. + */ + WT_WITH_PAGE_INDEX(session, + ret = __split_internal_lock_worker( + session, ref, trylock, parentp, hazardp)); + return (ret); +} + +/* * __split_internal_unlock -- * Unlock the parent page. */ |