Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp106848rwd; Mon, 12 Jun 2023 10:42:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4mv80VQdzBUY+2v2hW4ic0x1vlVzfHTYZI8tze8tiZvbNs3vx+EKck0RzXClH1IFJ7xnG7 X-Received: by 2002:a2e:8817:0:b0:2ac:dd01:e169 with SMTP id x23-20020a2e8817000000b002acdd01e169mr3097662ljh.40.1686591752033; Mon, 12 Jun 2023 10:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686591752; cv=none; d=google.com; s=arc-20160816; b=XtuOBFC5thRkvGANiTMzwWOwTnMUAeZ+Uf8BwE5exTLLOB9RqSz8Zjiwg6796ATgFg d/fUzy+ZMRtxW2hpl0U/QfDLr9o3uGGLf5A7LDXfu3MAkMAp+VxylbfQrNFtZ/Dgd9c9 CXXNgdbUTeU1jGrgz32rkL73dnlUaBURnAAzqlottm6vpMZdRXdBbQ1X/I/PasGKoOFi Mwm8v2E77xPpsiSmhfCa5ndRK8Fzxrj7HymucsfSxHHgLMpyOsDfgGq7cIVeuSeEGSIu FLSvtM2STvGm7KB7/xaWZ6CX1zDmbkDMR+fCxQzPbNt+v2ovQaV6pYb+9h5Vgj35jB1/ kZQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=wltBDUQFclznyc3nG5caicr34Sw/i/LXZMXRUmXatXo=; b=Qsw7b5GyHBHQfyAmyHijjMfJRMJ8ihAtbw8RbnPqwenZ1nejAp8IODLCtbEE2Kj3eq xxOj4a9Rw7tsEgyY0O7nYpac4WWb+vcyFXiG8wFLGIgC9APIE9dYN+fg4CSLFrVD21m+ T2h83hjMni9j0ZNrRYyRrALjvuKvolhrxeSoYXDfht21dUJ8XjR2K+E726zKzJu2AQv+ +l4WlH9XeogAhLb1cTnCHHylP+AHz1UqJGXM4kGQqcfLZVLZjKlNIvF8fikdCoJQzu2H sspvoRhr/wRfx2Z7zvmyhSIZqmicxaKomchLbeyM63SvQOq+2ZiPV1aF3xDdo5tYXMIM S9jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tHAPN4mj; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb19-20020a1709070f9300b009572d0759a8si5468494ejc.225.2023.06.12.10.41.54; Mon, 12 Jun 2023 10:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tHAPN4mj; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233336AbjFLRft (ORCPT + 99 others); Mon, 12 Jun 2023 13:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233326AbjFLRek (ORCPT ); Mon, 12 Jun 2023 13:34:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71F5444B7 for ; Mon, 12 Jun 2023 10:32:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 585DD620E6 for ; Mon, 12 Jun 2023 17:30:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B599C433D2; Mon, 12 Jun 2023 17:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686591046; bh=PhL17BzDFmv5WnWVvQ3t4b9FtoBoDz5fB0kAQj4XGW4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=tHAPN4mjkhO5U7T51o8LS1XkwEXSy5M9jWuUHCn3Kv8wV4OVultrIvm6WOnH1v9pZ DcSm92glym22E2/PP9knclFfde10GOcSpTbf4UdYOyWAN/NU4+mKyjT6seMXiuop+8 cAPfJBQvxmwwMzRwHc1gg3KkK/WDNjn0ITAK+VG5GYW6ZYWIKxMxMt8zWvK1aPSdeo /pHgSEFQRSN6VUD8Qbxq/WxoESto+pTd8YRW1XmYE5pCcbaacEfIu3D+zviq1XztUU 67/ewuuhljlavG6iggOXEDo04CseS+jpYHvyjTUmDdhx7VMaXXyN6n1kVS9eC48e+f /1R/ObtNJl/bw== Message-ID: <71b3ff942fdf6f070f6cd59f29e04081d3f94c38.camel@kernel.org> Subject: Re: Too many ENOSPC errors From: Jeff Layton To: Chris Perl Cc: Linux NFS Mailing List , Matthew Wilcox Date: Mon, 12 Jun 2023 13:30:45 -0400 In-Reply-To: References: <9b3e6161f290246eb8003767b2b34596a10f5d71.camel@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.3 (3.48.3-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, 2023-06-12 at 11:58 -0400, Jeff Layton wrote: >=20 > Got it: I think I see what's happening. filemap_sample_wb_err just calls > errseq_sample, which does this: >=20 > errseq_t errseq_sample(errseq_t *eseq) = =20 > { = =20 > errseq_t old =3D READ_ONCE(*eseq); = =20 > = =20 > /* If nobody has seen this error yet, then we can be the first. *= / =20 > if (!(old & ERRSEQ_SEEN)) = =20 > old =3D 0; = =20 > return old; = =20 > } =20 >=20 > Because no one has seen that error yet (ERRSEQ_SEEN is clear), the write > ends up being the first to see it and it gets back a 0, even though the > error happened before the sample. >=20 > The above behavior is what we want for the sample that we do at open() > time, but not what's needed for this use-case. We need a new helper that > samples the value regardless of whether it has already been seen: >=20 > errseq_t errseq_peek(errseq_t *eseq) > { > return READ_ONCE(*eseq); > } >=20 > ...but we'll also need to fix up errseq_check to handle differences > between the SEEN bit. >=20 > I'll see if I can spin up a patch for that. Stay tuned. This may not be fixable with the way that NFS is trying to use errseq_t. The fundamental problem is that we need to mark the errseq_t in the mapping as SEEN when we sample it, to ensure that a later error is recorded and not ignored. But...if the error hasn't been reported yet and we mark it SEEN here, and then a later error doesn't occur, then a later open won't have its errseq_t set to 0, and that unseen error could be lost. It's a bit of a pity: as originally envisioned, the errseq_t mechanism would provide for this sort of use case, but we added this patch not long after the original code went in, and it changed those semantics: b4678df184b3 errseq: Always report a writeback error once I don't see a good way to do this using the current errseq_t mechanism, given these competing needs. I'll keep thinking about it though. Maybe we could add some sort of store and forward mechanism for fsync on NFS? That could get rather complex though. Cheers, --=20 Jeff Layton