diff options
author | Matthew Ahrens <[email protected]> | 2017-04-24 09:34:36 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-05-10 13:52:22 -0400 |
commit | 4747a7d3d48ee307176dbd4a70c3be42b9f10dc0 (patch) | |
tree | 0f04fa2bebc46f7c19a544e8c1bafab0297148ef /include | |
parent | 335b251ac1a1f8ba8434450dc0f24986bc44f688 (diff) |
OpenZFS 8063 - verify that we do not attempt to access inactive txg
Authored by: Matthew Ahrens <[email protected]>
Reviewed by: Serapheim Dimitropoulos <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Ported-by: George Melikov <[email protected]>
A standard practice in ZFS is to keep track of "per-txg" state. Any of
the 3 active TXG's (open, quiescing, syncing) can have different values
for this state. We should assert that we do not attempt to modify other
(inactive) TXG's.
Porting Notes:
- ASSERTV added to txg_sync_waiting() for unused variable.
OpenZFS-issue: https://www.illumos.org/issues/8063
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/01acb46
Closes #6109
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/txg.h | 7 | ||||
-rw-r--r-- | include/sys/zil.h | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/include/sys/txg.h b/include/sys/txg.h index 44f81beca..f52197781 100644 --- a/include/sys/txg.h +++ b/include/sys/txg.h @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. */ #ifndef _SYS_TXG_H @@ -60,6 +60,7 @@ typedef struct txg_node { typedef struct txg_list { kmutex_t tl_lock; size_t tl_offset; + spa_t *tl_spa; txg_node_t *tl_head[TXG_SIZE]; } txg_list_t; @@ -103,6 +104,8 @@ extern boolean_t txg_stalled(struct dsl_pool *dp); /* returns TRUE if someone is waiting for the next txg to sync */ extern boolean_t txg_sync_waiting(struct dsl_pool *dp); +extern void txg_verify(spa_t *spa, uint64_t txg); + /* * Wait for pending commit callbacks of already-synced transactions to finish * processing. @@ -115,7 +118,7 @@ extern void txg_wait_callbacks(struct dsl_pool *dp); #define TXG_CLEAN(txg) ((txg) - 1) -extern void txg_list_create(txg_list_t *tl, size_t offset); +extern void txg_list_create(txg_list_t *tl, spa_t *spa, size_t offset); extern void txg_list_destroy(txg_list_t *tl); extern boolean_t txg_list_empty(txg_list_t *tl, uint64_t txg); extern boolean_t txg_all_lists_empty(txg_list_t *tl); diff --git a/include/sys/zil.h b/include/sys/zil.h index ed0810aa1..62572f894 100644 --- a/include/sys/zil.h +++ b/include/sys/zil.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -95,6 +95,15 @@ typedef struct zil_chain { #define ZIL_MIN_BLKSZ 4096ULL /* + * ziltest is by and large an ugly hack, but very useful in + * checking replay without tedious work. + * When running ziltest we want to keep all itx's and so maintain + * a single list in the zl_itxg[] that uses a high txg: ZILTEST_TXG + * We subtract TXG_CONCURRENT_STATES to allow for common code. + */ +#define ZILTEST_TXG (UINT64_MAX - TXG_CONCURRENT_STATES) + +/* * The words of a log block checksum. */ #define ZIL_ZC_GUID_0 0 |