History log of /freebsd/sys/cam/scsi/scsi_cd.c (Results 1 – 25 of 399)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 80d0d161 08-Feb-2025 Warner Losh <imp@FreeBSD.org>

cam/cd: The SAW_MEDIA flag duplicates VALID_MEDIA

This change mirrors what we do in da. Use only the VALID_MEDIA
flag. SAW_MEDIA was just used in one place. Transition to using
similar technique to

cam/cd: The SAW_MEDIA flag duplicates VALID_MEDIA

This change mirrors what we do in da. Use only the VALID_MEDIA
flag. SAW_MEDIA was just used in one place. Transition to using
similar technique to what da uses for valid media.

We seem to handle media being ejected while we're doing I/O correctly,
both with prevent-allow and without (though the former threw some
vendor-specific errors before returning seek errors). I could only test
USB attached DVD (over ATAPI over BULK). I couldn't test it with SCSI CD
attachment, sata attached CD nor parallel ATA attached CDs because I
no longer have any of that hardware.

Differential Revision: https://reviews.freebsd.org/D48841
Sponsored by: Netflix

show more ...


# 25105fa0 06-Feb-2025 Warner Losh <imp@FreeBSD.org>

cam/cd: Simplify to remove invalid flag

cdoninvalidate set the CD_FLAG_INVALID flag. However, the periph's
invalid flag is set before that routine is called, so it's always set
when CD_FLAG_INVALID

cam/cd: Simplify to remove invalid flag

cdoninvalidate set the CD_FLAG_INVALID flag. However, the periph's
invalid flag is set before that routine is called, so it's always set
when CD_FLAG_INVALID is set. It's therefore redundant.

The code in strategy can be simplified by checking the periph's
CAM_PERIPH_INVALID flag. Since this is a locked access, they will
always be the same.

The check in cdopen is currently redundant because both
cam_periph_acquire and cam_periph_hold will return an error when
CAM_PERIPH_INVALID is set, the former being unlocked, the latter being
locked (to catch the race, but in this case the race doesn't matter).

Since these are the only places we use this flag, we can simplfy the
code by removing it entirely and changing cdstreategy slightly.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D48840

show more ...


Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3
# 0eacc5c4 27-Jan-2025 Warner Losh <imp@FreeBSD.org>

cam/cd: Add comments about ASC/ASCQ codes

I added these comments to da a while ago, and they seem good.

Sponsored by: Netflix


Revision tags: release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0
# 0c0ec5c8 21-Jan-2024 Mark Johnston <markj@FreeBSD.org>

scsi_cd: Remove commented-out code

This is left over from before the implementation of asynchronous media
probing, which was committed in dd78f43259ef
("scsi_cd: make the media check asynchronous")

scsi_cd: Remove commented-out code

This is left over from before the implementation of asynchronous media
probing, which was committed in dd78f43259ef
("scsi_cd: make the media check asynchronous") quite a while ago now.

No functional change intended.

MFC after: 1 week
Reviewed by: imp, avg
Differential Revision: https://reviews.freebsd.org/D43650

show more ...


# c961afe8 30-Jan-2024 Mark Johnston <markj@FreeBSD.org>

scsi_cd: Maintain a periph reference during media checks

Otherwise nothing prevents the asynchronous media check state machine
from running after the periph has been destroyed, which can result in a

scsi_cd: Maintain a periph reference during media checks

Otherwise nothing prevents the asynchronous media check state machine
from running after the periph has been destroyed, which can result in a
double free. Acquire the reference even when performing a synchronous
check, since that doesn't hurt and keeps things simpler.

PR: 276251
Reviewed by: imp
Fixes: dd78f43259ef ("scsi_cd: make the media check asynchronous")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43525

show more ...


# b1710124 30-Jan-2024 Mark Johnston <markj@FreeBSD.org>

scsi_cd: Use a bool for the second parameter of cdcheckmedia()

No functional change intended.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43525


Revision tags: release/14.0.0
# 2ffd30f7 06-Nov-2023 Warner Losh <imp@FreeBSD.org>

cam: Remove left-over sys/cdefs.h in sys/cam

These weren't removed when $FreeBSD$ was removed. They aren't needed and
now are a style(9) nonconformity.

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 7c5d20a6 25-Jul-2023 Warner Losh <imp@FreeBSD.org>

cam/scsi: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


Revision tags: release/13.2.0, release/12.4.0
# 90bcc81b 14-Jul-2022 Alexander Motin <mav@FreeBSD.org>

Delay GEOM disk_create() until CAM periph probe completes.

Before this patch CAM periph drivers called both disk_alloc() and
disk_create() same time on periph creation. But then prevented disks
fro

Delay GEOM disk_create() until CAM periph probe completes.

Before this patch CAM periph drivers called both disk_alloc() and
disk_create() same time on periph creation. But then prevented disks
from opening until the periph probe completion with cam_periph_hold().
As result, especially if disk misbehaves during the probe, GEOM event
thread, triggered to taste the disk, got blocked on open attempt,
potentially for a long time, unable to process other events.

This patch moves disk_create() call from periph creation to the end of
the probe. To allow disk_create() calls from non-sleepable CAM contexts
some of its duties requiring memory allocations are moved either back
to disk_alloc() or forward to g_disk_create(), so now disk_alloc() and
disk_add_alias() are the only disk methods that require sleeping. If
disk fails during the probe disk_create() may just be skipped, going
directly to disk_destroy(). Other method calls during that time are
just ignored. Since GEOM may now see the disks after CAM bus scan is
already completed, introduce per-periph boot hold functions. Enclosure
driver already had such mechanism, so just generalize it.

Reviewed by: imp
MFC after: 1 month
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D35784

show more ...


# 31d1b816 28-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

sysent: Get rid of bogus sys/sysent.h include.

Where appropriate hide sysent.h under proper condition.

MFC after: 2 weeks


Revision tags: release/13.1.0
# 0e5c50bf 07-Jan-2022 Alexander Motin <mav@FreeBSD.org>

cam: Relax callouts precisions.

On large systems even relatively rare callouts may fire many times
per second. This should allow them to aggregate better, since we do
not require any precision when

cam: Relax callouts precisions.

On large systems even relatively rare callouts may fire many times
per second. This should allow them to aggregate better, since we do
not require any precision when polling for media change, etc.

MFC after: 2 weeks

show more ...


Revision tags: release/12.3.0
# 6637b746 24-Nov-2021 Warner Losh <imp@FreeBSD.org>

cam: Remove all the write-only variables

Delete all the write only variables in CAM. At worst, the only behavior
change would be to prevent core dumps from chasing NULL pointers (though
I think in a

cam: Remove all the write-only variables

Delete all the write only variables in CAM. At worst, the only behavior
change would be to prevent core dumps from chasing NULL pointers (though
I think in all these cases the pointers can't be NULL).

Sponsored by: Netflix

show more ...


# 6afabf00 03-Nov-2021 Mark Johnston <markj@FreeBSD.org>

scsi_cd: Improve TOC access validation

1. During CD probing, we read the TOC header to find the number of
entries, then read the TOC itself. The header determines the number
of entries, which

scsi_cd: Improve TOC access validation

1. During CD probing, we read the TOC header to find the number of
entries, then read the TOC itself. The header determines the number
of entries, which determines the amount of data to read from the
device into the softc in the CD_STATE_MEDIA_TOC_FULL state. We
hard-code a limit of 99 tracks (plus one for the lead-out) in the
softc, but were not validating that the size reported by the media
would fit in this hard-coded limit. Kernel memory corruption could
occur if not.[1] Add validation to check this, and refuse to cache
the TOC if it would not fit.

2. The CDIOCPLAYTRACKS ioctl uses caller provided track numbers to index
into the TOC, but we only validate the starting index. Add
validation of the ending index.

Also, raise the hard-coded limit from 100 tracks to 170, per a
suggestion from Ken.

Reported by: C Turt <ecturt@gmail.com> [1]
Reviewed by: ken, avg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32803

show more ...


# e7678690 13-Sep-2021 Alexander Motin <mav@FreeBSD.org>

Fix data race in scsi cd driver.

There is a data race between cdsysctlinit and cdcheckmedia. Both
functions change softc->flags without synchronization.

Submitted by: Arseny Smalyuk <smalukav@gmai

Fix data race in scsi cd driver.

There is a data race between cdsysctlinit and cdcheckmedia. Both
functions change softc->flags without synchronization.

Submitted by: Arseny Smalyuk <smalukav@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31726

show more ...


# 303477d3 11-Aug-2021 Alexander Motin <mav@FreeBSD.org>

cam(4): Mark all sysctls as CTLFLAG_MPSAFE.

This code does not use Giant lock for very long time.

MFC after: 2 weeks


# a081a943 06-Jul-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

cam: drop unused 'saved_ccb' field from softcs

No functional changes. Do not MFC this, it changes kernel ABI.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://re

cam: drop unused 'saved_ccb' field from softcs

No functional changes. Do not MFC this, it changes kernel ABI.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30698

show more ...


# ec5325db 10-Apr-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

cam: make sure to clear even more CCBs allocated on the stack

This is my second pass, this time over all of CAM except
for the SCSI target bits. There should be no functional
changes.

Reviewed By:

cam: make sure to clear even more CCBs allocated on the stack

This is my second pass, this time over all of CAM except
for the SCSI target bits. There should be no functional
changes.

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D29549

show more ...


Revision tags: release/13.0.0
# cd853791 28-Nov-2020 Konstantin Belousov <kib@FreeBSD.org>

Make MAXPHYS tunable. Bump MAXPHYS to 1M.

Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pag

Make MAXPHYS tunable. Bump MAXPHYS to 1M.

Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*). Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.

Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys. Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight. Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.

Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.

Suggested by: mav (*)
Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27225

show more ...


Revision tags: release/12.2.0
# 27dcd3d9 02-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

cam: clean up empty lines in .c and .h files


Revision tags: release/11.4.0
# 75dfc66c 27-Feb-2020 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r358269 through r358399.


# 7029da5c 26-Feb-2020 Pawel Biernacki <kaktus@FreeBSD.org>

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly mark

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718

show more ...


# bc02c18c 07-Feb-2020 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r357408 through r357661.


# d176b803 07-Feb-2020 Scott Long <scottl@FreeBSD.org>

Ever since the block layer expanded its command syntax beyond just
BIO_READ and BIO_WRITE, we've handled this expanded syntax poorly in
drivers when the driver doesn't support a particular command.

Ever since the block layer expanded its command syntax beyond just
BIO_READ and BIO_WRITE, we've handled this expanded syntax poorly in
drivers when the driver doesn't support a particular command. Do a
sweep and fix that.

Reported by: imp

show more ...


12345678910>>...16