Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp219745rwd; Mon, 12 Jun 2023 12:27:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7nk0+Tv1OPbBVmKaHGI1PFQvHuDb2rH/nbvoXLIjXj8QI5J9DriaHIF6/1tueMaTbCgu// X-Received: by 2002:a17:907:9285:b0:96f:678:d2e2 with SMTP id bw5-20020a170907928500b0096f0678d2e2mr9281160ejc.11.1686598066838; Mon, 12 Jun 2023 12:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686598066; cv=none; d=google.com; s=arc-20160816; b=ggCcj3f/sClLij/3RnRXcZCW4GCGafRj0a0UazLGcAmOx4cjjxJxCp9w1SsUKbZ8Sz pFhWSbT9mnWEcU078zlPBFjtUNKwb+c721RXlDWb0nqONKwR5bOzYXXqx9795NKRprBg Lb9OGmi6UIUS3bwem+/8orTFzchoDpKbbHKSDN/mB9Ok1+QBv+EKYYINWm2SQxb86N9q MaMVjJ0Vl9G+2+DjQhiKFxzJvHWYMkx6WtTWodk18kKwCW8S0R+G3TIVdFDhkkM6uveI VyIza/2rHjo9YLkTy8JU7IGRAsKjrFdrQolAvCUWW/Hy9ZrvTllgy/pObtCIwUnLt5Fz Y36g== 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=AszWU/2p9Sh9e8qnbdt21ZNvEMFN3R842f6FJBmjNfU=; b=LRSG6v38cZefLdmRiYEHOeCRGpMpEcmLgSPNHAhGKEvErWVvN5XihCF/0608gU0wS/ yP8IMa9AMwGkPjuiVBUvwJ81+UjyF6kBkw9uoHeCmUIDq/wk2DF8J0cO/5N0SHevANpK RNwyKN159Lk33bNSXOnE3KlyMr0PksemVOTnpFmRWEili1BJquE5oJ+mp4xD7yVWTOWI JNrBcdvcQ1t8M/5Syr5OcJFCqc90pATjFzqBK0Kg9oFKsRJRyDGr2bMGZq8HNd+fSjlk pWG4EjV6PDctJ3OGP4Z1fyc6KfqkTCu5voGeI29oAPHrVTH1B/u6LuvYQ2KIKpVMKSdJ Exvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aMPW2GuY; 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 rn15-20020a170906d92f00b00965d87098b3si5161750ejb.987.2023.06.12.12.27.17; Mon, 12 Jun 2023 12:27:46 -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=aMPW2GuY; 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 S235149AbjFLTR6 (ORCPT + 99 others); Mon, 12 Jun 2023 15:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236807AbjFLTR4 (ORCPT ); Mon, 12 Jun 2023 15:17:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84FB0E67 for ; Mon, 12 Jun 2023 12:17:53 -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 21F206177E for ; Mon, 12 Jun 2023 19:17:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BBB7C433D2; Mon, 12 Jun 2023 19:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686597472; bh=EbzEiC52HD+2/QHM4p5SS4NyWmceEBKZUm2dEOfnFDw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=aMPW2GuYndHuc9PEovdTYqF0i8oPMyNuyN8XVbsGapArRRk7+6dTOgwLXJGi/LZqB BOSmP9PWXfhsBzrIenreKk/CyAa+0jcXKbZTTKEULKCZCDTqRVMMeHUN1JATOyXyDF i5onYVAQ0PeY+bcEYBa5tS1aPp/4UM0prN4jPa4sQ6IKVvaSuJVPplWV7UhCa0+nXf JgIo8DF8B9ltpZQ4p2/1s4kAFzaHQ1bfP67Kgk4bzwAtsu5NT/+1mfYT6SP+xX9E19 hXz87iC69M5YMUcozK1d7RvLmmWcSDwPdpJkUO+WGCrKE5EScReB7RIc5NHaoSDJHQ AqDgk8cEXw3Vw== Message-ID: <6c16c58a9e6de330eab68aadd4714954df41dd1c.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 15:17:50 -0400 In-Reply-To: References: <9b3e6161f290246eb8003767b2b34596a10f5d71.camel@kernel.org> <71b3ff942fdf6f070f6cd59f29e04081d3f94c38.camel@kernel.org> Content-Type: text/plain; charset="UTF-8" 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 13:49 -0400, Chris Perl wrote: > On Mon, Jun 12, 2023 at 1:30=E2=80=AFPM Jeff Layton = wrote: > >=20 > > On Mon, 2023-06-12 at 11:58 -0400, Jeff Layton wrote: > >=20 > > >=20 > > > Got it: I think I see what's happening. filemap_sample_wb_err just ca= lls > > > errseq_sample, which does this: > > >=20 > > > errseq_t errseq_sample(errseq_t *eseq) > > > { > > > errseq_t old =3D READ_ONCE(*eseq); > > >=20 > > > /* If nobody has seen this error yet, then we can be the firs= t. */ > > > if (!(old & ERRSEQ_SEEN)) > > > old =3D 0; > > > return old; > > > } > > >=20 > > > Because no one has seen that error yet (ERRSEQ_SEEN is clear), the wr= ite > > > ends up being the first to see it and it gets back a 0, even though t= he > > > 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 t= hat > > > 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. > >=20 > > This may not be fixable with the way that NFS is trying to use errseq_t= . > >=20 > > 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. > >=20 > > 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. > >=20 > > 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: > >=20 > > b4678df184b3 errseq: Always report a writeback error once > >=20 > > 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. >=20 > Can/should it be marked SEEN when the initial close(2) from tee(1) > reports the error? >=20 No. Most software doesn't check for errors on close(), and for good reason: there's no requirement that any data be written back before close() returns. A successful return is meaningless. It turns out that NFSv4 (usually) writes back the data before a close returns, but you don't want to rely on that. > Part of the reason I had originally asked about `nfs_file_flush' (i.e. > what close(2) calls) using `file_check_and_advance_wb_err' instead of > `filemap_check_wb_err' was because I was drawn to comparing > `nfs_file_flush' against `nfs_file_fsync' as it seems like in the 3.10 > based EL7 kernels, the former used to delegate to the latter (by way > of `vfs_fsync') and so they had consistent behavior, whereas now they > do not. I think the problem is in some of the changes to write that have come into play since then. They tried to use errseq_t to track errors over a small window, but the underlying infrastructure is not quite suited for that at the moment. I think we can get there though by carving another flag bit out of the counter in the errseq_t. I'm working on a patch for that now. Cheers, --=20 Jeff Layton