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

zvol: ensure device minors are properly cleaned up #16364

Closed
wants to merge 4 commits into from

Commits on Jul 26, 2024

  1. zvol_impl: document and tidy flags

    ZVOL_DUMPIFIED is a vestigial Solaris leftover, and not used anywhere.
    
    Sponsored-by: Klara, Inc.
    Sponsored-by: Wasabi Technology, Inc.
    Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
    robn committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    0ec67e8 View commit details
    Browse the repository at this point in the history
  2. linux/zvol_os: fix SET_ERROR with negative return codes

    SET_ERROR is our facility for tracking errors internally. The negation
    is to match the what the kernel expects from us. Thus, the negation
    should happen outside of the SET_ERROR.
    
    Sponsored-by: Klara, Inc.
    Sponsored-by: Wasabi Technology, Inc.
    Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
    robn committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    57ba542 View commit details
    Browse the repository at this point in the history
  3. zvol: ensure device minors are properly cleaned up

    Currently, if a minor is in use when we try to remove it, we'll skip it
    and never come back to it again. Since the zvol state is hung off the
    minor in the kernel, this can get us into weird situations if something
    tries to use it after the removal fails. It's even worse at pool export,
    as there's now a vestigial zvol state with no pool under it. It's
    weirder again if the pool is subsequently reimported, as the zvol code
    (reasonably) assumes the zvol state has been properly setup, when it's
    actually left over from the previous import of the pool.
    
    This commit attempts to tackle that by setting a flag on the zvol if its
    minor can't be removed, and then checking that flag when a request is
    made and rejecting it, thus stopping new work coming in.
    
    The flag also causes a condvar to be signaled when the last client
    finishes. For the case where a single minor is being removed (eg
    changing volmode), it will wait for this signal before proceeding.
    Meanwhile, when removing all minors, a background task is created for
    each minor that couldn't be removed on the spot, and those tasks then
    wake and clean up.
    
    Since any new tasks are queued on to the pool's spa_zvol_taskq,
    spa_export_common() will continue to wait at export until all minors are
    removed.
    
    Sponsored-by: Klara, Inc.
    Sponsored-by: Wasabi Technology, Inc.
    Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
    robn committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    1fa03c6 View commit details
    Browse the repository at this point in the history
  4. ZTS: remove skips for zvol_misc tests

    Last commit should fix the underlying problem, so these should be
    passing reliably again.
    
    Sponsored-by: Klara, Inc.
    Sponsored-by: Wasabi Technology, Inc.
    Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
    robn committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    a4d1756 View commit details
    Browse the repository at this point in the history