mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Nicolai Stange <nicstange@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Jens Axboe <axboe@kernel.dk>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	Shaun Tancheff <shaun.tancheff@seagate.com>,
	Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>,
	Christoph Hellwig <hch@infradead.org>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sd: make ->no_write_same independent of reported ->max_ws_blocks
Date: Wed, 07 Dec 2016 19:18:31 -0500	[thread overview]
Message-ID: <yq1lgvrqnmw.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <87lgvteaz0.fsf@gmail.com> (Nicolai Stange's message of "Tue, 06 Dec 2016 09:08:19 +0100")

>>>>> "Nicolai" == Nicolai Stange <nicstange@gmail.com> writes:

Nicolai,

Nicolai> 1.) Do these older SCSI devices have a way to report
Nicolai>     ->max_ws_blocks?

I'm afraid not.

Nicolai> 3.) Those older devices that have ->max_ws_blocks >
Nicolai>     SD_MAX_WS10_BLOCKS but ->ws16 == ->ws10 == 0, i.e. the
Nicolai>     heuristicated ones would always be given WRITE_SAME, not
Nicolai>     WRITE_SAME_16 commands?  C.f. sd_setup_write_same_cmnd():
Nicolai>     if ->ws16 is not set, do WRITE_SAME. Isn't this a little
Nicolai>     bit odd given that the reported -> max_ws_blocks would be
Nicolai>     greater than SD_MAX_WS10_BLOCKS?

The check looks confusing because it caps the number of blocks to 0xFFFF
(the WRITE SAME(10) limit) for WRITE SAME(16) commands. Several older
devices accept the 16-byte command which allows for a bigger block range
but they only actually check the lower two bytes. This will cause data
corruption as parts of a block range may not be zeroed as requested.

FWIW, I'm in agreement with your patch to disable write same in libata
as a quick fix for 4.9.

-- 
Martin K. Petersen	Oracle Linux Engineering

      reply	other threads:[~2016-12-08  0:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 23:56 Nicolai Stange
2016-12-06  3:29 ` Martin K. Petersen
2016-12-06  8:08   ` Nicolai Stange
2016-12-08  0:18     ` Martin K. Petersen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yq1lgvrqnmw.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=chaitanya.kulkarni@hgst.com \
    --cc=hch@infradead.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nicstange@gmail.com \
    --cc=shaun.tancheff@seagate.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®