Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp126731ybl; Mon, 12 Aug 2019 13:00:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2icZxotXRkC3/0/6qOv7hdlXoERg8JwBEwppmEUXrMHpwXMkZuYoSo+XOiyCEDxcYsBbc X-Received: by 2002:a17:902:ac87:: with SMTP id h7mr35529677plr.36.1565640041620; Mon, 12 Aug 2019 13:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565640041; cv=none; d=google.com; s=arc-20160816; b=Yg9qU2hIvGy6qeVB0Rb8ShonUpfn0mTKc5GB9qaRUmi/tNNkIxQ8VlIK0WCscjdDTq bvbD2hSBcnMiFnvk3TMVWhzZkFHYbW7u9aLoQwVbt8Iz5NpHeq3254cyXweXe81wFdw0 kCBwnUfaqN7O9J+X9Br3zI2f/2b7PtiGEvXUWl9nMpPdwnMsrHLLzPyue/o4HQbCMPJr Mhy0pZnNU8fd4WKGtI5PiQHu7/e0vwztzlyAVii6XEurHLcheBxohGjzKgJNnuVFucJx THu+IbHe/NA40NkemGhEwpGoJSbW/VV2jduNCZgBkj/lccwpW06goANXvaH8MLoRcqyB HVfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=clIsYubTh7MN6J5c4PTl+wmxLPMnDGJNILo+8ER3fRI=; b=NhYEBmaGCYq8eD5+4UJjneHzxNxCcAKxvNq746/QQaOJndzgYxIj4rZR5IWwNbKb9s CCtlqWgNE0EQbleO4WxaY3Tc4R3nj7evOPlKlP37G0pwJAtLr02x20CqyyOwY8GvJreb iJhjL2sVZ7Z9vzBPvjs6UDBTxUd584AoJKtOG/GrRmm3f0mVUOF3Q6vf3wmg3oQyqdTi 0L4TgTOT7apogUOok8ILGtRzW4QwjoyzjzM1RfgENvssbxetdxGZJyBJg36/1RXfxtxX VMk1h4H+rr79J+xFEhLD8zaTDgXWm9jwQFs+ii5XsrvNySvIWj9BCp4eutQkinPABDMB 65Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t135si63119753pfc.251.2019.08.12.13.00.27; Mon, 12 Aug 2019 13:00:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726877AbfHLUAU (ORCPT + 99 others); Mon, 12 Aug 2019 16:00:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfHLUAU (ORCPT ); Mon, 12 Aug 2019 16:00:20 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75BD5315C036; Mon, 12 Aug 2019 20:00:20 +0000 (UTC) Received: from parsley.fieldses.org (ovpn-122-197.rdu2.redhat.com [10.10.122.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 507951001281; Mon, 12 Aug 2019 20:00:20 +0000 (UTC) Received: by parsley.fieldses.org (Postfix, from userid 2815) id A51E8180A60; Mon, 12 Aug 2019 16:00:19 -0400 (EDT) Date: Mon, 12 Aug 2019 16:00:19 -0400 From: "J. Bruce Fields" To: Olga Kornievskaia Cc: linux-nfs Subject: Re: [PATCH v5 5/9] NFSD add COPY_NOTIFY operation Message-ID: <20190812200019.GB29812@parsley.fieldses.org> References: <20190808201848.36640-1-olga.kornievskaia@gmail.com> <20190808201848.36640-6-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 12 Aug 2019 20:00:20 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, Aug 12, 2019 at 03:16:47PM -0400, Olga Kornievskaia wrote: > On Mon, Aug 12, 2019 at 12:19 PM Olga Kornievskaia > wrote: > > While this passes my testing, in theory this allows for the race that > > we get the copy notify size but then offload_cancel arrive and change > > the value. Then refcount_sub_and test_check would have an incorrect > > value (can subtract larger than an actual reference count). I have no > > solution for that as there is no refcount_sub_and_lock() that will > > allow to decrement by a multiple under a lock. Thoughts? > > I tried not to use the client's cl_lock but instead use a specific > lock to protect the copy notifies stateid on the stateid list. But > since stateid's reference counter (sc_count) is protected by it, I > think by getting rid of the special lock and using cl_lock will solve > the problem of coordinating access between the sc_count and the > copy_notify stateid list. Are the any problems with using such a big > lock? Probably not. But it can be confusing when a single lock is used for several different things. A comment explaining why you need it might help. --b.