From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F19C4332F for ; Mon, 14 Nov 2022 12:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237572AbiKNM7u (ORCPT ); Mon, 14 Nov 2022 07:59:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237638AbiKNM7t (ORCPT ); Mon, 14 Nov 2022 07:59:49 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5F627B10 for ; Mon, 14 Nov 2022 04:59:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1422ACE0FF9 for ; Mon, 14 Nov 2022 12:59:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A945C4314E; Mon, 14 Nov 2022 12:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1668430785; bh=Z+rTfa/AtkrF/BI6MXsGhMOYDsUY3XTy539dXb1YD50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zDbDo0TxujwUhCTc5ra/XkbGEbGyzVYToM52WklCad7bpsm2AmHm1ozzA5Hu/M1zR XkLzDs0w3DkLGi/AiejouPyHLnZm4kmCyPLS21jhII/IoEOPanor+k0C6MSz0RvcIA fmcJKLitgDo+o8UhjRzu7+1AC/9+PXwjaACP6Msc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shinichiro Kawasaki , Christoph Hellwig , "Martin K. Petersen" , Damien Le Moal Subject: [PATCH 5.15 097/131] ata: libata-scsi: fix SYNCHRONIZE CACHE (16) command failure Date: Mon, 14 Nov 2022 13:46:06 +0100 Message-Id: <20221114124452.823975965@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114124448.729235104@linuxfoundation.org> References: <20221114124448.729235104@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Shin'ichiro Kawasaki commit ea045fd344cb15c164e9ffc8b8cffb6883df8475 upstream. SAT SCSI/ATA Translation specification requires SCSI SYNCHRONIZE CACHE (10) and (16) commands both shall be translated to ATA flush command. Also, ZBC Zoned Block Commands specification mandates SYNCHRONIZE CACHE (16) command support. However, libata translates only SYNCHRONIZE CACHE (10). This results in SYNCHRONIZE CACHE (16) command failures on SATA drives and then libata translation does not conform to ZBC. To avoid the failure, add support for SYNCHRONIZE CACHE (16). Signed-off-by: Shin'ichiro Kawasaki Cc: stable@vger.kernel.org Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman --- drivers/ata/libata-scsi.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3259,6 +3259,7 @@ static unsigned int ata_scsiop_maint_in( case REPORT_LUNS: case REQUEST_SENSE: case SYNCHRONIZE_CACHE: + case SYNCHRONIZE_CACHE_16: case REZERO_UNIT: case SEEK_6: case SEEK_10: @@ -3925,6 +3926,7 @@ static inline ata_xlat_func_t ata_get_xl return ata_scsi_write_same_xlat; case SYNCHRONIZE_CACHE: + case SYNCHRONIZE_CACHE_16: if (ata_try_flush_cache(dev)) return ata_scsi_flush_xlat; break; @@ -4170,6 +4172,7 @@ void ata_scsi_simulate(struct ata_device * turning this into a no-op. */ case SYNCHRONIZE_CACHE: + case SYNCHRONIZE_CACHE_16: fallthrough; /* no-op's, complete with success */