Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp725431imu; Tue, 27 Nov 2018 21:10:04 -0800 (PST) X-Google-Smtp-Source: AJdET5dfrcfkpzlFqvWs5axDhiE5j8Os+2Ts2OFKl+FLVeYvD9F6gdOcNrCLBuqnmbpymFeJ0pem X-Received: by 2002:a63:fc49:: with SMTP id r9mr31083122pgk.209.1543381803940; Tue, 27 Nov 2018 21:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543381803; cv=none; d=google.com; s=arc-20160816; b=NXkoWZ9MmDR4xlvvMGBBP1q0tsMYEb7BI/n6KnUwS34w9C1hySiAXyWzktKkM47SI6 1BGg0OvumbQOUWmdQpgWeQToTv6sVqfVSBlFSGV/J0tRhfQNkgTkcCYlk9WN4845ofzr 7Ahtn54JwxD7wgLV8jpaHLuPbr4DDAecbbtnsMWphPZTsXibwkst5a+2CleCehrE/zyk 7adoASOeP3TDd3BcCgkcLfrL1SuwmLousGL5qcEo/bhLarEPqRoIALFiVH7GlxFzbsbv htzU0/PwWCF0ddUl+enW2ke1TzWrBeu+X94mAsMgWCEnA2M94Rmzr8qsiY/yacjMAWM1 9AFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6+dVRjuQwq+taYkF3I+L/g63y7IiKgzv1osXSb1ysFo=; b=gi0mFS1mJNKFzNMl7uOLbE2ZlA+fKW6qWzDIg3QxQoy83sXbWzyLtsUcmhjwtAxawS d1ZGSS+NPm6jD9rxtjHOfx4RzTSywMuvcr2q/vFQpc6xXD+nmU4IArCIYUQVxZsvWwRL XROy0i1FbFPwl6TRLIzQh3LoVNg1axqRlELhpTUMEWeabkTRvaRQGYp8WOlay47ZY89q eWH0Pkw1cPVVzaLio2tiqcgexI8YTRJ6xTxNWBx+Z8qm8J7mE09gKk+jccP2iCNcApGi zyef0ioXRRdt2rwhoH10HjCyLHUnYLF24ihSrtzV7MhMnJcXDgCZab0hbg132Cbz/u5z 9kTQ== 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 w19si5796806pgc.96.2018.11.27.21.09.48; Tue, 27 Nov 2018 21:10:03 -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; 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 S1727535AbeK1QJP (ORCPT + 99 others); Wed, 28 Nov 2018 11:09:15 -0500 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:23750 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbeK1QJP (ORCPT ); Wed, 28 Nov 2018 11:09:15 -0500 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail07.adl2.internode.on.net with ESMTP; 28 Nov 2018 15:38:52 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1gRs5i-00047o-VL; Wed, 28 Nov 2018 16:08:50 +1100 Date: Wed, 28 Nov 2018 16:08:50 +1100 From: Dave Chinner To: Allison Henderson Cc: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com Subject: Re: [PATCH v1 5/7] xfs: Add device retry Message-ID: <20181128050850.GJ6311@dastard> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> <1543376991-5764-6-git-send-email-allison.henderson@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1543376991-5764-6-git-send-email-allison.henderson@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 27, 2018 at 08:49:49PM -0700, Allison Henderson wrote: > 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); So the first time through this loop the block layer devices what device to read from, then we iterate devices 1..n on error. Whihc means if device 0 is the only one with good information in it, we may not ever actually read from it. I'd suggest that a hint of "-1" (or equivalent max value) should be used for "device selects mirror leg" rather than 0, so we can actually read from the first device on command. i.e. bp->b_error = 0; bp->b_rw_hint = -1; _xfs_buf_read(bp, flags); if (!bp->b_error) return bp; /* manual iteration to find a good copy */ 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; Just return bp here, don't need a jump label for it. Cheers, Dave. -- Dave Chinner david@fromorbit.com