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

Add zfs_scan_ignore_errors tunable #7293

Merged
merged 1 commit into from
Mar 13, 2018
Merged

Add zfs_scan_ignore_errors tunable #7293

merged 1 commit into from
Mar 13, 2018

Conversation

dweeezil
Copy link
Contributor

Allow to work around some cases of continuous resilvering upon pool import.

Description

When it's set, a DTL range will be cleared even if its scan/scrub had
errors. This allows to work around resilver/scrub upon import when the
pool has errors.

Motivation and Context

The specific use case for this flag is to deal with permanent errors that occur when a zpool replace operation has been performed. Vdev replacement essentially creates a mirror and uses the DTL facility to cause the newly-attached mirror component to be completely resilvered. If there are permanent errors during the resilvering process, a "full extent" DTL is left in place which will cause a resilver to occur upon the next pool import. To assist in pool recovery, this flag can be set which will allow the resilver to completely normally, albeit with the resultant pool having some permanent errors.

One of the use cases is described in the issue logs for #5528 and it might also help for issues such as #6613.

How Has This Been Tested?

Tested using this script:

#!/bin/bash

POOL=tank
DS=fs
VDEV_DIR=/run/tank

# Clean existing pool
zpool export $POOL
rm -f $VDEV_DIR/*

# Create vdev file(s)
mkdir -p $VDEV_DIR $VDEV_DIR
truncate -s 1g $VDEV_DIR/{0,1}

# Create pool and dataset
zpool create $POOL $VDEV_DIR/0
zfs create $POOL/$DS

# Create a file of known content
yes | dd bs=128k iflag=fullblock of=/$POOL/$DS/yes count=100
zpool sync
sync

# Get the first L0 DVA on vdev 0 of the second file
dva=$(zdb -ddddd $POOL/$DS $(stat -c %i /$POOL/$DS/yes) | head -40 | grep ' L0 0:' | head -1)

# Export the pool and calculate the offset of the first byte of the file
zpool export $POOL
set -- $dva
dva=$3
offset=${dva#0:}
offset=${offset%%:*}
offset=$(echo $offset | tr '[:lower:]' '[:upper:]')
offset=$(echo "ibase=16; $offset + 400000" | bc)
echo dva=$dva offset=$offset

# Corrupt the first byte of the file
dd bs=1 seek=$offset count=1 conv=notrunc if=/dev/zero of=$VDEV_DIR/0

# Import and replace vdev
zpool import -d $VDEV_DIR $POOL
#zinject -d $VDEV_DIR/0 -f 50 tank
zpool replace $POOL $VDEV_DIR/0 $VDEV_DIR/1

# Export, enable recovery flag and re-import
zpool export $POOL
echo 1 > /sys/module/zfs/parameters/zfs_scan_ignore_errors
zpool import -d $VDEV_DIR $POOL

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)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

When it's set, a DTL range will be cleared even if its scan/scrub had
errors.  This allows to work around resilver/scrub upon import when the
pool has errors.

Signed-off-by: Tim Chase <tim@chase2k.com>
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It'll be nice to have this easily available for the cases when it's needed.

@codecov
Copy link

codecov bot commented Mar 12, 2018

Codecov Report

Merging #7293 into master will increase coverage by 0.12%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7293      +/-   ##
==========================================
+ Coverage   76.34%   76.47%   +0.12%     
==========================================
  Files         328      328              
  Lines      104008   104010       +2     
==========================================
+ Hits        79410    79543     +133     
+ Misses      24598    24467     -131
Flag Coverage Δ
#kernel 76.26% <50%> (-0.11%) ⬇️
#user 65.84% <50%> (+0.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 743253d...05eb305. Read the comment docs.

@behlendorf behlendorf merged commit 02638a3 into openzfs:master Mar 13, 2018
@DurvalMenezes
Copy link

DurvalMenezes commented Apr 11, 2018

I want to report that I tested this patch by applying it on top of the zfs-0.7.8 sources and compiling a custom build. It saved my bacon on #6813, I came to the original issue where I picked it up (#5528) and followed the link here, and was pleased to learn that it will be made a permanent part of ZoL. Way to go, @dweeezil and @behlendorf, thank you two very much.

tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Apr 16, 2018
When it's set, a DTL range will be cleared even if its scan/scrub had
errors.  This allows to work around resilver/scrub upon import when the
pool has errors.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes openzfs#7293
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request May 4, 2018
When it's set, a DTL range will be cleared even if its scan/scrub had
errors.  This allows to work around resilver/scrub upon import when the
pool has errors.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes openzfs#7293
tonyhutter pushed a commit that referenced this pull request May 10, 2018
When it's set, a DTL range will be cleared even if its scan/scrub had
errors.  This allows to work around resilver/scrub upon import when the
pool has errors.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes #7293
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants