Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2752649rda; Wed, 25 Oct 2023 11:12:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFF3VJO0SCuZxXl8EcOEm9GuH8x3mfKTs072XfuVZoFwS3HNp3SJcPXpFCGd41JqXY39y7 X-Received: by 2002:a25:4289:0:b0:d9a:4f14:5bf9 with SMTP id p131-20020a254289000000b00d9a4f145bf9mr13701638yba.26.1698257575296; Wed, 25 Oct 2023 11:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698257575; cv=none; d=google.com; s=arc-20160816; b=HJpUmSjKNZ05BqX+pI/e6cqNZ0WK5NRk+wnt7rFIwuodVm4QoHNLZBoCqv+pVNzdFs TcIyoJFl2XcwFcfak408vKrWAXJ+iynn3OPLjvxWjVPGL1ghiScGrKWHZDflXlD1LkZM Y+hPyuwhf2fqEx/8bfLb3EJMrtP1DVMhBBjkBm6qVPHhCHBForBiCoGVQc/blnyhfGJy 4npx90agiZiEYYVD/PVozH4jC2t8RYxKFXPrKnN7g1ipYTdFMxRhMyEjg6yMmTZE+M3Z vuPt1yL/09vPV1W5+HrOoZx1VLRPVPI/DAQNUD+oHXwWrW7MjFm49Gw5KLU2zcFrVAIY YxFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5cnB0Wl3nHUb0LUJdrBGafq84dM6Foil+zCdtAV+P7k=; fh=4PV+5Ng5rFMfFCXvEgStSaE3qZJmirZzcVKxhhh25Tw=; b=qpO+tVGJgfRMDdbwF8TBL8mHVhdK8il+d3BU+y8J2GxkDA5YTG/D7KvJDSn6ML5123 3hUO10aUQqvMWwH71ruksIN7ZzjoyOgVELk0uhfcwokxNHVMDPtpLxBcW5ixAqN3+m+N EblS9bDgAsNr7aYt5h1QU4zMk339ixNuJEuhnZ78ZHU13tlz8GCBSkwwjATuzZKVHVP+ H/nW2yCXOXCo6x2qCFH0JX0u81Vohqi18YJ9s8bCj0z34QiorpW9KpfotiGxWRGvsT3r 697rmFchLbYXpv1/dKcqsd4b8ojAARF/9g68T860gjWhHlhLsXAreibEKMP7rX27cfcj u6bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c5K6Fihg; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id o20-20020a25d714000000b00da02b804daasi6525433ybg.392.2023.10.25.11.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 11:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c5K6Fihg; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C575181679C1; Wed, 25 Oct 2023 11:12:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234674AbjJYSMr (ORCPT + 99 others); Wed, 25 Oct 2023 14:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229826AbjJYSMp (ORCPT ); Wed, 25 Oct 2023 14:12:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E94193 for ; Wed, 25 Oct 2023 11:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698257515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5cnB0Wl3nHUb0LUJdrBGafq84dM6Foil+zCdtAV+P7k=; b=c5K6Fihg5OsDYlGFEGtOO5qMg4hNlKeGE/8LmVB/bIJOQ7wf/xCOEp/YvKTYu87wqvtb4I sc/0J10AVAdDFhNLd+3tZBQCRiBmOicTuay3KyZMcnedm2QzWa6Z7HBwQuCIYgAmTNcwGx ibHULv4vnu0C52FCU5qy8hWExpjrBsY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-557-CQnMMDF4N_6cy-Ffx1SVSw-1; Wed, 25 Oct 2023 14:11:53 -0400 X-MC-Unique: CQnMMDF4N_6cy-Ffx1SVSw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 238A988D01C; Wed, 25 Oct 2023 18:11:53 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.21]) by smtp.corp.redhat.com (Postfix) with SMTP id DA36C492BFA; Wed, 25 Oct 2023 18:11:50 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 25 Oct 2023 20:10:52 +0200 (CEST) Date: Wed, 25 Oct 2023 20:10:49 +0200 From: Oleg Nesterov To: Chuck Lever Cc: Jeff Layton , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Ingo Molnar , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: nfsd_copy_write_verifier: wrong usage of read_seqbegin_or_lock() Message-ID: <20231025181049.GD29779@redhat.com> References: <20231025163006.GA8279@redhat.com> <20231025173931.GA29779@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 25 Oct 2023 11:12:51 -0700 (PDT) On 10/25, Chuck Lever wrote: > > On Wed, Oct 25, 2023 at 07:39:31PM +0200, Oleg Nesterov wrote: > > Hi Chuck, > > > > Thanks for your reply. But I am already sleeping and I can't understand it. > > I was responding to "I can not understand the intent." But also I > was hoping that explanation would help you provide a correct > replacement for the existing code. In case I was not clear, I have already provided the replacement for the existing code which looks "correct" for me ;) Nevermind, please forget. > > 1. Do you agree that the current nfsd_copy_write_verifier() code makes no sense? > > Probably. > > > > I mean, the usage of read_seqbegin_or_lock() suggests that if the lockless > > pass fails it should take writeverf_lock for writing. But this can't happen, > > and thus this code doesn't look right no matter what. None of the > > read_seqbegin_or_lock/need_seqretry/done_seqretry helpers make any sense > > because "seq" is alway even. > > > 2. If yes, which change do you prefer? I'd prefer the patch at the end. > > Based on my limited understanding of read_seqbegin(), the patch at > the end seems cleanest and is on-point. Please post an official > version of that to linux-nfs@ with a full patch description, and > I'll see that it gets into v6.8-rc with proper tags, review, and > testing. Ok, will do tomorrow. Thanks, Oleg.