mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
cam/da: Only mark pack as valid if we know the size in daopen
Only mark the pack as 'valid' (eg clear the invalid bit) when we know the size of the underlying drive and the periph hasn't been invalidated. Previously, we'd unconditionally clear this bit, but if the size isn't known, no I/O to the drive is possible. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D48688
This commit is contained in:
parent
c2de0116c8
commit
82fc49a0be
1 changed files with 9 additions and 2 deletions
|
|
@ -1803,10 +1803,17 @@ daopen(struct disk *dp)
|
|||
(softc->quirks & DA_Q_NO_PREVENT) == 0)
|
||||
daprevent(periph, PR_PREVENT);
|
||||
|
||||
if (error == 0) {
|
||||
/*
|
||||
* Only 'validate' the pack if the media size is non-zero and the
|
||||
* underlying peripheral isn't invalid (the only error != 0 path).
|
||||
*/
|
||||
if (error == 0 && softc->params.sectors != 0)
|
||||
softc->flags &= ~DA_FLAG_PACK_INVALID;
|
||||
else
|
||||
softc->flags |= DA_FLAG_PACK_INVALID;
|
||||
|
||||
if (error == 0)
|
||||
softc->flags |= DA_FLAG_OPEN;
|
||||
}
|
||||
|
||||
da_periph_unhold(periph, DA_REF_OPEN_HOLD);
|
||||
cam_periph_unlock(periph);
|
||||
|
|
|
|||
Loading…
Reference in a new issue