Project

General

Profile

Bug #9793

vioblk attach doesn't always fail when it should

Added by Hans Rosenfeld about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
-
Start date:
2018-09-04
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage

Description

The attach function in vioblk is quite broken w.r.t. the error code it returns. On error (but not success) it will return 'ret', which defaults to DDI_SUCCESS and is set to DDI_FAILURE (or any other value indicating failure) in some places. Of course it doesn't always set it to DDI_FAILURE, like when interrupt allocation fails. This means vioblk will attach despite attach() failing, leaving the driver in an unitialized state and causing issues on detach() and quiesce().

History

#1

Updated by Hans Rosenfeld about 1 year ago

Testing: I ran this on bhyve. With just the fix for 9790 (but not 9792) attach would no longer panic, but also wouldn't return failure despite not being able to get interrupts. This half-attached state in turn would cause a panic when rebooting in vioblk_quiesce(). With this change on top of 9790 it will properly fail the attach and nothing unexpected happens when rebooting.

#2

Updated by Electric Monk about 1 year ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit d48defc5a82c2bc955d3c8c9a5a3c7ccea87d5d4

commit  d48defc5a82c2bc955d3c8c9a5a3c7ccea87d5d4
Author: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Date:   2018-09-26T19:30:14.000Z

    9793 vioblk attach doesn't always fail when it should
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Andy Fiddaman <omnios@citrus-it.net>
    Approved by: Garrett D'Amore <garrett@damore.org>

Also available in: Atom PDF