Received: by 10.192.165.148 with SMTP id m20csp4730903imm; Tue, 24 Apr 2018 07:33:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+MUk9ruRQDsVYNoe+I9Np7w970x3OxGceEL6NUYc1U/VrzHw/EQjJT4e+VnQMBmbdGLf4q X-Received: by 10.99.133.193 with SMTP id u184mr20812711pgd.442.1524580400283; Tue, 24 Apr 2018 07:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524580400; cv=none; d=google.com; s=arc-20160816; b=E7idreuzLR5F8rVgOnORde4xW9lfnzhjFZtSzFdEtRq7zo8C9nsUPOHB0H10d0N50Z krzjM0W9HDe7GFqaPt16F7AVWjNq/qOGfFaKqrU3ZJOUctDvhBx6WmxffRGlyFzSHdqd SvnF2FSwKByibgA7cddzGtu5vMew/HYp7f1fJLnASVqtit8mVwMY+88dAhXW14ezfm8m CFwdprUaeTQqn9F7kXEmoCS/YAtusCANPu1b+YCLTp/DFH4FkRqxCPspwO1JQmJc3V5U 4mSlFBMde4bMLQH0SCPTtE5jQlr77AMyyUJQ7zII+heMAZ6KZaRdlAxJKbpBLuntBNj2 F9cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dmarc-filter:arc-authentication-results; bh=wu18aW7VdwIfjuqbDUgdIfitjqj6U0rITTq8KZxYgkU=; b=sMPxlvgk79yWevEIkl3sNn3/3OwRTqxn9hgynj++eMeR3ufhjleIFfxMpzi8uDrQs5 ZLL5l7P1eThFtw6HUjOwFVU6OpKzbIYsk7jXXoO9G8nPmAzQ2JlTgIF2+R+OXgS1WErq aIE4jeKQHRB7Fb92xStKig1xagGSTmQnH2B0ObEVkgWHr61JhGnZi+ibhPNTAo0kWfki AX/26U3v8AjAVN0Jquqo0uJKjlgh3372lY8KTtdLb5jemhwGZ4HLJzv0Ak6TPN6k+9sy 0AjF1DKIPj4XZAY2fMzp3SjSuDoLut0+sEhsaOTCyAS/FUG+6iaQ8Mg0FSu7H8OQllCr ttFA== 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 i192si12072053pgc.380.2018.04.24.07.33.05; Tue, 24 Apr 2018 07:33:20 -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 S932939AbeDXMYT (ORCPT + 99 others); Tue, 24 Apr 2018 08:24:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:37830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757691AbeDXMYQ (ORCPT ); Tue, 24 Apr 2018 08:24:16 -0400 Received: from ceres.poochiereds.net (174-23-152-128.slkc.qwest.net [174.23.152.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F12FE21774; Tue, 24 Apr 2018 12:24:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F12FE21774 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jlayton@kernel.org Message-ID: <1524572654.5929.3.camel@kernel.org> Subject: Re: [PATCH] Always report a writeback error once From: Jeff Layton To: Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andres Freund Date: Tue, 24 Apr 2018 08:24:14 -0400 In-Reply-To: <20180423204208.GG13383@bombadil.infradead.org> References: <20180423204208.GG13383@bombadil.infradead.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 (3.26.6-1.fc27) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-04-23 at 13:42 -0700, Matthew Wilcox wrote: > The errseq_t infrastructure assumes that errors which occurred before > the file descriptor was opened are of no interest to the application. > This turns out to be a regression for some applications, notably Postgres. > > Before errseq_t, a writeback error would be reported exactly once (as > long as the inode remained in memory), so Postgres could open a file, > call fsync() and find out whether there had been a writeback error on > that file from another process. > > This patch restores that behaviour by reporting errors to file descriptors > which are opened after the error occurred, but before it was reported > to any file descriptor. > > Cc: stable@vger.kernel.org > Fixes: 5660e13d2fd6 ("fs: new infrastructure for writeback error handling and reporting") > Signed-off-by: Matthew Wilcox > > diff --git a/lib/errseq.c b/lib/errseq.c > index df782418b333..093f1fba4ee0 100644 > --- a/lib/errseq.c > +++ b/lib/errseq.c > @@ -119,19 +119,11 @@ EXPORT_SYMBOL(errseq_set); > errseq_t errseq_sample(errseq_t *eseq) > { > errseq_t old = READ_ONCE(*eseq); > - errseq_t new = old; > > - /* > - * For the common case of no errors ever having been set, we can skip > - * marking the SEEN bit. Once an error has been set, the value will > - * never go back to zero. > - */ > - if (old != 0) { > - new |= ERRSEQ_SEEN; > - if (old != new) > - cmpxchg(eseq, old, new); > - } > - return new; > + /* If nobody has seen this error yet, then we can be the first. */ > + if (!(old & ERRSEQ_SEEN)) > + old = 0; > + return old; > } > EXPORT_SYMBOL(errseq_sample); > Patch looks good to me, modulo the comment fix that Andres pointed out. Reviewed-by: Jeff Layton