Commit 39d248fa authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-16092 Crash in encryption.create_or_replace

If the tablespace is dropped or truncated after the
space->is_stopping() check in fil_crypt_get_page_throttle_func(),
we would proceed to request the page, and eventually report a fatal
error.

buf_page_get_gen(): Do not retry reading if mode==BUF_GET_POSSIBLY_FREED.

lock_rec_block_validate(): Be prepared for a NULL return value when
invoking buf_page_get_gen() with mode=BUF_GET_POSSIBLY_FREED.
parent 74abc32d
......@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -3189,6 +3189,11 @@ buf_page_get_gen(
ibuf_inside(mtr));
retries = 0;
} else if (mode == BUF_GET_POSSIBLY_FREED) {
if (err) {
*err = local_err;
}
return NULL;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
......
......@@ -6895,10 +6895,10 @@ lock_rec_block_validate(
page_no, RW_X_LATCH, NULL,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr);
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
ut_ad(lock_rec_validate_page(block));
if (block) {
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
ut_ad(lock_rec_validate_page(block));
}
mtr_commit(&mtr);
fil_space_release(space);
......
......@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -3088,6 +3088,11 @@ buf_page_get_gen(
ibuf_inside(mtr), trx);
retries = 0;
} else if (mode == BUF_GET_POSSIBLY_FREED) {
if (err) {
*err = local_err;
}
return NULL;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
......
......@@ -6955,10 +6955,10 @@ lock_rec_block_validate(
page_no, RW_X_LATCH, NULL,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr);
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
ut_ad(lock_rec_validate_page(block));
if (block) {
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
ut_ad(lock_rec_validate_page(block));
}
mtr_commit(&mtr);
fil_space_release(space);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment