Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp360790pxb; Wed, 14 Apr 2021 17:50:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKQ7uiAvNYT/NnQN7xkoyYJJcc22oZR3ArckHoUV1U2+5RXj2fnj06VL5vyeKju8xN5FQg X-Received: by 2002:a05:6402:438f:: with SMTP id o15mr1014886edc.123.1618447829409; Wed, 14 Apr 2021 17:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618447829; cv=none; d=google.com; s=arc-20160816; b=Ovy1e1FugCB3jw3pywu1KaG8KdOu2yt8PuH+Za/jT97EHYCThqJzC1aSI85TAiM3zI 8Ew3E/WG0NxrUNtyy5jg8IdopOLsMJ5WBWMYWnAl5hhRkIpRPOtwUcBBnQYesBDmCw/1 LU6NAlxuC/MtGwLRCl/WfRr8TcZlXxVhrPwXAX5IeEs7HygMRj2Bkj0UXyw01KYVisU3 5foRIBlMjlNO9iKdVuk7eRSkufrKjuRVOOh4lx4N0Rv3L+q0zHgxCuZu3p/CcQSE74wy TCNDaM+Aacw6XPcqXsmNEFsT92ddXWHfzF2ZcW/J65DU4qkjn1ywsawd7LaO9VLNaDZV 0izQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=Puh9IDL0NsNawU03sxt9ET08rbbRmGsOacW5Ojpozhc=; b=q2/G8rbd0YsiCflWeK0mEQpwx+ppkXpP2wfUkvD04VcP3YVEnJFhKISjAgUO6UAe/o gLoFBEb7/R5D2kxq7+Ql0ZUwfDI7h86LcWjdDfL4F3hi9uxXFlo/muhc6A2KBsDUvjlN wyELgF+63bO+JELghKaS/WLulNGeIC+TyCKiR5Zl8WIBLEKGugkwqqoZ3m9qovUKm95J 47WMvLKZuIthXg66PYJMZmj8r+D7OhsuAq2GzaWBZ2zqqlDcT3xum9hknlaqLjff/+D6 SkxJ2hq7nB3sWap00151BJDcNNfUmDWf5N1HHtGIu/f5zCZxLpGfUcGJUKV654EM4muz 4LPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si990090edd.288.2021.04.14.17.50.06; Wed, 14 Apr 2021 17:50:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236670AbhDNWkA (ORCPT + 99 others); Wed, 14 Apr 2021 18:40:00 -0400 Received: from angie.orcam.me.uk ([157.25.102.26]:38968 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234976AbhDNWjw (ORCPT ); Wed, 14 Apr 2021 18:39:52 -0400 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 059899200B3; Thu, 15 Apr 2021 00:39:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 01F2A92009D; Thu, 15 Apr 2021 00:39:28 +0200 (CEST) Date: Thu, 15 Apr 2021 00:39:28 +0200 (CEST) From: "Maciej W. Rozycki" To: Nix , Khalid Aziz , "James E.J. Bottomley" , "Martin K. Petersen" cc: Bernd Schubert , Christoph Hellwig , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] scsi: Set allocation length to 255 for ATA Information VPD page In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the allocation length to 255 for the ATA Information VPD page requested in the WRITE SAME handler, so as not to limit information examined by `scsi_get_vpd_page' in the supported vital product data pages unnecessarily. Originally it was thought that Areca hardware may have issues with a valid allocation length supplied for a VPD inquiry, however older SCSI standard revisions[1] consider 255 the maximum length allowed and what has later become the high order byte is considered reserved and must be zero with the INQUIRY command. Therefore it was unnecessary to reduce the amount of data requested from 512 as far down as to 64, arbitrarily chosen, and 255 would as well do. With commit b3ae8780b429 ("[SCSI] Add EVPD page 0x83 and 0x80 to sysfs") we have since got the SCSI_VPD_PG_LEN macro, so use that instead. References: [1] "Information technology - Small Computer System Interface - 2", WORKING DRAFT, X3T9.2, Project 375D, Revision 10L, 7-SEP-93, Section 8.2.5 "INQUIRY command", pp.104-108 Signed-off-by: Maciej W. Rozycki Fixes: af73623f5f10 ("[SCSI] sd: Reduce buffer size for vpd request") --- Nix, I can see you're still around. Would you therefore please be so kind as to verify this change with your Areca hardware if you still have it? It looks to me like you were thinking in the right direction with: . Sadly nobody seemed to have paid attention to your observation and neither were different buffer sizes considered (or at least it wasn't mentioned in the discussion). Maciej --- drivers/scsi/sd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) linux-scsi-write-same-vpd-buffer.diff Index: linux-macro-ide/drivers/scsi/sd.c =================================================================== --- linux-macro-ide.orig/drivers/scsi/sd.c +++ linux-macro-ide/drivers/scsi/sd.c @@ -3076,16 +3076,13 @@ static void sd_read_write_same(struct sc } if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { - /* too large values might cause issues with arcmsr */ - int vpd_buf_len = 64; - sdev->no_report_opcodes = 1; /* Disable WRITE SAME if REPORT SUPPORTED OPERATION * CODES is unsupported and the device has an ATA * Information VPD page (SAT). */ - if (!scsi_get_vpd_page(sdev, 0x89, buffer, vpd_buf_len)) + if (!scsi_get_vpd_page(sdev, 0x89, buffer, SCSI_VPD_PG_LEN)) sdev->no_write_same = 1; }