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

zio_dva_throttle_done() should conditionally accept zinjected ZIOs #6384

Merged
merged 1 commit into from Aug 10, 2017

Conversation

sanjeevbagewadi
Copy link
Contributor

@sanjeevbagewadi sanjeevbagewadi commented Jul 21, 2017

#6383)

zinject enables ZIO_FLAG_IO_RETRY to ensure FMA events are generated. These ZIOs
could have ZIO_FLAG_IO_ALOCATING set. Hence, conditionally allow such ZIOs in
zio_dva_throttle_done() and do not fail the ASSERT() for ZIO_FLAG_IO_RETRY.

Signed-off-by: Sanjeev Bagewadi sanjeev.bagewadi@gmail.com

Description

If fault injection is enabled, the ZIO_FLAG_IO_RETRY could be set by
zio_handle_device_injection() to generate the FMA events and update
stats. Hence, ignore the flag and process such zios.

A better fix would be to add another flag in the zio_t to indicate
that the zio is failed because of a zinject rule. However, considering the
fact that we do this in debug bits, we could do with the crude check using the
global flag zio_injection_enabled which is set to 1 when zinject records are added.

Motivation and Context

If zinject faults are enabled, it fails the ZIOs and adds the ZIO_FLAG_IO_RETRY flag to ensure that FMA events are raised. And we could have ZIOs with ZIO_FLAG_IO_ALLOCATING enabled. However, for such IOs in the zio_done() when zio_dva_throttle_done() we hit the ASSERT() for ZIO_FLAG_IO_RETRY. We could apply the ASSERT() only if zinject is not enabled.

How Has This Been Tested?

Ran internal tests which do the following :

  • zinject -a -d /dev/sdad -e io testpool -T all
  • Generate IO to the testpool (by issuing some writes e.g.: cp -R /usr/lib /testpool/dir1)

Without the fix this would have resulted in a panic (one-debug builds). Ensured that with the fix no panic was seen.

NOTE : The cp command ensures that we have ALLOCATING ZIOs generated.

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.

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.

Nice find, and thanks for the patch.

In addition to the inline comments there's a tiny typo in the commit message, s/donot/do not/. When you refresh this please go ahead and rebase it on master, and before you push it run make check locally and fix any style issues.

module/zfs/zio.c Outdated
* fact that we do this in debug bits, we could do with the crude check
* of zio_injection_enabled.
*/
ASSERT(zio_injection_enabled || !(zio->io_flags & ZIO_FLAG_IO_RETRY));
ASSERT(!(zio->io_flags & (ZIO_FLAG_IO_REPAIR | ZIO_FLAG_IO_RETRY)));
Copy link
Contributor

Choose a reason for hiding this comment

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

You're going to want to remove ZIO_FLAG_IO_RETRY from this line otherwise you'll still hit the ASSERT.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops... missed that out.

module/zfs/zio.c Outdated
* that the zio is failed because of a zinject rule. Considering the
* fact that we do this in debug bits, we could do with the crude check
* of zio_injection_enabled.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally I'm all for detailed comments but this one really breaks up the flow of this function. Since the updated ASSERTs are largely self explanatory I think it'd be OK to simply adding this information to the commit message and remove it from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Let me clean that up.

@sanjeevbagewadi
Copy link
Contributor Author

sanjeevbagewadi commented Aug 10, 2017

Thank you for the review Brian ! Updated the fix. I am still ramping up on github usage so might end up making some mistakes :-)

@behlendorf
Copy link
Contributor

@sanjeevbagewadi no problem. The updated version looks good. If you can squash these two commit and then git rebase them on the current master that should resolve the build and test failures. You'll need to force update the branch on Github which is fine.

zinject enables ZIO_FLAG_IO_RETRY to ensure FMA events are generated.
Allow such ZIOs in zio_dva_throttle_done() and do not fail the ASSERT()
for ZIO_FLAG_IO_RETRY.

Signed-off-by: Sanjeev Bagewadi <sanjeev.bagewadi@gmail.com>
@behlendorf behlendorf merged commit 21df134 into openzfs:master Aug 10, 2017
@behlendorf behlendorf added this to TODO in 0.7.2 Aug 14, 2017
tonyhutter pushed a commit that referenced this pull request Aug 22, 2017
If fault injection is enabled, the ZIO_FLAG_IO_RETRY could be set by
zio_handle_device_injection() to generate the FMA events and update
stats. Hence, ignore the flag and process such zios.

A better fix would be to add another flag in the zio_t to indicate that
the zio is failed because of a zinject rule. However, considering the
fact that we do this in debug bits, we could do with the crude check
using the global flag zio_injection_enabled which is set to 1 when
zinject records are added.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Sanjeev Bagewadi <sanjeev.bagewadi@gmail.com>
Closes #6383 
Closes #6384
@tonyhutter tonyhutter moved this from TODO to Done in 0.7.2 Aug 22, 2017
Fabian-Gruenbichler pushed a commit to Fabian-Gruenbichler/zfs that referenced this pull request Sep 29, 2017
If fault injection is enabled, the ZIO_FLAG_IO_RETRY could be set by
zio_handle_device_injection() to generate the FMA events and update
stats. Hence, ignore the flag and process such zios.

A better fix would be to add another flag in the zio_t to indicate that
the zio is failed because of a zinject rule. However, considering the
fact that we do this in debug bits, we could do with the crude check
using the global flag zio_injection_enabled which is set to 1 when
zinject records are added.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Sanjeev Bagewadi <sanjeev.bagewadi@gmail.com>
Closes openzfs#6383 
Closes openzfs#6384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.7.2
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants