Improve zpool status output, list all affected datasets
Currently, determining which datasets are affected by corruption is a manual process. The primary difficulty in reporting the list of affected snapshots is that since the error was initially found, the snapshot where the error originally occurred in, may have been deleted. To solve this issue, we add the ID of the head dataset of the original snapshot which the error was detected in, to the stored error report. Then any time a filesystem is deleted, the errors associated with it are deleted as well. Any time a clone promote occurs, we modify reports associated with the original head to refer to the new head. The stored error reports are identified by this head ID, the birth time of the block which the error occurred in, as well as some information about the error itself are also stored. Once this information is stored, we can find the set of datasets affected by an error by walking back the list of snapshots in the given head until we find one with the appropriate birth txg, and then traverse through the snapshots of the clone family, terminating a branch if the block was replaced in a given snapshot. Then we report this information back to libzfs, and to the zpool status command, where it is displayed as follows: pool: test state: ONLINE status: One or more devices has experienced an error resulting in data corruption. Applications may be affected. action: Restore the file in question if possible. Otherwise restore the entire pool from backup. see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A scan: scrub repaired 0B in 00:00:00 with 800 errors on Fri Dec 3 08:27:57 2021 config: NAME STATE READ WRITE CKSUM test ONLINE 0 0 0 sdb ONLINE 0 0 1.58K errors: Permanent errors have been detected in the following files: test@1:/test.0.0 /test/test.0.0 /test/1clone/test.0.0 A new feature flag is introduced to mark the presence of this change, as well as promotion and backwards compatibility logic. This is an updated version of #9175. Rebase required fixing the tests, updating the ABI of libzfs, updating the man pages, fixing bugs, fixing the error returns, and updating the old on-disk error logs to the new format when activating the feature. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Mark Maybee <mark.maybee@delphix.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Co-authored-by: TulsiJain <tulsi.jain@delphix.com> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #9175 Closes #12812
This commit is contained in:
parent
95146fd7ba
commit
0409d33273
|
@ -487,6 +487,9 @@ boolean_t dsl_dataset_get_uint64_array_feature(dsl_dataset_t *ds,
|
|||
void dsl_dataset_activate_redaction(dsl_dataset_t *ds, uint64_t *redact_snaps,
|
||||
uint64_t num_redact_snaps, dmu_tx_t *tx);
|
||||
|
||||
int dsl_dataset_oldest_snapshot(spa_t *spa, uint64_t head_ds, uint64_t min_txg,
|
||||
uint64_t *oldest_dsobj);
|
||||
|
||||
#ifdef ZFS_DEBUG
|
||||
#define dprintf_ds(ds, fmt, ...) do { \
|
||||
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
|
||||
|
|
|
@ -1144,11 +1144,17 @@ extern void zfs_post_remove(spa_t *spa, vdev_t *vd);
|
|||
extern void zfs_post_state_change(spa_t *spa, vdev_t *vd, uint64_t laststate);
|
||||
extern void zfs_post_autoreplace(spa_t *spa, vdev_t *vd);
|
||||
extern uint64_t spa_get_errlog_size(spa_t *spa);
|
||||
extern int spa_get_errlog(spa_t *spa, void *uaddr, size_t *count);
|
||||
extern int spa_get_errlog(spa_t *spa, void *uaddr, uint64_t *count);
|
||||
extern void spa_errlog_rotate(spa_t *spa);
|
||||
extern void spa_errlog_drain(spa_t *spa);
|
||||
extern void spa_errlog_sync(spa_t *spa, uint64_t txg);
|
||||
extern void spa_get_errlists(spa_t *spa, avl_tree_t *last, avl_tree_t *scrub);
|
||||
extern void spa_delete_dataset_errlog(spa_t *spa, uint64_t ds, dmu_tx_t *tx);
|
||||
extern void spa_swap_errlog(spa_t *spa, uint64_t new_head_ds,
|
||||
uint64_t old_head_ds, dmu_tx_t *tx);
|
||||
extern void sync_error_list(spa_t *spa, avl_tree_t *t, uint64_t *obj,
|
||||
dmu_tx_t *tx);
|
||||
extern void spa_upgrade_errlog(spa_t *spa, dmu_tx_t *tx);
|
||||
|
||||
/* vdev cache */
|
||||
extern void vdev_cache_stat_init(void);
|
||||
|
|
|
@ -283,6 +283,13 @@ extern const char *const zio_type_name[ZIO_TYPES];
|
|||
* Note: this structure is passed between userland and the kernel, and is
|
||||
* stored on disk (by virtue of being incorporated into other on-disk
|
||||
* structures, e.g. dsl_scan_phys_t).
|
||||
*
|
||||
* If the head_errlog feature is enabled a different on-disk format for error
|
||||
* logs is used. This introduces the use of an error bookmark, a four-tuple
|
||||
* <object, level, blkid, birth> that uniquely identifies any error block
|
||||
* in the pool. The birth transaction group is used to track whether the block
|
||||
* has been overwritten by newer data or added to a snapshot since its marking
|
||||
* as an error.
|
||||
*/
|
||||
struct zbookmark_phys {
|
||||
uint64_t zb_objset;
|
||||
|
@ -291,6 +298,13 @@ struct zbookmark_phys {
|
|||
uint64_t zb_blkid;
|
||||
};
|
||||
|
||||
typedef struct zbookmark_err_phys {
|
||||
uint64_t zb_object;
|
||||
int64_t zb_level;
|
||||
uint64_t zb_blkid;
|
||||
uint64_t zb_birth;
|
||||
} zbookmark_err_phys_t;
|
||||
|
||||
#define SET_BOOKMARK(zb, objset, object, level, blkid) \
|
||||
{ \
|
||||
(zb)->zb_objset = objset; \
|
||||
|
|
|
@ -76,6 +76,7 @@ typedef enum spa_feature {
|
|||
SPA_FEATURE_ZSTD_COMPRESS,
|
||||
SPA_FEATURE_DRAID,
|
||||
SPA_FEATURE_ZILSAXATTR,
|
||||
SPA_FEATURE_HEAD_ERRLOG,
|
||||
SPA_FEATURES
|
||||
} spa_feature_t;
|
||||
|
||||
|
|
|
@ -2794,7 +2794,7 @@
|
|||
</abi-instr>
|
||||
<abi-instr address-size='64' path='assert.c' language='LANG_C99'>
|
||||
<function-decl name='libspl_set_assert_ok' mangled-name='libspl_set_assert_ok' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='libspl_set_assert_ok'>
|
||||
<parameter type-id='f58c8277' name='val'/>
|
||||
<parameter type-id='c19b74c3' name='val'/>
|
||||
<return type-id='48b5725f'/>
|
||||
</function-decl>
|
||||
<function-decl name='libspl_assertf' mangled-name='libspl_assertf' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='libspl_assertf'>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
<dependency name='ld-linux-x86-64.so.2'/>
|
||||
</elf-needed>
|
||||
<elf-function-symbols>
|
||||
<elf-symbol name='_fini' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='_init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='_sol_getmntent' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='atomic_add_16' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='atomic_add_16_nv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
|
@ -366,7 +364,7 @@
|
|||
</abi-instr>
|
||||
<abi-instr address-size='64' path='assert.c' language='LANG_C99'>
|
||||
<function-decl name='libspl_set_assert_ok' mangled-name='libspl_set_assert_ok' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='libspl_set_assert_ok'>
|
||||
<parameter type-id='f58c8277' name='val'/>
|
||||
<parameter type-id='c19b74c3' name='val'/>
|
||||
<return type-id='48b5725f'/>
|
||||
</function-decl>
|
||||
<function-decl name='libspl_assertf' mangled-name='libspl_assertf' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='libspl_assertf'>
|
||||
|
@ -430,6 +428,11 @@
|
|||
<parameter type-id='64698d33' name='target'/>
|
||||
<return type-id='48b5725f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_add_ptr' mangled-name='atomic_add_ptr' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_add_ptr'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='79a0948f' name='bits'/>
|
||||
<return type-id='48b5725f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_add_8' mangled-name='atomic_add_8' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_add_8'>
|
||||
<parameter type-id='aa323ea4' name='target'/>
|
||||
<parameter type-id='ee31ee44' name='bits'/>
|
||||
|
@ -450,7 +453,7 @@
|
|||
<parameter type-id='bd54fe1a' name='bits'/>
|
||||
<return type-id='48b5725f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_add_ptr' mangled-name='atomic_add_ptr' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_add_ptr'>
|
||||
<function-decl name='atomic_sub_ptr' mangled-name='atomic_sub_ptr' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_sub_ptr'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='79a0948f' name='bits'/>
|
||||
<return type-id='48b5725f'/>
|
||||
|
@ -475,11 +478,6 @@
|
|||
<parameter type-id='bd54fe1a' name='bits'/>
|
||||
<return type-id='48b5725f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_sub_ptr' mangled-name='atomic_sub_ptr' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_sub_ptr'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='79a0948f' name='bits'/>
|
||||
<return type-id='48b5725f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_or_8' mangled-name='atomic_or_8' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_or_8'>
|
||||
<parameter type-id='aa323ea4' name='target'/>
|
||||
<parameter type-id='b96825af' name='bits'/>
|
||||
|
@ -552,6 +550,11 @@
|
|||
<parameter type-id='64698d33' name='target'/>
|
||||
<return type-id='ee1f298e'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_add_ptr_nv' mangled-name='atomic_add_ptr_nv' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_add_ptr_nv'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='79a0948f' name='bits'/>
|
||||
<return type-id='eaa32e2f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_add_8_nv' mangled-name='atomic_add_8_nv' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_add_8_nv'>
|
||||
<parameter type-id='aa323ea4' name='target'/>
|
||||
<parameter type-id='ee31ee44' name='bits'/>
|
||||
|
@ -572,7 +575,7 @@
|
|||
<parameter type-id='bd54fe1a' name='bits'/>
|
||||
<return type-id='ee1f298e'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_add_ptr_nv' mangled-name='atomic_add_ptr_nv' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_add_ptr_nv'>
|
||||
<function-decl name='atomic_sub_ptr_nv' mangled-name='atomic_sub_ptr_nv' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_sub_ptr_nv'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='79a0948f' name='bits'/>
|
||||
<return type-id='eaa32e2f'/>
|
||||
|
@ -597,11 +600,6 @@
|
|||
<parameter type-id='bd54fe1a' name='bits'/>
|
||||
<return type-id='ee1f298e'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_sub_ptr_nv' mangled-name='atomic_sub_ptr_nv' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_sub_ptr_nv'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='79a0948f' name='bits'/>
|
||||
<return type-id='eaa32e2f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_or_8_nv' mangled-name='atomic_or_8_nv' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_or_8_nv'>
|
||||
<parameter type-id='aa323ea4' name='target'/>
|
||||
<parameter type-id='b96825af' name='bits'/>
|
||||
|
@ -642,6 +640,12 @@
|
|||
<parameter type-id='ee1f298e' name='bits'/>
|
||||
<return type-id='ee1f298e'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_cas_ptr' mangled-name='atomic_cas_ptr' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_cas_ptr'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='eaa32e2f' name='exp'/>
|
||||
<parameter type-id='eaa32e2f' name='des'/>
|
||||
<return type-id='eaa32e2f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_cas_8' mangled-name='atomic_cas_8' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_cas_8'>
|
||||
<parameter type-id='aa323ea4' name='target'/>
|
||||
<parameter type-id='b96825af' name='exp'/>
|
||||
|
@ -666,12 +670,6 @@
|
|||
<parameter type-id='ee1f298e' name='des'/>
|
||||
<return type-id='ee1f298e'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_cas_ptr' mangled-name='atomic_cas_ptr' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_cas_ptr'>
|
||||
<parameter type-id='fe09dd29' name='target'/>
|
||||
<parameter type-id='eaa32e2f' name='exp'/>
|
||||
<parameter type-id='eaa32e2f' name='des'/>
|
||||
<return type-id='eaa32e2f'/>
|
||||
</function-decl>
|
||||
<function-decl name='atomic_swap_8' mangled-name='atomic_swap_8' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='atomic_swap_8'>
|
||||
<parameter type-id='aa323ea4' name='target'/>
|
||||
<parameter type-id='b96825af' name='bits'/>
|
||||
|
@ -858,6 +856,9 @@
|
|||
<array-type-def dimensions='1' type-id='a84c031d' size-in-bits='160' id='664ac0b7'>
|
||||
<subrange length='20' type-id='7359adad' id='fdca39cf'/>
|
||||
</array-type-def>
|
||||
<class-decl name='_IO_codecvt' is-struct='yes' visibility='default' is-declaration-only='yes' id='a4036571'/>
|
||||
<class-decl name='_IO_marker' is-struct='yes' visibility='default' is-declaration-only='yes' id='010ae0b9'/>
|
||||
<class-decl name='_IO_wide_data' is-struct='yes' visibility='default' is-declaration-only='yes' id='79bd3751'/>
|
||||
<class-decl name='mnttab' size-in-bits='256' is-struct='yes' visibility='default' id='1b055409'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='mnt_special' type-id='26a90f95' visibility='default'/>
|
||||
|
@ -892,18 +893,66 @@
|
|||
<var-decl name='mnt_minor' type-id='3502e3ff' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<typedef-decl name='_IO_lock_t' type-id='48b5725f' id='bb4788fa'/>
|
||||
<class-decl name='_IO_marker' size-in-bits='192' is-struct='yes' visibility='default' id='010ae0b9'>
|
||||
<class-decl name='stat64' size-in-bits='1152' is-struct='yes' visibility='default' id='0bbec9cd'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='_next' type-id='e4c6fa61' visibility='default'/>
|
||||
<var-decl name='st_dev' type-id='35ed8932' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='_sbuf' type-id='dca988a5' visibility='default'/>
|
||||
<var-decl name='st_ino' type-id='71288a47' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='128'>
|
||||
<var-decl name='_pos' type-id='95e97e5e' visibility='default'/>
|
||||
<var-decl name='st_nlink' type-id='80f0b9df' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='192'>
|
||||
<var-decl name='st_mode' type-id='e1c52942' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='224'>
|
||||
<var-decl name='st_uid' type-id='cc5fcceb' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='256'>
|
||||
<var-decl name='st_gid' type-id='d94ec6d9' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='288'>
|
||||
<var-decl name='__pad0' type-id='95e97e5e' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='320'>
|
||||
<var-decl name='st_rdev' type-id='35ed8932' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='384'>
|
||||
<var-decl name='st_size' type-id='79989e9c' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='448'>
|
||||
<var-decl name='st_blksize' type-id='d3f10a7f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='512'>
|
||||
<var-decl name='st_blocks' type-id='4e711bf1' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='576'>
|
||||
<var-decl name='st_atim' type-id='a9c79a1f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='704'>
|
||||
<var-decl name='st_mtim' type-id='a9c79a1f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='832'>
|
||||
<var-decl name='st_ctim' type-id='a9c79a1f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='960'>
|
||||
<var-decl name='__glibc_reserved' type-id='083f8d58' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<typedef-decl name='__dev_t' type-id='7359adad' id='35ed8932'/>
|
||||
<typedef-decl name='__uid_t' type-id='f0981eeb' id='cc5fcceb'/>
|
||||
<typedef-decl name='__gid_t' type-id='f0981eeb' id='d94ec6d9'/>
|
||||
<typedef-decl name='__ino64_t' type-id='7359adad' id='71288a47'/>
|
||||
<typedef-decl name='__nlink_t' type-id='7359adad' id='80f0b9df'/>
|
||||
<typedef-decl name='__off_t' type-id='bd54fe1a' id='79989e9c'/>
|
||||
<typedef-decl name='__off64_t' type-id='bd54fe1a' id='724e4de6'/>
|
||||
<typedef-decl name='__time_t' type-id='bd54fe1a' id='65eda9c0'/>
|
||||
<typedef-decl name='__blksize_t' type-id='bd54fe1a' id='d3f10a7f'/>
|
||||
<typedef-decl name='__blkcnt64_t' type-id='bd54fe1a' id='4e711bf1'/>
|
||||
<typedef-decl name='__syscall_slong_t' type-id='bd54fe1a' id='03085adc'/>
|
||||
<typedef-decl name='FILE' type-id='ec1ed955' id='aa12d1ba'/>
|
||||
<typedef-decl name='_IO_lock_t' type-id='48b5725f' id='bb4788fa'/>
|
||||
<class-decl name='_IO_FILE' size-in-bits='1728' is-struct='yes' visibility='default' id='ec1ed955'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='_flags' type-id='95e97e5e' visibility='default'/>
|
||||
|
@ -972,16 +1021,16 @@
|
|||
<var-decl name='_offset' type-id='724e4de6' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1216'>
|
||||
<var-decl name='__pad1' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_codecvt' type-id='570f8c59' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1280'>
|
||||
<var-decl name='__pad2' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_wide_data' type-id='c65a1f29' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1344'>
|
||||
<var-decl name='__pad3' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_freeres_list' type-id='dca988a5' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1408'>
|
||||
<var-decl name='__pad4' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_freeres_buf' type-id='eaa32e2f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1472'>
|
||||
<var-decl name='__pad5' type-id='b59d7dce' visibility='default'/>
|
||||
|
@ -993,65 +1042,6 @@
|
|||
<var-decl name='_unused2' type-id='664ac0b7' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<class-decl name='stat64' size-in-bits='1152' is-struct='yes' visibility='default' id='0bbec9cd'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='st_dev' type-id='35ed8932' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='st_ino' type-id='71288a47' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='128'>
|
||||
<var-decl name='st_nlink' type-id='80f0b9df' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='192'>
|
||||
<var-decl name='st_mode' type-id='e1c52942' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='224'>
|
||||
<var-decl name='st_uid' type-id='cc5fcceb' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='256'>
|
||||
<var-decl name='st_gid' type-id='d94ec6d9' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='288'>
|
||||
<var-decl name='__pad0' type-id='95e97e5e' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='320'>
|
||||
<var-decl name='st_rdev' type-id='35ed8932' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='384'>
|
||||
<var-decl name='st_size' type-id='79989e9c' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='448'>
|
||||
<var-decl name='st_blksize' type-id='d3f10a7f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='512'>
|
||||
<var-decl name='st_blocks' type-id='4e711bf1' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='576'>
|
||||
<var-decl name='st_atim' type-id='a9c79a1f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='704'>
|
||||
<var-decl name='st_mtim' type-id='a9c79a1f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='832'>
|
||||
<var-decl name='st_ctim' type-id='a9c79a1f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='960'>
|
||||
<var-decl name='__glibc_reserved' type-id='083f8d58' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<typedef-decl name='__dev_t' type-id='7359adad' id='35ed8932'/>
|
||||
<typedef-decl name='__uid_t' type-id='f0981eeb' id='cc5fcceb'/>
|
||||
<typedef-decl name='__gid_t' type-id='f0981eeb' id='d94ec6d9'/>
|
||||
<typedef-decl name='__ino64_t' type-id='7359adad' id='71288a47'/>
|
||||
<typedef-decl name='__nlink_t' type-id='7359adad' id='80f0b9df'/>
|
||||
<typedef-decl name='__off_t' type-id='bd54fe1a' id='79989e9c'/>
|
||||
<typedef-decl name='__off64_t' type-id='bd54fe1a' id='724e4de6'/>
|
||||
<typedef-decl name='__time_t' type-id='bd54fe1a' id='65eda9c0'/>
|
||||
<typedef-decl name='__blksize_t' type-id='bd54fe1a' id='d3f10a7f'/>
|
||||
<typedef-decl name='__blkcnt64_t' type-id='bd54fe1a' id='4e711bf1'/>
|
||||
<typedef-decl name='__syscall_slong_t' type-id='bd54fe1a' id='03085adc'/>
|
||||
<typedef-decl name='FILE' type-id='ec1ed955' id='aa12d1ba'/>
|
||||
<class-decl name='timespec' size-in-bits='128' is-struct='yes' visibility='default' id='a9c79a1f'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='tv_sec' type-id='65eda9c0' visibility='default'/>
|
||||
|
@ -1062,11 +1052,16 @@
|
|||
</class-decl>
|
||||
<pointer-type-def type-id='aa12d1ba' size-in-bits='64' id='822cd80b'/>
|
||||
<pointer-type-def type-id='ec1ed955' size-in-bits='64' id='dca988a5'/>
|
||||
<pointer-type-def type-id='a4036571' size-in-bits='64' id='570f8c59'/>
|
||||
<pointer-type-def type-id='bb4788fa' size-in-bits='64' id='cecf4ea7'/>
|
||||
<pointer-type-def type-id='010ae0b9' size-in-bits='64' id='e4c6fa61'/>
|
||||
<pointer-type-def type-id='79bd3751' size-in-bits='64' id='c65a1f29'/>
|
||||
<pointer-type-def type-id='0c544dc0' size-in-bits='64' id='394fc496'/>
|
||||
<pointer-type-def type-id='1b055409' size-in-bits='64' id='9d424d31'/>
|
||||
<pointer-type-def type-id='0bbec9cd' size-in-bits='64' id='62f7a03d'/>
|
||||
<class-decl name='_IO_codecvt' is-struct='yes' visibility='default' is-declaration-only='yes' id='a4036571'/>
|
||||
<class-decl name='_IO_marker' is-struct='yes' visibility='default' is-declaration-only='yes' id='010ae0b9'/>
|
||||
<class-decl name='_IO_wide_data' is-struct='yes' visibility='default' is-declaration-only='yes' id='79bd3751'/>
|
||||
<function-decl name='getmntany' mangled-name='getmntany' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='getmntany'>
|
||||
<parameter type-id='822cd80b' name='fp'/>
|
||||
<parameter type-id='9d424d31' name='mgetp'/>
|
||||
|
@ -1122,6 +1117,7 @@
|
|||
<type-decl name='char' size-in-bits='8' id='a84c031d'/>
|
||||
<type-decl name='unsigned long int' size-in-bits='64' id='7359adad'/>
|
||||
<type-decl name='variadic parameter type' id='2c1145c5'/>
|
||||
<type-decl name='void' id='48b5725f'/>
|
||||
<typedef-decl name='size_t' type-id='7359adad' id='b59d7dce'/>
|
||||
<pointer-type-def type-id='a84c031d' size-in-bits='64' id='26a90f95'/>
|
||||
<qualified-type-def type-id='a84c031d' const='yes' id='9b45d938'/>
|
||||
|
@ -1154,7 +1150,6 @@
|
|||
<parameter is-variadic='yes'/>
|
||||
<return type-id='26a90f95'/>
|
||||
</function-decl>
|
||||
<type-decl name='void' id='48b5725f'/>
|
||||
</abi-instr>
|
||||
<abi-instr address-size='64' path='uu_avl.c' language='LANG_C99'>
|
||||
<array-type-def dimensions='1' type-id='bf311473' size-in-bits='128' id='f0f65199'>
|
||||
|
@ -1307,15 +1302,6 @@
|
|||
<typedef-decl name='int8_t' type-id='2171a512' id='ee31ee44'/>
|
||||
<typedef-decl name='uint8_t' type-id='c51d6389' id='b96825af'/>
|
||||
<typedef-decl name='uint32_t' type-id='62f1140c' id='8f92235e'/>
|
||||
<class-decl name='__pthread_internal_list' size-in-bits='128' is-struct='yes' visibility='default' id='0e01899c'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='__prev' type-id='4d98cd5a' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='__next' type-id='4d98cd5a' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<typedef-decl name='__pthread_list_t' type-id='0e01899c' id='518fb49c'/>
|
||||
<class-decl name='__pthread_mutex_s' size-in-bits='320' is-struct='yes' visibility='default' id='4c734837'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='__lock' type-id='95e97e5e' visibility='default'/>
|
||||
|
@ -1342,6 +1328,15 @@
|
|||
<var-decl name='__list' type-id='518fb49c' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<class-decl name='__pthread_internal_list' size-in-bits='128' is-struct='yes' visibility='default' id='0e01899c'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='__prev' type-id='4d98cd5a' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='__next' type-id='4d98cd5a' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<typedef-decl name='__pthread_list_t' type-id='0e01899c' id='518fb49c'/>
|
||||
<typedef-decl name='__int8_t' type-id='28577a57' id='2171a512'/>
|
||||
<typedef-decl name='__uint8_t' type-id='002ac4a6' id='c51d6389'/>
|
||||
<typedef-decl name='__uint32_t' type-id='f0981eeb' id='62f1140c'/>
|
||||
|
|
|
@ -596,7 +596,7 @@
|
|||
<elf-symbol name='fletcher_4_superscalar4_ops' size='64' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='fletcher_4_superscalar_ops' size='64' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='libzfs_config_ops' size='16' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='spa_feature_table' size='1960' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='spa_feature_table' size='2016' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='zfeature_checks_disable' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='zfs_deleg_perm_tab' size='512' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='zfs_history_event_names' size='328' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
|
@ -1855,8 +1855,8 @@
|
|||
</function-decl>
|
||||
</abi-instr>
|
||||
<abi-instr address-size='64' path='../../module/zcommon/zfeature_common.c' language='LANG_C99'>
|
||||
<array-type-def dimensions='1' type-id='83f29ca2' size-in-bits='15680' id='9d60dcc5'>
|
||||
<subrange length='35' type-id='7359adad' id='6e6845b5'/>
|
||||
<array-type-def dimensions='1' type-id='83f29ca2' size-in-bits='16128' id='9d5e9e2e'>
|
||||
<subrange length='36' type-id='7359adad' id='ae666bde'/>
|
||||
</array-type-def>
|
||||
<enum-decl name='spa_feature' id='33ecb627'>
|
||||
<underlying-type type-id='9cac1fee'/>
|
||||
|
@ -1896,7 +1896,8 @@
|
|||
<enumerator name='SPA_FEATURE_ZSTD_COMPRESS' value='32'/>
|
||||
<enumerator name='SPA_FEATURE_DRAID' value='33'/>
|
||||
<enumerator name='SPA_FEATURE_ZILSAXATTR' value='34'/>
|
||||
<enumerator name='SPA_FEATURES' value='35'/>
|
||||
<enumerator name='SPA_FEATURE_HEAD_ERRLOG' value='35'/>
|
||||
<enumerator name='SPA_FEATURES' value='36'/>
|
||||
</enum-decl>
|
||||
<typedef-decl name='spa_feature_t' type-id='33ecb627' id='d6618c78'/>
|
||||
<enum-decl name='zfeature_flags' id='6db816a4'>
|
||||
|
@ -1954,7 +1955,7 @@
|
|||
<qualified-type-def type-id='3eee3342' const='yes' id='0c1d5bbb'/>
|
||||
<pointer-type-def type-id='0c1d5bbb' size-in-bits='64' id='a3372543'/>
|
||||
<pointer-type-def type-id='d6618c78' size-in-bits='64' id='a8425263'/>
|
||||
<var-decl name='spa_feature_table' type-id='9d60dcc5' mangled-name='spa_feature_table' visibility='default' elf-symbol-id='spa_feature_table'/>
|
||||
<var-decl name='spa_feature_table' type-id='9d5e9e2e' mangled-name='spa_feature_table' visibility='default' elf-symbol-id='spa_feature_table'/>
|
||||
<var-decl name='zfeature_checks_disable' type-id='c19b74c3' mangled-name='zfeature_checks_disable' visibility='default' elf-symbol-id='zfeature_checks_disable'/>
|
||||
<function-decl name='zfeature_is_valid_guid' mangled-name='zfeature_is_valid_guid' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfeature_is_valid_guid'>
|
||||
<parameter type-id='80f4b756' name='name'/>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
<dependency name='libc.so.6'/>
|
||||
</elf-needed>
|
||||
<elf-function-symbols>
|
||||
<elf-symbol name='_fini' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='_init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='lzbe_add_pair' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='lzbe_bootenv_print' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
<elf-symbol name='lzbe_get_boot_device' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
||||
|
@ -20,6 +18,7 @@
|
|||
<type-decl name='char' size-in-bits='8' id='a84c031d'/>
|
||||
<type-decl name='int' size-in-bits='32' id='95e97e5e'/>
|
||||
<type-decl name='unnamed-enum-underlying-type-32' is-anonymous='yes' size-in-bits='32' alignment-in-bits='32' id='9cac1fee'/>
|
||||
<type-decl name='void' id='48b5725f'/>
|
||||
<enum-decl name='lzbe_flags' id='2b77720b'>
|
||||
<underlying-type type-id='9cac1fee'/>
|
||||
<enumerator name='lzbe_add' value='0'/>
|
||||
|
@ -84,21 +83,16 @@
|
|||
<array-type-def dimensions='1' type-id='a84c031d' size-in-bits='160' id='664ac0b7'>
|
||||
<subrange length='20' type-id='7359adad' id='fdca39cf'/>
|
||||
</array-type-def>
|
||||
<class-decl name='_IO_codecvt' is-struct='yes' visibility='default' is-declaration-only='yes' id='a4036571'/>
|
||||
<class-decl name='_IO_marker' is-struct='yes' visibility='default' is-declaration-only='yes' id='010ae0b9'/>
|
||||
<class-decl name='_IO_wide_data' is-struct='yes' visibility='default' is-declaration-only='yes' id='79bd3751'/>
|
||||
<type-decl name='long int' size-in-bits='64' id='bd54fe1a'/>
|
||||
<type-decl name='signed char' size-in-bits='8' id='28577a57'/>
|
||||
<type-decl name='unsigned short int' size-in-bits='16' id='8efea9e5'/>
|
||||
<typedef-decl name='__off_t' type-id='bd54fe1a' id='79989e9c'/>
|
||||
<typedef-decl name='__off64_t' type-id='bd54fe1a' id='724e4de6'/>
|
||||
<typedef-decl name='FILE' type-id='ec1ed955' id='aa12d1ba'/>
|
||||
<typedef-decl name='_IO_lock_t' type-id='48b5725f' id='bb4788fa'/>
|
||||
<class-decl name='_IO_marker' size-in-bits='192' is-struct='yes' visibility='default' id='010ae0b9'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='_next' type-id='e4c6fa61' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='_sbuf' type-id='dca988a5' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='128'>
|
||||
<var-decl name='_pos' type-id='95e97e5e' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<class-decl name='_IO_FILE' size-in-bits='1728' is-struct='yes' visibility='default' id='ec1ed955'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='_flags' type-id='95e97e5e' visibility='default'/>
|
||||
|
@ -167,16 +161,16 @@
|
|||
<var-decl name='_offset' type-id='724e4de6' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1216'>
|
||||
<var-decl name='__pad1' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_codecvt' type-id='570f8c59' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1280'>
|
||||
<var-decl name='__pad2' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_wide_data' type-id='c65a1f29' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1344'>
|
||||
<var-decl name='__pad3' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_freeres_list' type-id='dca988a5' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1408'>
|
||||
<var-decl name='__pad4' type-id='eaa32e2f' visibility='default'/>
|
||||
<var-decl name='_freeres_buf' type-id='eaa32e2f' visibility='default'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='1472'>
|
||||
<var-decl name='__pad5' type-id='b59d7dce' visibility='default'/>
|
||||
|
@ -188,19 +182,20 @@
|
|||
<var-decl name='_unused2' type-id='664ac0b7' visibility='default'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<typedef-decl name='__off_t' type-id='bd54fe1a' id='79989e9c'/>
|
||||
<typedef-decl name='__off64_t' type-id='bd54fe1a' id='724e4de6'/>
|
||||
<typedef-decl name='FILE' type-id='ec1ed955' id='aa12d1ba'/>
|
||||
<pointer-type-def type-id='aa12d1ba' size-in-bits='64' id='822cd80b'/>
|
||||
<pointer-type-def type-id='ec1ed955' size-in-bits='64' id='dca988a5'/>
|
||||
<pointer-type-def type-id='a4036571' size-in-bits='64' id='570f8c59'/>
|
||||
<pointer-type-def type-id='bb4788fa' size-in-bits='64' id='cecf4ea7'/>
|
||||
<pointer-type-def type-id='010ae0b9' size-in-bits='64' id='e4c6fa61'/>
|
||||
<pointer-type-def type-id='79bd3751' size-in-bits='64' id='c65a1f29'/>
|
||||
<class-decl name='_IO_codecvt' is-struct='yes' visibility='default' is-declaration-only='yes' id='a4036571'/>
|
||||
<class-decl name='_IO_marker' is-struct='yes' visibility='default' is-declaration-only='yes' id='010ae0b9'/>
|
||||
<class-decl name='_IO_wide_data' is-struct='yes' visibility='default' is-declaration-only='yes' id='79bd3751'/>
|
||||
<function-decl name='lzbe_bootenv_print' mangled-name='lzbe_bootenv_print' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='lzbe_bootenv_print'>
|
||||
<parameter type-id='80f4b756' name='pool'/>
|
||||
<parameter type-id='80f4b756' name='nvlist'/>
|
||||
<parameter type-id='822cd80b' name='of'/>
|
||||
<return type-id='95e97e5e'/>
|
||||
</function-decl>
|
||||
<type-decl name='void' id='48b5725f'/>
|
||||
</abi-instr>
|
||||
</abi-corpus>
|
||||
|
|
|
@ -454,6 +454,13 @@ If we have less than this amount of free space,
|
|||
most ZPL operations (e.g. write, create) will return
|
||||
.Sy ENOSPC .
|
||||
.
|
||||
.It Sy spa_upgrade_errlog_limit Ns = Ns Sy 0 Pq uint
|
||||
Limits the number of on-disk error log entries that will be converted to the
|
||||
new format when enabling the
|
||||
.Sy head_errlog
|
||||
feature.
|
||||
The default is to convert all log entries.
|
||||
.
|
||||
.It Sy vdev_removal_max_span Ns = Ns Sy 32768 Ns B Po 32kB Pc Pq int
|
||||
During top-level vdev removal, chunks of data are copied from the vdev
|
||||
which may include free space in order to trade bandwidth for IOPS.
|
||||
|
|
|
@ -507,6 +507,17 @@ once either of the limit properties has been set on a dataset
|
|||
and will never return to being
|
||||
.Sy enabled .
|
||||
.
|
||||
.feature com.delphix head_errlog no
|
||||
This feature enables the upgraded version of errlog, which required an on-disk
|
||||
error log format change.
|
||||
Now the error log of each head dataset is stored separately in the zap object
|
||||
and keyed by the head id.
|
||||
With this feature enabled, every dataset affected by an error block is listed
|
||||
in the output of
|
||||
.Nm zpool Cm status .
|
||||
.Pp
|
||||
\*[instant-never]
|
||||
.
|
||||
.feature com.delphix hole_birth no enabled_txg
|
||||
This feature has/had bugs, the result of which is that, if you do a
|
||||
.Nm zfs Cm send Fl i
|
||||
|
|
|
@ -696,6 +696,7 @@ zpool_feature_init(void)
|
|||
ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);
|
||||
|
||||
{
|
||||
|
||||
static const spa_feature_t zilsaxattr_deps[] = {
|
||||
SPA_FEATURE_EXTENSIBLE_DATASET,
|
||||
SPA_FEATURE_NONE
|
||||
|
@ -707,6 +708,12 @@ zpool_feature_init(void)
|
|||
ZFEATURE_TYPE_BOOLEAN, zilsaxattr_deps, sfeatures);
|
||||
}
|
||||
|
||||
zfeature_register(SPA_FEATURE_HEAD_ERRLOG,
|
||||
"com.delphix:head_errlog", "head_errlog",
|
||||
"Support for per-dataset on-disk error logs.",
|
||||
ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, ZFEATURE_TYPE_BOOLEAN, NULL,
|
||||
sfeatures);
|
||||
|
||||
zfs_mod_list_supported_free(sfeatures);
|
||||
}
|
||||
|
||||
|
|
|
@ -3708,6 +3708,15 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx)
|
|||
|
||||
dsl_dir_rele(odd, FTAG);
|
||||
promote_rele(ddpa, FTAG);
|
||||
|
||||
/*
|
||||
* Transfer common error blocks from old head to new head.
|
||||
*/
|
||||
if (spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||
uint64_t old_head = origin_head->ds_object;
|
||||
uint64_t new_head = hds->ds_object;
|
||||
spa_swap_errlog(dp->dp_spa, new_head, old_head, tx);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4924,6 +4933,37 @@ dsl_dataset_activate_redaction(dsl_dataset_t *ds, uint64_t *redact_snaps,
|
|||
ds->ds_feature[SPA_FEATURE_REDACTED_DATASETS] = ftuaa;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find and return (in *oldest_dsobj) the oldest snapshot of the dsobj
|
||||
* dataset whose birth time is >= min_txg.
|
||||
*/
|
||||
int
|
||||
dsl_dataset_oldest_snapshot(spa_t *spa, uint64_t head_ds, uint64_t min_txg,
|
||||
uint64_t *oldest_dsobj)
|
||||
{
|
||||
dsl_dataset_t *ds;
|
||||
dsl_pool_t *dp = spa->spa_dsl_pool;
|
||||
|
||||
int error = dsl_dataset_hold_obj(dp, head_ds, FTAG, &ds);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
uint64_t prev_obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
uint64_t prev_obj_txg = dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
|
||||
while (prev_obj != 0 && min_txg < prev_obj_txg) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
if ((error = dsl_dataset_hold_obj(dp, prev_obj,
|
||||
FTAG, &ds)) != 0)
|
||||
return (error);
|
||||
prev_obj_txg = dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
prev_obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
}
|
||||
*oldest_dsobj = ds->ds_object;
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(_LP64)
|
||||
#define RECORDSIZE_PERM ZMOD_RW
|
||||
#else
|
||||
|
|
|
@ -1153,6 +1153,9 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
|||
dsl_destroy_snapshot_sync_impl(prev, B_FALSE, tx);
|
||||
dsl_dataset_rele(prev, FTAG);
|
||||
}
|
||||
/* Delete errlog. */
|
||||
if (spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_HEAD_ERRLOG))
|
||||
spa_delete_dataset_errlog(dp->dp_spa, ds->ds_object, tx);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2014 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013, 2014, Delphix. All rights reserved.
|
||||
* Copyright (c) 2021, George Amanakis. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -43,6 +44,16 @@
|
|||
* calculation when the data is requested, storing the result so future queries
|
||||
* will be faster.
|
||||
*
|
||||
* If the head_errlog feature is enabled, a different on-disk format is used.
|
||||
* The error log of each head dataset is stored separately in the zap object
|
||||
* and keyed by the head id. This enables listing every dataset affected in
|
||||
* userland. In order to be able to track whether an error block has been
|
||||
* modified or added to snapshots since it was marked as an error, a new tuple
|
||||
* is introduced: zbookmark_err_phys_t. It allows the storage of the birth
|
||||
* transaction group of an error block on-disk. The birth transaction group is
|
||||
* used by check_filesystem() to assess whether this block was freed,
|
||||
* re-written or added to a snapshot since its marking as an error.
|
||||
*
|
||||
* This log is then shipped into an nvlist where the key is the dataset name and
|
||||
* the value is the object name. Userland is then responsible for uniquifying
|
||||
* this list and displaying it to the user.
|
||||
|
@ -53,7 +64,17 @@
|
|||
#include <sys/spa_impl.h>
|
||||
#include <sys/zap.h>
|
||||
#include <sys/zio.h>
|
||||
#include <sys/dsl_dir.h>
|
||||
#include <sys/dmu_objset.h>
|
||||
#include <sys/dbuf.h>
|
||||
|
||||
/*
|
||||
* spa_upgrade_errlog_limit : A zfs module parameter that controls the number
|
||||
* of on-disk error log entries that will be converted to the new
|
||||
* format when enabling head_errlog. Defaults to 0 which converts
|
||||
* all log entries.
|
||||
*/
|
||||
static uint32_t spa_upgrade_errlog_limit = 0;
|
||||
|
||||
/*
|
||||
* Convert a bookmark to a string.
|
||||
|
@ -67,9 +88,35 @@ bookmark_to_name(zbookmark_phys_t *zb, char *buf, size_t len)
|
|||
}
|
||||
|
||||
/*
|
||||
* Convert a string to a bookmark
|
||||
* Convert an err_phys to a string.
|
||||
*/
|
||||
static void
|
||||
errphys_to_name(zbookmark_err_phys_t *zep, char *buf, size_t len)
|
||||
{
|
||||
(void) snprintf(buf, len, "%llx:%llx:%llx:%llx",
|
||||
(u_longlong_t)zep->zb_object, (u_longlong_t)zep->zb_level,
|
||||
(u_longlong_t)zep->zb_blkid, (u_longlong_t)zep->zb_birth);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a string to a err_phys.
|
||||
*/
|
||||
static void
|
||||
name_to_errphys(char *buf, zbookmark_err_phys_t *zep)
|
||||
{
|
||||
zep->zb_object = zfs_strtonum(buf, &buf);
|
||||
ASSERT(*buf == ':');
|
||||
zep->zb_level = (int)zfs_strtonum(buf + 1, &buf);
|
||||
ASSERT(*buf == ':');
|
||||
zep->zb_blkid = zfs_strtonum(buf + 1, &buf);
|
||||
ASSERT(*buf == ':');
|
||||
zep->zb_birth = zfs_strtonum(buf + 1, &buf);
|
||||
ASSERT(*buf == '\0');
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a string to a bookmark.
|
||||
*/
|
||||
#ifdef _KERNEL
|
||||
static void
|
||||
name_to_bookmark(char *buf, zbookmark_phys_t *zb)
|
||||
{
|
||||
|
@ -82,8 +129,74 @@ name_to_bookmark(char *buf, zbookmark_phys_t *zb)
|
|||
zb->zb_blkid = zfs_strtonum(buf + 1, &buf);
|
||||
ASSERT(*buf == '\0');
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
static void
|
||||
zep_to_zb(uint64_t dataset, zbookmark_err_phys_t *zep, zbookmark_phys_t *zb)
|
||||
{
|
||||
zb->zb_objset = dataset;
|
||||
zb->zb_object = zep->zb_object;
|
||||
zb->zb_level = zep->zb_level;
|
||||
zb->zb_blkid = zep->zb_blkid;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
name_to_object(char *buf, uint64_t *obj)
|
||||
{
|
||||
*obj = zfs_strtonum(buf, &buf);
|
||||
ASSERT(*buf == '\0');
|
||||
}
|
||||
|
||||
static int
|
||||
get_head_and_birth_txg(spa_t *spa, zbookmark_err_phys_t *zep, uint64_t ds_obj,
|
||||
uint64_t *head_dataset_id)
|
||||
{
|
||||
dsl_pool_t *dp = spa->spa_dsl_pool;
|
||||
dsl_dataset_t *ds;
|
||||
objset_t *os;
|
||||
|
||||
dsl_pool_config_enter(dp, FTAG);
|
||||
int error = dsl_dataset_hold_obj(dp, ds_obj, FTAG, &ds);
|
||||
if (error != 0) {
|
||||
dsl_pool_config_exit(dp, FTAG);
|
||||
return (error);
|
||||
}
|
||||
ASSERT(head_dataset_id);
|
||||
*head_dataset_id = dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj;
|
||||
|
||||
error = dmu_objset_from_ds(ds, &os);
|
||||
if (error != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
dsl_pool_config_exit(dp, FTAG);
|
||||
return (error);
|
||||
}
|
||||
|
||||
dnode_t *dn;
|
||||
blkptr_t bp;
|
||||
|
||||
error = dnode_hold(os, zep->zb_object, FTAG, &dn);
|
||||
if (error != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
dsl_pool_config_exit(dp, FTAG);
|
||||
return (error);
|
||||
}
|
||||
|
||||
rw_enter(&dn->dn_struct_rwlock, RW_READER);
|
||||
error = dbuf_dnode_findbp(dn, zep->zb_level, zep->zb_blkid, &bp, NULL,
|
||||
NULL);
|
||||
|
||||
if (error == 0 && BP_IS_HOLE(&bp))
|
||||
error = SET_ERROR(ENOENT);
|
||||
|
||||
zep->zb_birth = bp.blk_birth;
|
||||
rw_exit(&dn->dn_struct_rwlock);
|
||||
dnode_rele(dn, FTAG);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
dsl_pool_config_exit(dp, FTAG);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Log an uncorrectable error to the persistent error log. We add it to the
|
||||
* spa's list of pending errors. The changes are actually synced out to disk
|
||||
|
@ -128,6 +241,276 @@ spa_log_error(spa_t *spa, const zbookmark_phys_t *zb)
|
|||
mutex_exit(&spa->spa_errlist_lock);
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
static int
|
||||
find_birth_txg(dsl_dataset_t *ds, zbookmark_err_phys_t *zep,
|
||||
uint64_t *birth_txg)
|
||||
{
|
||||
objset_t *os;
|
||||
int error = dmu_objset_from_ds(ds, &os);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
dnode_t *dn;
|
||||
blkptr_t bp;
|
||||
|
||||
error = dnode_hold(os, zep->zb_object, FTAG, &dn);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
rw_enter(&dn->dn_struct_rwlock, RW_READER);
|
||||
error = dbuf_dnode_findbp(dn, zep->zb_level, zep->zb_blkid, &bp, NULL,
|
||||
NULL);
|
||||
|
||||
if (error == 0 && BP_IS_HOLE(&bp))
|
||||
error = SET_ERROR(ENOENT);
|
||||
|
||||
*birth_txg = bp.blk_birth;
|
||||
rw_exit(&dn->dn_struct_rwlock);
|
||||
dnode_rele(dn, FTAG);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function serves a double role. If only_count is true, it returns
|
||||
* (in *count) how many times an error block belonging to this filesystem is
|
||||
* referenced by snapshots or clones. If only_count is false, each time the
|
||||
* error block is referenced by a snapshot or clone, it fills the userspace
|
||||
* array at uaddr with the bookmarks of the error blocks. The array is filled
|
||||
* from the back and *count is modified to be the number of unused entries at
|
||||
* the beginning of the array.
|
||||
*/
|
||||
static int
|
||||
check_filesystem(spa_t *spa, uint64_t head_ds, zbookmark_err_phys_t *zep,
|
||||
uint64_t *count, void *uaddr, boolean_t only_count)
|
||||
{
|
||||
dsl_dataset_t *ds;
|
||||
dsl_pool_t *dp = spa->spa_dsl_pool;
|
||||
|
||||
int error = dsl_dataset_hold_obj(dp, head_ds, FTAG, &ds);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
uint64_t latest_txg;
|
||||
uint64_t txg_to_consider = spa->spa_syncing_txg;
|
||||
boolean_t check_snapshot = B_TRUE;
|
||||
error = find_birth_txg(ds, zep, &latest_txg);
|
||||
if (error == 0) {
|
||||
if (zep->zb_birth == latest_txg) {
|
||||
/* Block neither free nor rewritten. */
|
||||
if (!only_count) {
|
||||
zbookmark_phys_t zb;
|
||||
zep_to_zb(head_ds, zep, &zb);
|
||||
if (copyout(&zb, (char *)uaddr + (*count - 1)
|
||||
* sizeof (zbookmark_phys_t),
|
||||
sizeof (zbookmark_phys_t)) != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (SET_ERROR(EFAULT));
|
||||
}
|
||||
(*count)--;
|
||||
} else {
|
||||
(*count)++;
|
||||
}
|
||||
check_snapshot = B_FALSE;
|
||||
} else {
|
||||
ASSERT3U(zep->zb_birth, <, latest_txg);
|
||||
txg_to_consider = latest_txg;
|
||||
}
|
||||
}
|
||||
|
||||
/* How many snapshots reference this block. */
|
||||
uint64_t snap_count;
|
||||
error = zap_count(spa->spa_meta_objset,
|
||||
dsl_dataset_phys(ds)->ds_snapnames_zapobj, &snap_count);
|
||||
if (error != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (snap_count == 0) {
|
||||
/* File system has no snapshot. */
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (0);
|
||||
}
|
||||
|
||||
uint64_t *snap_obj_array = kmem_alloc(snap_count * sizeof (uint64_t),
|
||||
KM_SLEEP);
|
||||
|
||||
int aff_snap_count = 0;
|
||||
uint64_t snap_obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
uint64_t snap_obj_txg = dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
|
||||
/* Check only snapshots created from this file system. */
|
||||
while (snap_obj != 0 && zep->zb_birth < snap_obj_txg &&
|
||||
snap_obj_txg <= txg_to_consider) {
|
||||
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
error = dsl_dataset_hold_obj(dp, snap_obj, FTAG, &ds);
|
||||
if (error != 0)
|
||||
goto out;
|
||||
|
||||
if (dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj != head_ds)
|
||||
break;
|
||||
|
||||
boolean_t affected = B_TRUE;
|
||||
if (check_snapshot) {
|
||||
uint64_t blk_txg;
|
||||
error = find_birth_txg(ds, zep, &blk_txg);
|
||||
affected = (error == 0 && zep->zb_birth == blk_txg);
|
||||
}
|
||||
|
||||
if (affected) {
|
||||
snap_obj_array[aff_snap_count] = snap_obj;
|
||||
aff_snap_count++;
|
||||
|
||||
if (!only_count) {
|
||||
zbookmark_phys_t zb;
|
||||
zep_to_zb(snap_obj, zep, &zb);
|
||||
if (copyout(&zb, (char *)uaddr + (*count - 1) *
|
||||
sizeof (zbookmark_phys_t),
|
||||
sizeof (zbookmark_phys_t)) != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
error = SET_ERROR(EFAULT);
|
||||
goto out;
|
||||
}
|
||||
(*count)--;
|
||||
} else {
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only clones whose origins were affected could also
|
||||
* have affected snapshots.
|
||||
*/
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset,
|
||||
dsl_dataset_phys(ds)->ds_next_clones_obj);
|
||||
zap_cursor_retrieve(&zc, &za) == 0;
|
||||
zap_cursor_advance(&zc)) {
|
||||
error = check_filesystem(spa,
|
||||
za.za_first_integer, zep,
|
||||
count, uaddr, only_count);
|
||||
|
||||
if (error != 0) {
|
||||
zap_cursor_fini(&zc);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
}
|
||||
snap_obj_txg = dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
snap_obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
}
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
|
||||
out:
|
||||
kmem_free(snap_obj_array, sizeof (*snap_obj_array));
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
find_top_affected_fs(spa_t *spa, uint64_t head_ds, zbookmark_err_phys_t *zep,
|
||||
uint64_t *top_affected_fs)
|
||||
{
|
||||
uint64_t oldest_dsobj;
|
||||
int error = dsl_dataset_oldest_snapshot(spa, head_ds, zep->zb_birth,
|
||||
&oldest_dsobj);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
dsl_dataset_t *ds;
|
||||
error = dsl_dataset_hold_obj(spa->spa_dsl_pool, oldest_dsobj,
|
||||
FTAG, &ds);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
*top_affected_fs =
|
||||
dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj;
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
process_error_block(spa_t *spa, uint64_t head_ds, zbookmark_err_phys_t *zep,
|
||||
uint64_t *count, void *uaddr, boolean_t only_count)
|
||||
{
|
||||
dsl_pool_t *dp = spa->spa_dsl_pool;
|
||||
dsl_pool_config_enter(dp, FTAG);
|
||||
uint64_t top_affected_fs;
|
||||
|
||||
int error = find_top_affected_fs(spa, head_ds, zep, &top_affected_fs);
|
||||
if (error == 0)
|
||||
error = check_filesystem(spa, top_affected_fs, zep, count,
|
||||
uaddr, only_count);
|
||||
|
||||
dsl_pool_config_exit(dp, FTAG);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
get_errlog_size(spa_t *spa, uint64_t spa_err_obj)
|
||||
{
|
||||
if (spa_err_obj == 0)
|
||||
return (0);
|
||||
uint64_t total = 0;
|
||||
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, spa_err_obj);
|
||||
zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) {
|
||||
|
||||
zap_cursor_t head_ds_cursor;
|
||||
zap_attribute_t head_ds_attr;
|
||||
zbookmark_err_phys_t head_ds_block;
|
||||
|
||||
uint64_t head_ds;
|
||||
name_to_object(za.za_name, &head_ds);
|
||||
|
||||
for (zap_cursor_init(&head_ds_cursor, spa->spa_meta_objset,
|
||||
za.za_first_integer); zap_cursor_retrieve(&head_ds_cursor,
|
||||
&head_ds_attr) == 0; zap_cursor_advance(&head_ds_cursor)) {
|
||||
|
||||
name_to_errphys(head_ds_attr.za_name, &head_ds_block);
|
||||
(void) process_error_block(spa, head_ds, &head_ds_block,
|
||||
&total, NULL, B_TRUE);
|
||||
}
|
||||
zap_cursor_fini(&head_ds_cursor);
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
return (total);
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
get_errlist_size(spa_t *spa, avl_tree_t *tree)
|
||||
{
|
||||
if (avl_numnodes(tree) == 0)
|
||||
return (0);
|
||||
uint64_t total = 0;
|
||||
|
||||
spa_error_entry_t *se;
|
||||
for (se = avl_first(tree); se != NULL; se = AVL_NEXT(tree, se)) {
|
||||
zbookmark_err_phys_t zep;
|
||||
zep.zb_object = se->se_bookmark.zb_object;
|
||||
zep.zb_level = se->se_bookmark.zb_level;
|
||||
zep.zb_blkid = se->se_bookmark.zb_blkid;
|
||||
|
||||
/*
|
||||
* If we cannot find out the head dataset and birth txg of
|
||||
* the present error block, we opt not to error out. In the
|
||||
* next pool sync this information will be retrieved by
|
||||
* sync_error_list() and written to the on-disk error log.
|
||||
*/
|
||||
uint64_t head_ds_obj;
|
||||
if (get_head_and_birth_txg(spa, &zep,
|
||||
se->se_bookmark.zb_objset, &head_ds_obj) == 0)
|
||||
(void) process_error_block(spa, head_ds_obj, &zep,
|
||||
&total, NULL, B_TRUE);
|
||||
}
|
||||
return (total);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return the number of errors currently in the error log. This is actually the
|
||||
* sum of both the last log and the current log, since we don't know the union
|
||||
|
@ -136,9 +519,11 @@ spa_log_error(spa_t *spa, const zbookmark_phys_t *zb)
|
|||
uint64_t
|
||||
spa_get_errlog_size(spa_t *spa)
|
||||
{
|
||||
uint64_t total = 0, count;
|
||||
uint64_t total = 0;
|
||||
|
||||
if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||
mutex_enter(&spa->spa_errlog_lock);
|
||||
uint64_t count;
|
||||
if (spa->spa_errlog_scrub != 0 &&
|
||||
zap_count(spa->spa_meta_objset, spa->spa_errlog_scrub,
|
||||
&count) == 0)
|
||||
|
@ -154,65 +539,264 @@ spa_get_errlog_size(spa_t *spa)
|
|||
total += avl_numnodes(&spa->spa_errlist_last);
|
||||
total += avl_numnodes(&spa->spa_errlist_scrub);
|
||||
mutex_exit(&spa->spa_errlist_lock);
|
||||
} else {
|
||||
#ifdef _KERNEL
|
||||
mutex_enter(&spa->spa_errlog_lock);
|
||||
total += get_errlog_size(spa, spa->spa_errlog_last);
|
||||
total += get_errlog_size(spa, spa->spa_errlog_scrub);
|
||||
mutex_exit(&spa->spa_errlog_lock);
|
||||
|
||||
mutex_enter(&spa->spa_errlist_lock);
|
||||
total += get_errlist_size(spa, &spa->spa_errlist_last);
|
||||
total += get_errlist_size(spa, &spa->spa_errlist_scrub);
|
||||
mutex_exit(&spa->spa_errlist_lock);
|
||||
#endif
|
||||
}
|
||||
return (total);
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
static int
|
||||
process_error_log(spa_t *spa, uint64_t obj, void *addr, size_t *count)
|
||||
/*
|
||||
* This function sweeps through an on-disk error log and stores all bookmarks
|
||||
* as error bookmarks in a new ZAP object. At the end we discard the old one,
|
||||
* and spa_update_errlog() will set the spa's on-disk error log to new ZAP
|
||||
* object.
|
||||
*/
|
||||
static void
|
||||
sync_upgrade_errlog(spa_t *spa, uint64_t spa_err_obj, uint64_t *newobj,
|
||||
dmu_tx_t *tx)
|
||||
{
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
zbookmark_phys_t zb;
|
||||
uint64_t count;
|
||||
|
||||
*newobj = zap_create(spa->spa_meta_objset, DMU_OT_ERROR_LOG,
|
||||
DMU_OT_NONE, 0, tx);
|
||||
|
||||
/*
|
||||
* If we cannnot perform the upgrade we should clear the old on-disk
|
||||
* error logs.
|
||||
*/
|
||||
if (zap_count(spa->spa_meta_objset, spa_err_obj, &count) != 0) {
|
||||
VERIFY0(dmu_object_free(spa->spa_meta_objset, spa_err_obj, tx));
|
||||
return;
|
||||
}
|
||||
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, spa_err_obj);
|
||||
zap_cursor_retrieve(&zc, &za) == 0;
|
||||
zap_cursor_advance(&zc)) {
|
||||
if (spa_upgrade_errlog_limit != 0 &&
|
||||
zc.zc_cd == spa_upgrade_errlog_limit)
|
||||
break;
|
||||
|
||||
name_to_bookmark(za.za_name, &zb);
|
||||
|
||||
zbookmark_err_phys_t zep;
|
||||
zep.zb_object = zb.zb_object;
|
||||
zep.zb_level = zb.zb_level;
|
||||
zep.zb_blkid = zb.zb_blkid;
|
||||
|
||||
/*
|
||||
* We cannot use get_head_and_birth_txg() because it will
|
||||
* acquire the pool config lock, which we already have. In case
|
||||
* of an error we simply continue.
|
||||
*/
|
||||
uint64_t head_dataset_obj;
|
||||
dsl_pool_t *dp = spa->spa_dsl_pool;
|
||||
dsl_dataset_t *ds;
|
||||
objset_t *os;
|
||||
|
||||
int error = dsl_dataset_hold_obj(dp, zb.zb_objset, FTAG, &ds);
|
||||
if (error != 0)
|
||||
continue;
|
||||
|
||||
head_dataset_obj =
|
||||
dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj;
|
||||
|
||||
/*
|
||||
* The objset and the dnode are required for getting the block
|
||||
* pointer, which is used to determine if BP_IS_HOLE(). If
|
||||
* getting the objset or the dnode fails, do not create a
|
||||
* zap entry (presuming we know the dataset) as this may create
|
||||
* spurious errors that we cannot ever resolve. If an error is
|
||||
* truly persistent, it should re-appear after a scan.
|
||||
*/
|
||||
if (dmu_objset_from_ds(ds, &os) != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
continue;
|
||||
}
|
||||
|
||||
dnode_t *dn;
|
||||
blkptr_t bp;
|
||||
|
||||
if (dnode_hold(os, zep.zb_object, FTAG, &dn) != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
continue;
|
||||
}
|
||||
|
||||
rw_enter(&dn->dn_struct_rwlock, RW_READER);
|
||||
error = dbuf_dnode_findbp(dn, zep.zb_level, zep.zb_blkid, &bp,
|
||||
NULL, NULL);
|
||||
|
||||
zep.zb_birth = bp.blk_birth;
|
||||
rw_exit(&dn->dn_struct_rwlock);
|
||||
dnode_rele(dn, FTAG);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
|
||||
if (error != 0 || BP_IS_HOLE(&bp))
|
||||
continue;
|
||||
|
||||
uint64_t err_obj;
|
||||
error = zap_lookup_int_key(spa->spa_meta_objset, *newobj,
|
||||
head_dataset_obj, &err_obj);
|
||||
|
||||
if (error == ENOENT) {
|
||||
err_obj = zap_create(spa->spa_meta_objset,
|
||||
DMU_OT_ERROR_LOG, DMU_OT_NONE, 0, tx);
|
||||
|
||||
(void) zap_update_int_key(spa->spa_meta_objset,
|
||||
*newobj, head_dataset_obj, err_obj, tx);
|
||||
}
|
||||
|
||||
char buf[64];
|
||||
char *name = "";
|
||||
errphys_to_name(&zep, buf, sizeof (buf));
|
||||
|
||||
(void) zap_update(spa->spa_meta_objset, err_obj,
|
||||
buf, 1, strlen(name) + 1, name, tx);
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
|
||||
VERIFY0(dmu_object_free(spa->spa_meta_objset, spa_err_obj, tx));
|
||||
}
|
||||
|
||||
void
|
||||
spa_upgrade_errlog(spa_t *spa, dmu_tx_t *tx)
|
||||
{
|
||||
uint64_t newobj = 0;
|
||||
|
||||
mutex_enter(&spa->spa_errlog_lock);
|
||||
if (spa->spa_errlog_last != 0) {
|
||||
sync_upgrade_errlog(spa, spa->spa_errlog_last, &newobj, tx);
|
||||
spa->spa_errlog_last = newobj;
|
||||
}
|
||||
|
||||
if (spa->spa_errlog_scrub != 0) {
|
||||
sync_upgrade_errlog(spa, spa->spa_errlog_scrub, &newobj, tx);
|
||||
spa->spa_errlog_scrub = newobj;
|
||||
}
|
||||
mutex_exit(&spa->spa_errlog_lock);
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* If an error block is shared by two datasets it will be counted twice. For
|
||||
* detailed message see spa_get_errlog_size() above.
|
||||
*/
|
||||
static int
|
||||
process_error_log(spa_t *spa, uint64_t obj, void *uaddr, uint64_t *count)
|
||||
{
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
|
||||
if (obj == 0)
|
||||
return (0);
|
||||
|
||||
if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, obj);
|
||||
zap_cursor_retrieve(&zc, &za) == 0;
|
||||
zap_cursor_advance(&zc)) {
|
||||
|
||||
if (*count == 0) {
|
||||
zap_cursor_fini(&zc);
|
||||
return (SET_ERROR(ENOMEM));
|
||||
}
|
||||
|
||||
zbookmark_phys_t zb;
|
||||
name_to_bookmark(za.za_name, &zb);
|
||||
|
||||
if (copyout(&zb, (char *)addr +
|
||||
if (copyout(&zb, (char *)uaddr +
|
||||
(*count - 1) * sizeof (zbookmark_phys_t),
|
||||
sizeof (zbookmark_phys_t)) != 0) {
|
||||
zap_cursor_fini(&zc);
|
||||
return (SET_ERROR(EFAULT));
|
||||
}
|
||||
|
||||
*count -= 1;
|
||||
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
return (0);
|
||||
}
|
||||
|
||||
zap_cursor_fini(&zc);
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, obj);
|
||||
zap_cursor_retrieve(&zc, &za) == 0;
|
||||
zap_cursor_advance(&zc)) {
|
||||
|
||||
zap_cursor_t head_ds_cursor;
|
||||
zap_attribute_t head_ds_attr;
|
||||
|
||||
uint64_t head_ds_err_obj = za.za_first_integer;
|
||||
uint64_t head_ds;
|
||||
name_to_object(za.za_name, &head_ds);
|
||||
for (zap_cursor_init(&head_ds_cursor, spa->spa_meta_objset,
|
||||
head_ds_err_obj); zap_cursor_retrieve(&head_ds_cursor,
|
||||
&head_ds_attr) == 0; zap_cursor_advance(&head_ds_cursor)) {
|
||||
|
||||
zbookmark_err_phys_t head_ds_block;
|
||||
name_to_errphys(head_ds_attr.za_name, &head_ds_block);
|
||||
int error = process_error_block(spa, head_ds,
|
||||
&head_ds_block, count, uaddr, B_FALSE);
|
||||
|
||||
if (error != 0) {
|
||||
zap_cursor_fini(&head_ds_cursor);
|
||||
zap_cursor_fini(&zc);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
zap_cursor_fini(&head_ds_cursor);
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
process_error_list(avl_tree_t *list, void *addr, size_t *count)
|
||||
process_error_list(spa_t *spa, avl_tree_t *list, void *uaddr, uint64_t *count)
|
||||
{
|
||||
spa_error_entry_t *se;
|
||||
|
||||
for (se = avl_first(list); se != NULL; se = AVL_NEXT(list, se)) {
|
||||
if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||
for (se = avl_first(list); se != NULL;
|
||||
se = AVL_NEXT(list, se)) {
|
||||
|
||||
if (*count == 0)
|
||||
return (SET_ERROR(ENOMEM));
|
||||
|
||||
if (copyout(&se->se_bookmark, (char *)addr +
|
||||
if (copyout(&se->se_bookmark, (char *)uaddr +
|
||||
(*count - 1) * sizeof (zbookmark_phys_t),
|
||||
sizeof (zbookmark_phys_t)) != 0)
|
||||
return (SET_ERROR(EFAULT));
|
||||
|
||||
*count -= 1;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (se = avl_first(list); se != NULL; se = AVL_NEXT(list, se)) {
|
||||
zbookmark_err_phys_t zep;
|
||||
zep.zb_object = se->se_bookmark.zb_object;
|
||||
zep.zb_level = se->se_bookmark.zb_level;
|
||||
zep.zb_blkid = se->se_bookmark.zb_blkid;
|
||||
|
||||
uint64_t head_ds_obj;
|
||||
int error = get_head_and_birth_txg(spa, &zep,
|
||||
se->se_bookmark.zb_objset, &head_ds_obj);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
error = process_error_block(spa, head_ds_obj, &zep, count,
|
||||
uaddr, B_FALSE);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
@ -229,7 +813,7 @@ process_error_list(avl_tree_t *list, void *addr, size_t *count)
|
|||
* the error list lock when we are finished.
|
||||
*/
|
||||
int
|
||||
spa_get_errlog(spa_t *spa, void *uaddr, size_t *count)
|
||||
spa_get_errlog(spa_t *spa, void *uaddr, uint64_t *count)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
@ -244,10 +828,10 @@ spa_get_errlog(spa_t *spa, void *uaddr, size_t *count)
|
|||
|
||||
mutex_enter(&spa->spa_errlist_lock);
|
||||
if (!ret)
|
||||
ret = process_error_list(&spa->spa_errlist_scrub, uaddr,
|
||||
ret = process_error_list(spa, &spa->spa_errlist_scrub, uaddr,
|
||||
count);
|
||||
if (!ret)
|
||||
ret = process_error_list(&spa->spa_errlist_last, uaddr,
|
||||
ret = process_error_list(spa, &spa->spa_errlist_last, uaddr,
|
||||
count);
|
||||
mutex_exit(&spa->spa_errlist_lock);
|
||||
|
||||
|
@ -299,35 +883,91 @@ spa_errlog_drain(spa_t *spa)
|
|||
/*
|
||||
* Process a list of errors into the current on-disk log.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
sync_error_list(spa_t *spa, avl_tree_t *t, uint64_t *obj, dmu_tx_t *tx)
|
||||
{
|
||||
spa_error_entry_t *se;
|
||||
char buf[64];
|
||||
void *cookie;
|
||||
|
||||
if (avl_numnodes(t) != 0) {
|
||||
if (avl_numnodes(t) == 0)
|
||||
return;
|
||||
|
||||
/* create log if necessary */
|
||||
if (*obj == 0)
|
||||
*obj = zap_create(spa->spa_meta_objset,
|
||||
DMU_OT_ERROR_LOG, DMU_OT_NONE,
|
||||
0, tx);
|
||||
*obj = zap_create(spa->spa_meta_objset, DMU_OT_ERROR_LOG,
|
||||
DMU_OT_NONE, 0, tx);
|
||||
|
||||
/* add errors to the current log */
|
||||
if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||
for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
|
||||
char *name = se->se_name ? se->se_name : "";
|
||||
|
||||
bookmark_to_name(&se->se_bookmark, buf, sizeof (buf));
|
||||
|
||||
(void) zap_update(spa->spa_meta_objset,
|
||||
*obj, buf, 1, strlen(name) + 1, name, tx);
|
||||
(void) zap_update(spa->spa_meta_objset, *obj, buf, 1,
|
||||
strlen(name) + 1, name, tx);
|
||||
}
|
||||
} else {
|
||||
for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
|
||||
char *name = se->se_name ? se->se_name : "";
|
||||
|
||||
zbookmark_err_phys_t zep;
|
||||
zep.zb_object = se->se_bookmark.zb_object;
|
||||
zep.zb_level = se->se_bookmark.zb_level;
|
||||
zep.zb_blkid = se->se_bookmark.zb_blkid;
|
||||
|
||||
/*
|
||||
* If we cannot find out the head dataset and birth txg
|
||||
* of the present error block, we simply continue.
|
||||
* Reinserting that error block to the error lists,
|
||||
* even if we are not syncing the final txg, results
|
||||
* in duplicate posting of errors.
|
||||
*/
|
||||
uint64_t head_dataset_obj;
|
||||
int error = get_head_and_birth_txg(spa, &zep,
|
||||
se->se_bookmark.zb_objset, &head_dataset_obj);
|
||||
if (error != 0)
|
||||
continue;
|
||||
|
||||
uint64_t err_obj;
|
||||
error = zap_lookup_int_key(spa->spa_meta_objset,
|
||||
*obj, head_dataset_obj, &err_obj);
|
||||
|
||||
if (error == ENOENT) {
|
||||
err_obj = zap_create(spa->spa_meta_objset,
|
||||
DMU_OT_ERROR_LOG, DMU_OT_NONE, 0, tx);
|
||||
|
||||
(void) zap_update_int_key(spa->spa_meta_objset,
|
||||
*obj, head_dataset_obj, err_obj, tx);
|
||||
}
|
||||
errphys_to_name(&zep, buf, sizeof (buf));
|
||||
|
||||
(void) zap_update(spa->spa_meta_objset,
|
||||
err_obj, buf, 1, strlen(name) + 1, name, tx);
|
||||
}
|
||||
}
|
||||
/* purge the error list */
|
||||
cookie = NULL;
|
||||
while ((se = avl_destroy_nodes(t, &cookie)) != NULL)
|
||||
kmem_free(se, sizeof (spa_error_entry_t));
|
||||
}
|
||||
|
||||
static void
|
||||
delete_errlog(spa_t *spa, uint64_t spa_err_obj, dmu_tx_t *tx)
|
||||
{
|
||||
if (spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, spa_err_obj);
|
||||
zap_cursor_retrieve(&zc, &za) == 0;
|
||||
zap_cursor_advance(&zc)) {
|
||||
VERIFY0(dmu_object_free(spa->spa_meta_objset,
|
||||
za.za_first_integer, tx));
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
}
|
||||
VERIFY0(dmu_object_free(spa->spa_meta_objset, spa_err_obj, tx));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -378,8 +1018,7 @@ spa_errlog_sync(spa_t *spa, uint64_t txg)
|
|||
*/
|
||||
if (scrub_finished) {
|
||||
if (spa->spa_errlog_last != 0)
|
||||
VERIFY(dmu_object_free(spa->spa_meta_objset,
|
||||
spa->spa_errlog_last, tx) == 0);
|
||||
delete_errlog(spa, spa->spa_errlog_last, tx);
|
||||
spa->spa_errlog_last = spa->spa_errlog_scrub;
|
||||
spa->spa_errlog_scrub = 0;
|
||||
|
||||
|
@ -406,6 +1045,137 @@ spa_errlog_sync(spa_t *spa, uint64_t txg)
|
|||
mutex_exit(&spa->spa_errlog_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
delete_dataset_errlog(spa_t *spa, uint64_t spa_err_obj, uint64_t ds,
|
||||
dmu_tx_t *tx)
|
||||
{
|
||||
if (spa_err_obj == 0)
|
||||
return;
|
||||
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, spa_err_obj);
|
||||
zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) {
|
||||
uint64_t head_ds;
|
||||
name_to_object(za.za_name, &head_ds);
|
||||
if (head_ds == ds) {
|
||||
(void) zap_remove(spa->spa_meta_objset, spa_err_obj,
|
||||
za.za_name, tx);
|
||||
VERIFY0(dmu_object_free(spa->spa_meta_objset,
|
||||
za.za_first_integer, tx));
|
||||
break;
|
||||
}
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
}
|
||||
|
||||
void
|
||||
spa_delete_dataset_errlog(spa_t *spa, uint64_t ds, dmu_tx_t *tx)
|
||||
{
|
||||
mutex_enter(&spa->spa_errlog_lock);
|
||||
delete_dataset_errlog(spa, spa->spa_errlog_scrub, ds, tx);
|
||||
delete_dataset_errlog(spa, spa->spa_errlog_last, ds, tx);
|
||||
mutex_exit(&spa->spa_errlog_lock);
|
||||
}
|
||||
|
||||
static int
|
||||
find_txg_ancestor_snapshot(spa_t *spa, uint64_t new_head, uint64_t old_head,
|
||||
uint64_t *txg)
|
||||
{
|
||||
dsl_dataset_t *ds;
|
||||
dsl_pool_t *dp = spa->spa_dsl_pool;
|
||||
|
||||
int error = dsl_dataset_hold_obj(dp, old_head, FTAG, &ds);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
uint64_t prev_obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
uint64_t prev_obj_txg = dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
|
||||
while (prev_obj != 0) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
if ((error = dsl_dataset_hold_obj(dp, prev_obj,
|
||||
FTAG, &ds)) == 0 &&
|
||||
dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj == new_head)
|
||||
break;
|
||||
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
prev_obj_txg = dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
prev_obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
}
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
ASSERT(prev_obj != 0);
|
||||
*txg = prev_obj_txg;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
swap_errlog(spa_t *spa, uint64_t spa_err_obj, uint64_t new_head, uint64_t
|
||||
old_head, dmu_tx_t *tx)
|
||||
{
|
||||
if (spa_err_obj == 0)
|
||||
return;
|
||||
|
||||
uint64_t old_head_errlog;
|
||||
int error = zap_lookup_int_key(spa->spa_meta_objset, spa_err_obj,
|
||||
old_head, &old_head_errlog);
|
||||
|
||||
/* If no error log, then there is nothing to do. */
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
uint64_t txg;
|
||||
error = find_txg_ancestor_snapshot(spa, new_head, old_head, &txg);
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Create an error log if the file system being promoted does not
|
||||
* already have one.
|
||||
*/
|
||||
uint64_t new_head_errlog;
|
||||
error = zap_lookup_int_key(spa->spa_meta_objset, spa_err_obj, new_head,
|
||||
&new_head_errlog);
|
||||
|
||||
if (error != 0) {
|
||||
new_head_errlog = zap_create(spa->spa_meta_objset,
|
||||
DMU_OT_ERROR_LOG, DMU_OT_NONE, 0, tx);
|
||||
|
||||
(void) zap_update_int_key(spa->spa_meta_objset, spa_err_obj,
|
||||
new_head, new_head_errlog, tx);
|
||||
}
|
||||
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
zbookmark_err_phys_t err_block;
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, old_head_errlog);
|
||||
zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) {
|
||||
|
||||
char *name = "";
|
||||
name_to_errphys(za.za_name, &err_block);
|
||||
if (err_block.zb_birth < txg) {
|
||||
(void) zap_update(spa->spa_meta_objset, new_head_errlog,
|
||||
za.za_name, 1, strlen(name) + 1, name, tx);
|
||||
|
||||
(void) zap_remove(spa->spa_meta_objset, old_head_errlog,
|
||||
za.za_name, tx);
|
||||
}
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
}
|
||||
|
||||
void
|
||||
spa_swap_errlog(spa_t *spa, uint64_t new_head_ds, uint64_t old_head_ds,
|
||||
dmu_tx_t *tx)
|
||||
{
|
||||
mutex_enter(&spa->spa_errlog_lock);
|
||||
swap_errlog(spa, spa->spa_errlog_scrub, new_head_ds, old_head_ds, tx);
|
||||
swap_errlog(spa, spa->spa_errlog_last, new_head_ds, old_head_ds, tx);
|
||||
mutex_exit(&spa->spa_errlog_lock);
|
||||
}
|
||||
|
||||
#if defined(_KERNEL)
|
||||
/* error handling */
|
||||
EXPORT_SYMBOL(spa_log_error);
|
||||
|
@ -415,4 +1185,14 @@ EXPORT_SYMBOL(spa_errlog_rotate);
|
|||
EXPORT_SYMBOL(spa_errlog_drain);
|
||||
EXPORT_SYMBOL(spa_errlog_sync);
|
||||
EXPORT_SYMBOL(spa_get_errlists);
|
||||
EXPORT_SYMBOL(spa_delete_dataset_errlog);
|
||||
EXPORT_SYMBOL(spa_swap_errlog);
|
||||
EXPORT_SYMBOL(sync_error_list);
|
||||
EXPORT_SYMBOL(spa_upgrade_errlog);
|
||||
#endif
|
||||
|
||||
/* BEGIN CSTYLED */
|
||||
ZFS_MODULE_PARAM(zfs_spa, spa_, upgrade_errlog_limit, INT, ZMOD_RW,
|
||||
"Limit the number of errors which will be upgraded to the new "
|
||||
"on-disk error log when enabling head_errlog");
|
||||
/* END CSTYLED */
|
||||
|
|
|
@ -389,6 +389,13 @@ feature_enable_sync(spa_t *spa, zfeature_info_t *feature, dmu_tx_t *tx)
|
|||
!spa_feature_is_active(spa, SPA_FEATURE_ENCRYPTION) &&
|
||||
feature->fi_feature == SPA_FEATURE_BOOKMARK_V2)
|
||||
spa->spa_errata = 0;
|
||||
|
||||
/*
|
||||
* Convert the old on-disk error log to the new format when activating
|
||||
* the head_errlog feature.
|
||||
*/
|
||||
if (feature->fi_feature == SPA_FEATURE_HEAD_ERRLOG)
|
||||
spa_upgrade_errlog(spa, tx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -5670,7 +5670,7 @@ zfs_ioc_error_log(zfs_cmd_t *zc)
|
|||
{
|
||||
spa_t *spa;
|
||||
int error;
|
||||
size_t count = (size_t)zc->zc_nvlist_dst_size;
|
||||
uint64_t count = zc->zc_nvlist_dst_size;
|
||||
|
||||
if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0)
|
||||
return (error);
|
||||
|
|
|
@ -488,6 +488,7 @@ tags = ['functional', 'cli_root', 'zpool_split']
|
|||
|
||||
[tests/functional/cli_root/zpool_status]
|
||||
tests = ['zpool_status_001_pos', 'zpool_status_002_pos',
|
||||
'zpool_status_003_pos', 'zpool_status_004_pos',
|
||||
'zpool_status_features_001_pos']
|
||||
tags = ['functional', 'cli_root', 'zpool_status']
|
||||
|
||||
|
|
|
@ -98,5 +98,6 @@ if is_linux || is_freebsd; then
|
|||
"feature@livelist"
|
||||
"feature@zstd_compress"
|
||||
"feature@zilsaxattr"
|
||||
"feature@head_errlog"
|
||||
)
|
||||
fi
|
|
@ -4,4 +4,6 @@ dist_pkgdata_SCRIPTS = \
|
|||
cleanup.ksh \
|
||||
zpool_status_001_pos.ksh \
|
||||
zpool_status_002_pos.ksh \
|
||||
zpool_status_003_pos.ksh \
|
||||
zpool_status_004_pos.ksh \
|
||||
zpool_status_features_001_pos.ksh
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2019, Delphix. All rights reserved.
|
||||
# Copyright (c) 2021, George Amanakis. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify correct output with 'zpool status -v' after corrupting a file
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a pool and a file
|
||||
# 2. zinject checksum errors
|
||||
# 3. Read the file
|
||||
# 4. Take a snapshot and make a clone
|
||||
# 5. Verify we see "snapshot, clone and filesystem" output in 'zpool status -v'
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must zinject -c all
|
||||
datasetexists $TESTPOOL2 && log_must zpool destroy $TESTPOOL2
|
||||
rm -f $TESTDIR/vdev_a
|
||||
}
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
log_assert "Verify correct 'zpool status -v' output with a corrupted file"
|
||||
log_onexit cleanup
|
||||
|
||||
truncate -s $MINVDEVSIZE $TESTDIR/vdev_a
|
||||
log_must zpool create -f $TESTPOOL2 $TESTDIR/vdev_a
|
||||
|
||||
log_must fio --rw=write --name=job --size=10M --filename=/$TESTPOOL2/10m_file
|
||||
log_must zinject -t data -e checksum -f 100 -am /$TESTPOOL2/10m_file
|
||||
|
||||
# Try to read the 2nd megabyte of 10m_file
|
||||
dd if=/$TESTPOOL2/10m_file bs=1M || true
|
||||
|
||||
log_must zfs snapshot $TESTPOOL2@snap
|
||||
log_must zfs clone $TESTPOOL2@snap $TESTPOOL2/clone
|
||||
|
||||
# Look to see that snapshot, clone and filesystem our files report errors
|
||||
log_must eval "zpool status -v | grep '$TESTPOOL2@snap:/10m_file'"
|
||||
log_must eval "zpool status -v | grep '$TESTPOOL2/clone/10m_file'"
|
||||
log_must eval "zpool status -v | grep '$TESTPOOL2/10m_file'"
|
||||
|
||||
log_pass "'zpool status -v' outputs affected filesystem, snapshot & clone"
|
|
@ -0,0 +1,81 @@
|
|||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2019, by Delphix. All rights reserved.
|
||||
# Copyright (c) 2021, George Amanakis. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify feature@head_errlog=disabled works.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create a pool with feature@head_errlog=disabled and a file
|
||||
# 2. zinject checksum errors
|
||||
# 3. Read the file
|
||||
# 4. Take a snapshot and make a clone
|
||||
# 5. Verify that zpool status displays the old behaviour.
|
||||
|
||||
function cleanup
|
||||
{
|
||||
log_must zinject -c all
|
||||
datasetexists $TESTPOOL2 && log_must zpool destroy $TESTPOOL2
|
||||
rm -f $TESTDIR/vdev_a
|
||||
}
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
log_assert "Verify 'zpool status -v' with feature@head_errlog=disabled works"
|
||||
log_onexit cleanup
|
||||
|
||||
truncate -s $MINVDEVSIZE $TESTDIR/vdev_a
|
||||
log_must zpool create -f -o feature@head_errlog=disabled $TESTPOOL2 $TESTDIR/vdev_a
|
||||
|
||||
state=$(zpool list -Ho feature@head_errlog $TESTPOOL2)
|
||||
if [[ "$state" != "disabled" ]]; then
|
||||
log_fail "head_errlog has state $state"
|
||||
fi
|
||||
|
||||
log_must fio --rw=write --name=job --size=10M --filename=/$TESTPOOL2/10m_file
|
||||
log_must zinject -t data -e checksum -f 100 -am /$TESTPOOL2/10m_file
|
||||
|
||||
# Try to read the file
|
||||
dd if=/$TESTPOOL2/10m_file bs=1M || true
|
||||
|
||||
log_must zfs snapshot $TESTPOOL2@snap
|
||||
log_must zfs clone $TESTPOOL2@snap $TESTPOOL2/clone
|
||||
|
||||
# Check that snapshot and clone do not report the error.
|
||||
log_mustnot eval "zpool status -v | grep '$TESTPOOL2@snap:/10m_file'"
|
||||
log_mustnot eval "zpool status -v | grep '$TESTPOOL2/clone/10m_file'"
|
||||
log_must eval "zpool status -v | grep '$TESTPOOL2/10m_file'"
|
||||
|
||||
# Check that enabling the feature reports the error properly.
|
||||
log_must zpool set feature@head_errlog=enabled $TESTPOOL2
|
||||
log_must eval "zpool status -v | grep '$TESTPOOL2@snap:/10m_file'"
|
||||
log_must eval "zpool status -v | grep '$TESTPOOL2/clone/10m_file'"
|
||||
log_must eval "zpool status -v | grep '$TESTPOOL2/10m_file'"
|
||||
|
||||
log_pass "'zpool status -v' with feature@head_errlog=disabled works"
|
Loading…
Reference in New Issue