From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934108AbcLHATH (ORCPT ); Wed, 7 Dec 2016 19:19:07 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:46451 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932661AbcLHATF (ORCPT ); Wed, 7 Dec 2016 19:19:05 -0500 To: Nicolai Stange Cc: "Martin K. Petersen" , Jens Axboe , "James E.J. Bottomley" , Shaun Tancheff , Chaitanya Kulkarni , Christoph Hellwig , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sd: make ->no_write_same independent of reported ->max_ws_blocks From: "Martin K. Petersen" Organization: Oracle Corporation References: <20161205235638.11539-1-nicstange@gmail.com> <87lgvteaz0.fsf@gmail.com> Date: Wed, 07 Dec 2016 19:18:31 -0500 In-Reply-To: <87lgvteaz0.fsf@gmail.com> (Nicolai Stange's message of "Tue, 06 Dec 2016 09:08:19 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>>> "Nicolai" == Nicolai Stange 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