Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp675178imu; Tue, 27 Nov 2018 19:53:51 -0800 (PST) X-Google-Smtp-Source: AJdET5fuy/NaLK6zpOqdXo1qtgWWrEus7q1s+wO2qkC3OlubPBAvUOaNKlNOY9ZM6naCzW/LXZ2Y X-Received: by 2002:a62:2781:: with SMTP id n123mr36431582pfn.138.1543377231491; Tue, 27 Nov 2018 19:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543377231; cv=none; d=google.com; s=arc-20160816; b=msvjmiIQg0TsT/ZR8cMQYGhBCvvLHWn97yh9qeX8jSXU0A8L6mSKrPM0VAbxrTMpub 7V6PE4gToEMzDefVaN8ZfQwKAg6Dn5GnkeRDmXeg37Hc+wIOwHcxJDCDIHN47/TRTN6i JdyUHBrzsIdUvoizP9/+queO/lOGrijaBjZh5iqRIYryv6FXu+aUsureuElp7cMmj1Cp cHhzctmgvTxn9wqcsJHeMj7lBA3kv7NFeh5tSolimvfnRVm5lvoHDm6JOtQzJGMXYRdx 9Wfu3bcNk87+b+V+ekRMoSDmxR9/0a3GoWZxVXdjHEGehY7mCApXw3CwnsHH8UYGf3bB 3PTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=XtkBsCEZFJUmXzaORwxd3Muknk5RrVpgR0APvnd2NTc=; b=eyy1VNojkwVEioaVqp14ioCcOzmDp4Wr2HJcyrx1q7yER0nbIjMyKwL8exhfh8ZCvb D8AZxYcCr+T3/j75zQ+weCHybzaUWPgVUYTE5hr5d+744B32XVKTc/SVMB7zIC4JN9Wc 4hYnOzxDnviBwlZ4Mj8sDakH9sUNuXuCmwyOWIGgfoPzMKlOJbnc85rpFIGZEcVaZkKA E5BBRAfrDlXp/6tO6CbYF39ZkDjGTamxVWsdrca4rTUMGdfrY0O5emybEkDqaLCtXIlz ll84emXcgN6gTK5YDqDUtnCN6hXqxQ9d0jGqS+x55k4mElkuxOWkPKXCw2GBKybtkiIt c2mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="DSFs/n4W"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si5176879pgi.99.2018.11.27.19.53.36; Tue, 27 Nov 2018 19:53:51 -0800 (PST) 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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="DSFs/n4W"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727451AbeK1Owp (ORCPT + 99 others); Wed, 28 Nov 2018 09:52:45 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:52266 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbeK1Owo (ORCPT ); Wed, 28 Nov 2018 09:52:44 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3mX89192793; Wed, 28 Nov 2018 03:52:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=XtkBsCEZFJUmXzaORwxd3Muknk5RrVpgR0APvnd2NTc=; b=DSFs/n4WZFSn1e4rsGgZeCNcAx5Rk7PvJRqZDf0L4DbKO/eHsYnAVPDmpxfVRcnRIROg /rxUq5J1uNcZzOAME4SAQsm8O5URuA4zv32+TX/gMpveNCK2IQ36hHX0H2Ts5kigGWB5 kfjTTRCxq1A3CVI7dYJw2hBesJQaiTufM0Bxhq10JoljqoB4RCIcLgEQpjmIjAdDxJFL cU7psklDYWs5YYYBkjx9XNSUN/PeYjdi0fEJqNdzorkf7Umt27nsM5wfavfXEm4Df88t hr6oMZYvXypXRvDSqCMqACuYUn64X96Y/W6bAxdxwfaKbB+R4IpH2n3TnYblynf2iM5D vw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2nxxkqfrfr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:36 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qZEb009546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:35 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qZBs000579; Wed, 28 Nov 2018 03:52:35 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:34 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 5/7] xfs: Add device retry Date: Tue, 27 Nov 2018 20:49:49 -0700 Message-Id: <1543376991-5764-6-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check to see if the _xfs_buf_read fails. If so loop over the available mirrors and retry the read Signed-off-by: Allison Henderson --- fs/xfs/xfs_buf.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index dd8ba59..f102d01 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "xfs_format.h" #include "xfs_log_format.h" @@ -808,6 +809,8 @@ xfs_buf_read_map( const struct xfs_buf_ops *ops) { struct xfs_buf *bp; + struct request_queue *q; + unsigned short i; flags |= XBF_READ; @@ -820,7 +823,30 @@ xfs_buf_read_map( if (!(bp->b_flags & XBF_DONE)) { XFS_STATS_INC(target->bt_mount, xb_get_read); bp->b_ops = ops; - _xfs_buf_read(bp, flags); + q = bdev_get_queue(bp->b_target->bt_bdev); + + /* + * Mirrors are indexed 1 - n, specified through the rw_hint. + * Setting the hint to 0 is unspecified and allows the block + * layer to decide. + */ + for (i = 0; i <= blk_queue_get_mirrors(q); i++) { + bp->b_error = 0; + bp->b_rw_hint = i; + _xfs_buf_read(bp, flags); + + switch (bp->b_error) { + case -EIO: + case -EFSCORRUPTED: + case -EFSBADCRC: + /* loop again */ + continue; + default: + goto retry_done; + } + + } +retry_done: return bp; } -- 2.7.4