Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZTS: Fix zpool_import_hostid_changed_cachefile_unclean_export #16570

Conversation

behlendorf
Copy link
Contributor

Motivation and Context

https://github.com/openzfs/zfs/actions/runs/11035507045/job/30660961625

  Test (Linux): /usr/share/zfs/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_hostid_changed_cachefile_unclean_export (run as root) [00:00] [FAIL]
  19:36:30.10 SUCCESS: zgenhostid -f 01234567
  19:36:30.25 SUCCESS: zpool create -o cachefile=/var/tmp/cachefile.483896 testpool1 /var/tmp/dev_import-test/disk0
  19:36:30.26 SUCCESS: cp /var/tmp/cachefile.483896 /var/tmp/cachefile.483896.bkp
  19:36:30.28 SUCCESS: cp /var/tmp/dev_import-test/disk0 /var/tmp/dev_import-test/disk0.bak
  19:36:30.36 SUCCESS: zpool export testpool1
  19:36:30.38 SUCCESS: cp -f /var/tmp/dev_import-test/disk0.bak /var/tmp/dev_import-test/disk0
  19:36:30.38 SUCCESS: rm -f /var/tmp/dev_import-test/disk0.bak
  19:36:30.39 SUCCESS: zgenhostid -f 89abcdef
  19:36:30.46 cachefile import failed, retrying
  19:36:30.46 SUCCESS: zpool import -c /var/tmp/cachefile.483896.bkp testpool1 exited 1
  19:36:30.79 	Recovery is possible, but will result in some data loss.
  19:36:30.79 	Returning the pool to its state as of Wed Sep 25 19:36:30 2024
  19:36:30.79 	should correct the problem.  Recovery can be attempted
  19:36:30.79 	by executing 'zpool import -F testpool1'.  A scrub of the pool
  19:36:30.79 	is strongly recommended after recovery.
  19:36:30.79 cachefile import failed, retrying
  19:36:30.79 	Recovery is possible, but will result in some data loss.
  19:36:30.79 	Returning the pool to its state as of Wed Sep 25 19:36:30 2024
  19:36:30.79 	should correct the problem.  Recovery can be attempted
  19:36:30.79 	by executing 'zpool import -F testpool1'.  A scrub of the pool
  19:36:30.79 	is strongly recommended after recovery.
  19:36:30.79 cannot import 'testpool1': insufficient replicas
  19:36:30.79 cannot import 'testpool1': insufficient replicas
  19:36:30.79 ERROR: zpool import -f -c /var/tmp/cachefile.483896.bkp testpool1 exited 1

Description

Update the test case to freeze the pool then export it to better simulate a hard failure. This is preferable to copying the vdev while the pool's imported since with a copy we're not guaranteed the on-disk state will be consistent. That can in turn result in a pool import failure and a spurious test failure.

How Has This Been Tested?

Will be tested by the CI.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Update the test case to freeze the pool then export it to better
simulate a hard failure.  This is preferable to copying the vdev
while the pool's imported since with a copy we're not guaranteed
the on-disk state will be consistent.  That can in turn result
in a pool import failure and a spurious test failure.

Signed-off-by: Brian Behlendorf <[email protected]>
@behlendorf behlendorf added Component: Test Suite Indicates an issue with the test framework or a test case Status: Code Review Needed Ready for review and testing Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Sep 26, 2024
@behlendorf behlendorf merged commit ab1b87e into openzfs:master Sep 26, 2024
21 checks passed
mcmilk pushed a commit to mcmilk/zfs that referenced this pull request Sep 26, 2024
Update the test case to freeze the pool then export it to better
simulate a hard failure.  This is preferable to copying the vdev
while the pool's imported since with a copy we're not guaranteed
the on-disk state will be consistent.  That can in turn result
in a pool import failure and a spurious test failure.

Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#16570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Test Suite Indicates an issue with the test framework or a test case Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants