Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1464499rwl; Thu, 5 Jan 2023 14:08:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXv0o0oELMAaEjIEnbtnjaS3TPos+ahsLKrfYvtBqxPWFZQ+nhSaT/BAAs2yGRgUQibkLGC8 X-Received: by 2002:a17:902:6805:b0:191:1545:a652 with SMTP id h5-20020a170902680500b001911545a652mr65984398plk.31.1672956480373; Thu, 05 Jan 2023 14:08:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672956480; cv=none; d=google.com; s=arc-20160816; b=HOGD3V5uu9+9GMMmJkrgWd3TCgkfc4pA7INlqap1DhMyutEh1934uq+zxcoJkIPrIn fne+ZMqSMphEYbZhRJZQsH5W9vpK4VOHTfu85/avXpAAdzrfs8gkT8jKBh+EIldcozor bgJl83GgELBpuDykbSwiyhzApOcigxxJArmZgpDxQNFzp1XMNSlDI8xj3A7KBZGlfdKZ rrkuM0AFw3y9qluIy72t/2rUkxVfPS7o0Frxp26XC7khPrcAQhDx8rzcV59cDfF6c8l4 ZMxmT1Y1Czmy/Tr9yF+WwhBHPeJFZ8kc5YCEhFLuxqAir+k0RPJ7FWfeXLOVPjyc2rWd ZwEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=dnpmgIuJxSXIJ0SRrRB9dS7AKTOSv031CF0jpFgi7Mo=; b=bWKELQMNx6s7IEeM7R58tD6a4/JrIofeTREVssuRaXJdy7SOt+3whDzgtUN5B+m+fw nKKsiVnfrbp4gVzciwCLZVKevo+Hu9UnsHvE6oIbXVaX+hjeq9ETUIQB3ytxDuI4KMgQ J3d2/RywfUVdDE7GSbND+NggZDQ3H6JFmcu3/lTBNCH5qxqEet1LL3LuEPSkIF1/Yf6B IOKYznMqKuSLOn1etkJj0qwT0A42bumEAFKKqhakUDZmdQKKwnvmOMKk42cLoz/SD0c5 QcqXvwkPMMmPoE/VK0hoi5FQrNjMANd2FhdbHV4W8Yc77OPfoqxAHYkff23FirrvyYDY 5z+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=m3c04xXw; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a170902f7cf00b00174eef66680si30127299plw.120.2023.01.05.14.07.42; Thu, 05 Jan 2023 14:08:00 -0800 (PST) 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=@suse.de header.s=susede2_rsa header.b=m3c04xXw; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232335AbjAEWCt (ORCPT + 99 others); Thu, 5 Jan 2023 17:02:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbjAEWCr (ORCPT ); Thu, 5 Jan 2023 17:02:47 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B4A67BEF for ; Thu, 5 Jan 2023 14:02:46 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E28CB8C12F; Thu, 5 Jan 2023 22:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1672956164; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dnpmgIuJxSXIJ0SRrRB9dS7AKTOSv031CF0jpFgi7Mo=; b=m3c04xXwMWCsRUhaxZyqtM8iAn3NYs9tPr4bVeBT51+r3jgCtYAfD9JmckztWgGLCFKeZ3 FQ60hWbtM0Syrm/RJb9iE70fNfxGYxTVG4Y6bj6sDtrqeNh+6pDS56+Lge4NyCKqBuiqC0 LYLDTxDBGtp8tIpSzHLX5VN3Wgtghbw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1672956164; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dnpmgIuJxSXIJ0SRrRB9dS7AKTOSv031CF0jpFgi7Mo=; b=bQ7sS8jvgQDNeoxWXBoOggq2kMlVgCZtEtU/BwM0BXcJe+YUIlCyrCSP07+AFryCZlLue/ iPqpSVDF6mGONyAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1AB3E13338; Thu, 5 Jan 2023 22:02:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 9LhVMAJJt2OMUwAAMHmgww (envelope-from ); Thu, 05 Jan 2023 22:02:42 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Olga Kornievskaia" Cc: "Trond Myklebust" , "Trond Myklebust" , "Anna Schumaker" , "Linux NFS Mailing List" Subject: Re: [PATCH] NFS: Handle missing attributes in OPEN reply In-reply-to: References: <167279203612.13974.15063003557908413815@noble.neil.brown.name>, <7a98c3e70bae70c44418ce8ac4b84f387b4ff850.camel@kernel.org>, , <167279876729.13974.1765446738043285170@noble.neil.brown.name>, <167279964139.13974.11763637507027085853@noble.neil.brown.name>, Date: Fri, 06 Jan 2023 09:02:39 +1100 Message-id: <167295615935.13974.12958918575587963063@noble.neil.brown.name> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 Thu, 05 Jan 2023, Olga Kornievskaia wrote: > On Tue, Jan 3, 2023 at 9:34 PM NeilBrown wrote: > > > > On Wed, 04 Jan 2023, NeilBrown wrote: > > > On Wed, 04 Jan 2023, Olga Kornievskaia wrote: > > > > On Tue, Jan 3, 2023 at 7:46 PM Trond Myklebust w= rote: > > > > > > > > > > > > > > > If the server starts to reply NFS4ERR_STALE to GETATTR requests, wh= y do > > > > > we care about stateid values? > > > > > > > > It is acceptable for the server to return ESTALE to the GETATTR after > > > > the processing the open (due to a REMOVE that comes in) and that open > > > > generating a valid stateid which client should care about when there > > > > are pre-existing opens. The server will keep the state of an existing > > > > opens valid even if the file is removed. Which is what's happening, > > > > the previous open is being used for IO but the stateid is updated on > > > > the server but not on the client. > > > > > > I agree that it is acceptable to return ESTALE to the GETATTR, but > > > having done that I don't think it is acceptable for a PUTFH of the same > > > filehandle to succeed. Certainly any attempt to again use the > > > filehandle after the PUTFH should fail with NFS4ERR_STALE. > > > > > > RFC7530 says > > > > > > 13.1.2.7. NFS4ERR_STALE (Error Code 70) > > > > > > The current or saved filehandle value designating an argument to the > > > current operation is invalid. The file system object referred to by > > > that filehandle no longer exists, or access to it has been revoked. > > > > > > So the file doesn't exist or access has been revoked. So any writes > > > should fail. Failing with OLD_STATEID is weird - and having writes > > > succeed if we use the correct stateid is also odd. Failing with STALE > > > would be perfectly sensible and I suspect the Linux client would handle > > > that just fine. > > > > I checked a recent tcpdump (with patched SLE kernel talking to Netapp) > > and I see that the writes don't succeed after the first NFS4ERR_STALE. > > > > If the "correct" stateid is given to WRITE, it returns NFS4ERR_STALE. > > If the older stateid is given to WRITE, it returns NFS4ERR_OLD_STATEID. > > > > So it seems that it just has these two checks in the wrong order. >=20 > Does Netapp return ERR_STALE on the PUTFH if the stateid is correct? In the traces I have, Netapp never returns ERR_STALE on PUTFH. Of course the PUTFH operation doesn't have a stateid, so the "if the stateid is correct" is not meaningful. ACCESS, READ, WRITE, SETATTR, and GETATTR are the only ops that I have seen to result in ERR_STALE. ACCESS and GETATTR don't have a stateid. READ, WRITE, and SETATTR do. These get OLD_STATEID if the stateid is old, and only get STALE if the stateid is current. > If it's the WRITE operation that returns an error and if the server > has multiple errors (ie bad statid and bad file handle)` then I don't > think the spec says which error is more important. In this case, I > think the server should fail PUTFH with ERR_STALE. I agree. If the PUTFH returned STALE there would not be a problem. Even if a race resulted in the PUTFH succeeding and the WRITE getting OLD_STATEID, Linux-NFS would retry an the new PUTFH could then fail correctly. NeilBrown >=20 > > > > NeilBrown >=20