Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Nov 2019 14:32:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        scsi@FreeBSD.org
Subject:   [Bug 219857] panic in scsi_cd code
Message-ID:  <bug-219857-5313-SafFPMFi4q@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-219857-5313@https.bugs.freebsd.org/bugzilla/>
References:  <bug-219857-5313@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D219857

Leandro Lupori <leandro.lupori@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |leandro.lupori@gmail.com

--- Comment #28 from Leandro Lupori <leandro.lupori@gmail.com> ---
I was able to reproduce the problem described in comment#14.

Actually, I wasn't trying to reproduce it, I just started seeing it a few w=
eeks
ago, in CURRENT.

I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a
single core/thread (-smp 1).

It happens only when there is no media in the emulated CD-ROM, a device that
QEMU adds by default, unless -nodefaults is specified in command line.

I've debugged it and this is what I've found:

1- After the CD probe is successful, GEOM will try to open the device, which
will end up calling cdcheckmedia(), that sets CD state to
CD_STATE_MEDIA_PREVENT.
2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED f=
lag
is set and CD state moves to CD_STATE_MEDIA_SIZE.
3- Next, scsi_read_capacity() is executed and fails, state is set to
CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up cdcheckmedi=
a().
4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it first
checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to
CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering=
 an
infinite MEDIA_SIZE command loop.

When there is a least another core/thread, the GEOM thread that performed t=
he
initial cdopen() will get scheduled again, closing the CD device, that will
call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and breaks
the loop.

So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when
CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the st=
ate
should be advanced to CD_STATE_MEDIA size only when the current state is
CD_STATE_MEDIA_PREVENT.

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-219857-5313-SafFPMFi4q>