Age | Commit message (Collapse) | Author |
|
ok deraadt@ krw@
|
|
|
|
Don't skip the cache flush until the last opening of the device is
closed. Otherwise, when umounting a writable partition while a different
partition is still mounted read-only, the necessary disk flush may be
delayed for a very long time.
ok krw@ deraadt@
|
|
Currently implemented for wd and sd.
Initially ported from netbsd by pedro@
ok deraadt@
|
|
history, nuke all mentions of XS_NO_CCB and the #define.
2006 - 2017. R.I.P.
ok kettenis@ inferred ok dlg@
|
|
the random subsystem as entropy. This value is pretty much unknown,
and anyways our entropy input ring does not saturate from knowns.
ok mikeb djm
|
|
special error handling in sdopen() as temporary hack.
OK krw@
|
|
is not dying.
OK krw@
|
|
device is already dying. Delete the sc_timeout when setting the
SDF_DYING flag as the timeout delete in sdclose() may not be reached.
OK krw@
|
|
use after free of the scsi link structure during detach.
OK krw@
|
|
'sc_link'. 'sc_link' is a field in the various device *_softc
structures, where the sc_ prefix was for 'softc'. Reduces potential
mental confusion. Newer code from down under was already using
'link'.
No functional change.
Prompted by bluhm@'s adventures in scsi. ok dlg@ jmatthew@
|
|
of a use after free. In sdopen() the scsi link pointer is taken
from the scsi disk struct. While the scsi disk memory is refcounted
by autoconf, the scsi link may be detached and freed during sleep.
The solution is to check wether the disk is dying after every sleep.
The SDF_DYING flag is set before scsi bus and scsi disk are detached,
so without this flag the link must be valid.
input and OK krw@
|
|
and sdminphys() if the scsi disk is dying. The memory of the link
may have been freed already.
OK krw@
|
|
everywhere. This is the first step to fix a use after free of the
sc_link when the disk detaches. If a function gets a scsi transfer,
the scsi link is always valid. Call this variable "link" consistently.
OK krw@
|
|
|
|
"sure" deraadt@
|
|
Pointed out by Kor son of Rynar (sic) when trying to test
some debug code.
ok matthew@
|
|
|
|
(ST373405FSUN72G) respond to a START STOP UNIT command that spins down the
disk with a "Logical Unit Not Ready, Initialization Command Required".
Besides causing some dmesg spam, our sd(4) driver responds to such a response
by spinning the disk back up. Prevent this from happening by respecting
the SCSI_IGNORE_NOT_READY flag and using that flag when spinning down the
disk.
ok miod@
|
|
ok mpi@ kspillner@
|
|
after discussions with beck deraadt kettenis.
|
|
DVACT_POWERDOWN is propagated in this subtree, there is no need for
this shutdown hook anymore. RIP.
ok kettenis@
|
|
driver re-probe for its capacity.
Allow to fully recognized Lexar JumpDrive S33 USB 3.0 sticks.
ok krw@, dlg@
|
|
dmesg, or write operations just fail with EACCES for no obvious reason
ok krw@ tedu@
|
|
variables. Some random whitespace/knf repairs encountered on the way.
ok miod@ on inspection, feedback & more suggestions from millert@
|
|
|
|
Ditto disksize field of sd_softc and a couple of local calculation
variables.
scsi/* now daddr_t clean except where they really are 512-byte
blocks.
|
|
Prefer DL_ macros over handrolling. Fix the loop to allow for bigger
(highly unlikely) bunches of bits to be broken up into rw_10 sized
(<= UINT32_MAX sectors) chunks. Add check to make sure i/o request
starts at a sector address.
|
|
repeated handrolling of same code. Use daddr_t variable to
calculate daddr_t return values, and u_int64_t variables to
calculate disk sector values.
No functional change.
|
|
test period; i think 3 years ago the last bugs fell out.
ok otto beck others
|
|
cache. This shouldn't interfere with the hibernate code and makes sure we
still flush the cache for controller that don't pass DVACT_POWRDOWN down to
their children yet. This will be removed when the autoconf subsystem gets
changed to do that for us by default.
ok deraadt@
|
|
as well, but it might be wise to flush before a hibernate operation, in
case hiberate looks at blocks which are in the buffer cache.
ok krw
|
|
paths are reflexive. It is now possible to fail part-way through a
suspend sequence, and recover along the resume code path.
Split DVACT_SUSPEND by adding a new DVACT_POWERDOWN method is used
after hibernate (and suspend too) to finish the job. Some drivers
must be converted at the same time to use this instead of shutdown hooks
(the others will follow at a later time)
ok kettenis mlarkin
|
|
The standards gpds are jealous gods. kettenis@ and beck@ have shown
EROFS is the wrong thing to return. So revert to EACCES until a
better error code is decided on.
|
|
is attempted. This is instead of the current EACCES and is intended
to result in better error messages from mount(8).
Tweak default EROFS error text to mention fsck'ing in mount_ext2fs
and mount_msdos since they both have fsck's like ffs.
ok deraadt@ aja@ ian@ phessler@
|
|
when b_error has not already been set to something more informative,
e.g. EROFS.
DO check the result of ffs_sbupdate() and error out of a mount()
call when ffs_sbupdate() reports EROFS while attempting a rw mount.
Letting RW mounts proceed regardless of EROFS led to crashes and
usb problems for Oliver Seufer while using the RW/RO switches on
some usb devices. Fix developed using devices kindly supplied by
Oliver & Co.
ok miod@
|
|
tested by dcoppa@, ok krw@, miod@
|
|
that caused large disks to appear offline.
Discovered and tested by mlarkin@; ok dlg@
|
|
|
|
to use the fifo bufq sorting on such disks. there's no point ordering io
if the real blocks arent in the order we think they are.
ok krw@ tedu@ miod@
|
|
required vpd pages, then read them for the values we want.
we look for the max blocks per unmap, the max descriptors per unmap, and
which scsi command to use for unmapping (unmap will be preferred).
two fixes and ok matthew@
|
|
the read cap 16 data. move the read cap code into sd.c so i can get
at this bit without much contorting, and to make it trivial to get
at the other interesting things in there later.
thin disks report themselves as "thin" in dmesg along with their
size now.
ok matthew@
|
|
that they're implemented consistently in bounds_check_with_label().
Also, per krw's request, change bounds_check_with_label() to return 0
if the checks succeed, and change the drivers to test == -1 instead of
<= 0. (Man page update to follow; intentionally omitting
arch/vax/mba/hp.c from this commit because it doesn't even build
currently and miod@ promises to kill it soon.)
ok krw@
|
|
that's ever used it, and it's long since been changed to use
DVACT_{QUIESCE,SUSPEND,RESUME} instead.
ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it
up a few weeks ago
|
|
subr_disk.c. For now just the MI disk drivers.
ok deraadt@, krw@; jsing@ liked the approach too
|
|
be interrupted.
ok matthew
|
|
rather than using various wrappings. Convert vnd to using the sc_dk
rwlock instead of using one of its own.
ok matthew
|
|
of silly flag twiddling code in various disk drivers.
ok deraadt@, miod@
N.B., users will need a -current disklabel(8) to be able to write new
disklabels to disk now.
|
|
never done anything in OpenBSD and just clutters disk drivers with
silly flag handling.
More cleanup to follow.
ok deraadt@, millert@; no objections krw@
|
|
to return EBUSY if the user tries to modify an open partition's offset
or size. Only sadness can result if a user tries this, and rejecting
it prevents a race between sdstart() and sdstrategy().
Curiously, there was already code in the kernel and in disklabel(8) to
detect/handle this, but it was effectively disabled because the disk
drivers always used something like "/* sc->sc_dk.dk_openmask */ 0",
and this commented out code has existed since even r1.1 in NetBSD.
I had no problems building a release and messing around with
disklabel(8) for a bit with this diff. Canarying the more common MI
disk drivers until we gain confidence that there aren't any
regressions, then we can switch the remaining drivers.
"I am surprised you got me convinced that this stuff is safe" deraadt@
ok krw@
|