Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1113319imm; Wed, 1 Aug 2018 10:23:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeycTnM/yfxkngE/VVwDLA014jSa+yFtR5YYcX/BT2GsOwZUGZfJ3cq1Hrl89qiYmQ7L/6Y X-Received: by 2002:a65:665a:: with SMTP id z26-v6mr24906780pgv.193.1533144231898; Wed, 01 Aug 2018 10:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144231; cv=none; d=google.com; s=arc-20160816; b=lLui/yf4mAo+GZsOd2dj0B83lpzF2NfoPhpT+Ayi6HbOVCh/1yJHP++WG/8Rx9hLbf j2g4qzX6IUBec3Jm5G1e0zqNk9BjRgJMSS70YtvlB1zaCy+Mr1Z7aemp9m7v+YraGyWg E9Z4IGjors65OLh/R3rJ2E2T+aJuaZkYZVRq1oxnKdsdp+UUtvarHX6tKaHo8O5IupSG W9sPEWxKpvJHfNA9cpY7TKS5Tv6jveYyfgdsvMGxznS9JVr0qCSutqeqiylr3x+C8vWT 3yeQi9JyjOwIgB63xFtm2vcyFaIOHgLZDm9YcrLAO1tjd8e+87svqiPie2lvKjvNWPyf dpoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=V5QfqByNiFY3oO+uzzbJWnv3lMY717cqXwii8BFx/Es=; b=qCp0Nv/LWYKVf4CPjo5Vy/EsdEnEOWVOlcbwBhXrRLlJpiNQtlO/WTDqis+F5q/tfY 7L8zTKwLmB2weSi5ABPGdF0WYki4BAarqcAXi3oYZKXFYzbDHZOUNqGfO1JvUUCzTxUc bvImnwdcvANJdMsHPCNj+alZeqZ+Bf63+6crLAoOUonwJ99rR13IF3M65vff1ITR0ufw thNAoQzJvJ5CJv7lc5KV443JcBg8/hW08R2jSM0bZc2xDp3g9f2UV3C7x67QQBdr2IHW fqXnszkrAJ3+wAo3x/ghdV/BlipcVv43MLDSifsBGFpUrmaB05huQxnzXhPAFJilrJbR uX1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15-v6si7392289pll.42.2018.08.01.10.23.37; Wed, 01 Aug 2018 10:23:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405537AbeHATIA (ORCPT + 99 others); Wed, 1 Aug 2018 15:08:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49324 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405529AbeHATIA (ORCPT ); Wed, 1 Aug 2018 15:08:00 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4B63CCC2; Wed, 1 Aug 2018 17:21:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damien Le Moal , Hannes Reinecke , Tejun Heo , Sasha Levin Subject: [PATCH 4.14 151/246] libata: Fix command retry decision Date: Wed, 1 Aug 2018 18:51:01 +0200 Message-Id: <20180801165018.968962165@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Damien Le Moal [ Upstream commit 804689ad2d9b66d0d3920b48cf05881049d44589 ] For failed commands with valid sense data (e.g. NCQ commands), scsi_check_sense() is used in ata_analyze_tf() to determine if the command can be retried. In such case, rely on this decision and ignore the command error mask based decision done in ata_worth_retry(). This fixes useless retries of commands such as unaligned writes on zoned disks (TYPE_ZAC). Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/ata/libata-eh.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2217,12 +2217,16 @@ static void ata_eh_link_autopsy(struct a if (qc->err_mask & ~AC_ERR_OTHER) qc->err_mask &= ~AC_ERR_OTHER; - /* SENSE_VALID trumps dev/unknown error and revalidation */ + /* + * SENSE_VALID trumps dev/unknown error and revalidation. Upper + * layers will determine whether the command is worth retrying + * based on the sense data and device class/type. Otherwise, + * determine directly if the command is worth retrying using its + * error mask and flags. + */ if (qc->flags & ATA_QCFLAG_SENSE_VALID) qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); - - /* determine whether the command is worth retrying */ - if (ata_eh_worth_retry(qc)) + else if (ata_eh_worth_retry(qc)) qc->flags |= ATA_QCFLAG_RETRY; /* accumulate error info */