Skip to content

Conversation

PrivatePuffin
Copy link
Contributor

@PrivatePuffin PrivatePuffin commented Dec 18, 2019

Rebase of the stale/inactive but complete original by @TulsiJain #8902
Including feedback/changes requested by @tonyhutter when it comes to moving test to common.run
Also removed out of scope gitignore changes.

Reviewed by: Paul Dagnelie [email protected]
Reviewed by: Tony Hutter
(See original PR #8902)

Co-authored-by: TulsiJain [email protected]
Signed-off-by: TulsiJain [email protected]
Signed-off-by: Kjeld Schouten-lebbing [email protected]

Closes #9742

Motivation, Context and Description

zpool status -vx outputs name of file containing corrupted error blocks if any, but says nothing about probable error blocks location. This pull request appends with file name corrupted blocks offset range to the file name.
Sample output Earlier
/{file_system_path}/myfile
Sample output now
/{file_system_path}/myfile errors: in 236 blocks (size 128KB), between offset 0x1002a0000 and 0x102000000 bytes

How Has This Been Tested?

Using dd command I created a file under filesystem as following
dd if=/dev/urandom of=/{file_system_path}/myfile bs=128k count=50000.
Then I directly wrote to disk device as following
dd if=/dev/urandom of=/dev/{disk_name} bs=1024 seek=10000 count=30000 conv=notrunc.
This causes file to get corrupted. Earlier it was only name of the file i.e /{file_system_path}/myfile now updated error message is /{file_system_path}/myfile errors: in 236 blocks (size 128KB), between offset 0x1002a0000 and 0x102000000 bytes

Also added a test cases provided by @tonyhutter. It works as follows:

Create new file
Add checksum error using zinject
Read using dd
Verifies that filename is logged in zpool status -vx command

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:

zpool status -vx outputs name of file containing corrupted
error blocks if any, but says nothing about probable error
blocks location. This pull request appends with file name
corrupted blocks offset range to the file name.

Co-authored-by: TulsiJain <[email protected]>
Signed-off-by: TulsiJain <[email protected]>
Signed-off-by: Kjeld Schouten-lebbing <[email protected]>
@PrivatePuffin PrivatePuffin changed the title Added error offset in zpool status and added test case Added error offset in zpool status Dec 18, 2019
@PrivatePuffin PrivatePuffin marked this pull request as ready for review December 18, 2019 15:42
@tonyhutter
Copy link
Contributor

@Ornias1993 thanks for reviving this patch! I'll take a look at it.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Dec 18, 2019
@tonyhutter
Copy link
Contributor

Looking at the Fedora 30 results:
http://build.zfsonlinux.org/builders/Fedora%2030%20x86_64%20%28TEST%29/builds/2913/steps/shell_9/logs/log

14:17:15.56         /mnt/testdir/10m_file: errors in 9 blocks (size 128K), between offset 0 and 0x1e0000 bytes
14:17:15.57 SUCCESS: eval zpool status -v | grep '10m_file: errors'
14:17:15.57         /mnt/testdir/1m_file: errors in 1 blocks (size 128K), between offset 0 and 0x20000 bytes
14:17:15.58 SUCCESS: eval zpool status -v | grep '1m_file: errors'
14:17:15.58 'zpool status -v' output is correct

We should see 10m_file's errors start at a 0x100000 (1MB) offset, not 0. We seek to 1MB at the file here:

dd if=$TESTDIR/10m_file bs=1M skip=1 count=1 || true

@PrivatePuffin
Copy link
Contributor Author

@tonyhutter
A shame, It isn't my code and I just rebased it because it already passed review besides one note.
I'm not currently interested or have the time to do more than this. Sorry.

@codecov
Copy link

codecov bot commented Dec 18, 2019

Codecov Report

Merging #9743 into master will increase coverage by <1%.
The diff coverage is 93%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #9743    +/-   ##
========================================
+ Coverage      79%      80%   +<1%     
========================================
  Files         385      385            
  Lines      121299   121361    +62     
========================================
+ Hits        96407    96544   +137     
+ Misses      24892    24817    -75
Flag Coverage Δ
#kernel 80% <100%> (ø) ⬆️
#user 67% <89%> (ø) ⬆️

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 118fc3e...f72f701. Read the comment docs.

@tonyhutter
Copy link
Contributor

@Ornias1993 no problem, I totally understand. I actually had a follow-on patch to @TulsiJain's patch that included printing out all the ranges of errors:

    $ zpool status -vv
    ...
        NAME        STATE     READ WRITE CKSUM
        testpool    ONLINE       0     0     0
          loop0     ONLINE       0     0    20
    
    errors: Permanent errors have been detected in the following files:
    
        /var/tmp/testdir/10m_file: found 9 corrupted 128K blocks
           [0x0-0x1ffff] (128K)
           [0x100000-0x1fffff] (1M)
    
        /var/tmp/testdir/1m_file: found 1 corrupted 128K block
           [0x0-0x1ffff] (128K)

I've since updated my patch to include @TulsiJain's patch and have it here: https://github.com/tonyhutter/zfs/tree/error-ranges

I'd recommend we close this PR, and I'll clean up my error-ranges branch and put it out for review.

@behlendorf
Copy link
Contributor

@tonyhutter I agree, that sounds best. Please do!

@behlendorf behlendorf closed this Dec 20, 2019
@tonyhutter
Copy link
Contributor

My error-ranges branch is now a PR:
#9781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report the exact location of a checksum error

3 participants