Thread (16 messages) 16 messages, 3 authors, 2021-03-01

Re: [PATCH RESEND v2] scsi: ignore Synchronize Cache command failures to keep using drives not supporting it

From: Damien Le Moal <hidden>
Date: 2021-03-01 12:58:21

On 2021/03/01 21:52, Guido Trentalancia wrote:
On Mon, 01/03/2021 at 12.42 +0000, Damien Le Moal wrote:
quoted
I checked the standards again. It turns out that SYNCHRONIZE CACHE
command is
optional in SBC... Aouch. Got so used to have that one on any drive
that I
thought it was mandatory.

Well, it certainly is mandatory if the drive has a write cache, which
seems to
be the case for you.

The problem with your patch though is that you disable write caching
when you
see an ILLEGAL REQUEST/INVALID OPCODE termination of synchronize
cache. Which
means that the drive was already used, written too and the cache has
likely
dirty data and I do not see any method to guarantee that that data
makes it to
persistent media before shutdown. Imagine if that was the synchronize
cache sent
before shutdown.
As already said, I have tested the patch for over a year now and I have
never experienced the problem that you are foreseeing !
That may be true for your specific drive, but since we are in uncharted
(non-standard) territory here, we cannot say that this will hold for all such
weird drives out there.
The current alternative is data corruption each time that the drive is
mounted and the inability to use it.

So, the patch is the way forward for using such drives plug and play
without cumbersome configuration such as disabling the write cache,
which advanced users can always make.
quoted
So the only reasonable solution for such drive is to use it with
write cache
disabled from the start.
down.
It works well even with write caching enabled.

If you have an alternative patch to propose, go ahead otherwise I would
push for getting this merged and sorting out the issue for good.
As mentioned, the alternative is a udev rule to disable write cache. Or if the
drive supports that, permanently save WCE=0 setting in the drive config so that
it always come up with write cache disabled. No kernel patch needed, and you
will note that this is also exactly the same as what your patch does, without
waiting for an error.
Guido

-- 
Damien Le Moal
Western Digital Research
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help