Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp747132imu; Tue, 27 Nov 2018 21:41:14 -0800 (PST) X-Google-Smtp-Source: AJdET5eurk8iTF19IGsOwvSMVBzSBw6PbHlENYzbTWKi6cci7r5QXzJ7sbTCns8ANUwm9+v2hZfU X-Received: by 2002:a62:d885:: with SMTP id e127mr35978987pfg.197.1543383674531; Tue, 27 Nov 2018 21:41:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543383674; cv=none; d=google.com; s=arc-20160816; b=VwPRuJ2G4xTX3NN+ZzT2mKGRsZNvyr6U3Tse/cm7GvxjLRGnQKGhKIIH+Ncd4oukAU 6+c4vKx/Y7zkoPt4otqd/CLzSE18TcfcGn2NzZuVbMGJMQDuAttnzCm9+U9pyxe6YKmA xE2f/fqsrZ/ejIU/zBBZwI9t4cvo4fuNm0djUl3ectJsQHO+rb1whJCVFw3GgNlJVNJT ACO92sd/IxP2nRwBBfp4qzBOD4GjfIsj2Yt69E67Ofg7wDkx1Vz4zDNNdm+c2qaMgt1m e6lVRdkdRKAGDUFs89/mbYBefADeXUDRTAYDgJZWWN29SPRqndxht/s5aWtsX1R3im8v yuxA== 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=i0NGZSCBQi8vMHqVGs3pp9W1N5YbBbdQK9u1iYw8pug=; b=gBxjrWZBgklLTS8qWxtvqiOvSsdBVhvyvanBKUMddd1FMXCt9nsOewafVW45mcdgIs u6qGPxds41t1sb3dByjh7Avl/AlFWW0xvfmL7H0Rq7VXYpAkBX9hv/sXPUzE9E+bv2ac z8A51M5iPOwZwt9dPppei5FtVfT3Y+GfXNWOsFW73dQSZSt0r4CIY9MrEvpUGWJheQk6 /muKS5BNjm1fGMCZrIA0kJgN1fVpyKAv7BNCh5ahGyOLytbGM5UkTllmYY9WSEOli4+9 bfwqOUnw7dWW1Aqm7rCjftfNz93Z64ZxYmEpNx9mbfTluEhXndNYtTwC29j8zNUGILA+ +emw== 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 w14si6227276plq.145.2018.11.27.21.40.58; Tue, 27 Nov 2018 21:41:14 -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 S1727438AbeK1Qks (ORCPT + 99 others); Wed, 28 Nov 2018 11:40:48 -0500 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:25172 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbeK1Qkr (ORCPT ); Wed, 28 Nov 2018 11:40:47 -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 16:10:20 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1gRsaB-0004AL-FW; Wed, 28 Nov 2018 16:40:19 +1100 Date: Wed, 28 Nov 2018 16:40:19 +1100 From: Dave Chinner To: "Darrick J. Wong" Cc: Allison Henderson , 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 6/7] xfs: Rewrite retried read Message-ID: <20181128054019.GN6311@dastard> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> <1543376991-5764-7-git-send-email-allison.henderson@oracle.com> <20181128051719.GK6311@dastard> <20181128052604.GE8125@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181128052604.GE8125@magnolia> 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 09:26:04PM -0800, Darrick J. Wong wrote: > On Wed, Nov 28, 2018 at 04:17:19PM +1100, Dave Chinner wrote: > > On Tue, Nov 27, 2018 at 08:49:50PM -0700, Allison Henderson wrote: > > > If we had to try more than one mirror to get a successful > > > read, then write that buffer back to correct the bad mirro > > > > > > Signed-off-by: Allison Henderson > > > --- > > > fs/xfs/xfs_buf.c | 8 ++++++++ > > > 1 file changed, 8 insertions(+) > > > > > > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c > > > index f102d01..81f6491 100644 > > > --- a/fs/xfs/xfs_buf.c > > > +++ b/fs/xfs/xfs_buf.c > > > @@ -847,6 +847,14 @@ xfs_buf_read_map( > > > > > > } > > > retry_done: > > > + > > > + /* > > > + * if we had to try more than one mirror to sucessfully read > > > + * the buffer, write the buffer back > > > + */ > > > + if (!bp->b_error && i > 0) > > > + xfs_bwrite(bp); > > > + > > > > This can go in the case statement on retry and then you don't need > > to check for i > 0 or, well, bp->b_error. i.e. > > > > swtich (bp->b_error) { > > case -EBADCRC: > > case -EIO: > > case -EFSCORRUPTED: > > /* try again from different copy */ > > continue; > > 0: > > /* good copy, rewrite it to repair bad copy */ > > xfs_bwrite(bp); > > Some day we might want to provide some controls for how long we'll retry > these reads and whether or not we automatically rewrite buffers, since > some administrators might prefer fast fail to get failover started. Sure, but if the recovery code is trewn all through the read code, it becomes a mess to untangle. isolate the recovery code as much as possible, that way we can factor it out as it becomes more complex. > (Not now though) Which is exactly my point about future recovery complexity.... :P Cheers, Dave. -- Dave Chinner david@fromorbit.com