Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp127040ybl; Mon, 12 Aug 2019 13:00:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDU/6FQPDaY0eUdPmm1kF0aXP0JuiAuF6TPhKWQuAd1rOb7QFNXpWqYCA9GodsK4WuSlDy X-Received: by 2002:a63:f812:: with SMTP id n18mr30973266pgh.185.1565640056267; Mon, 12 Aug 2019 13:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565640056; cv=none; d=google.com; s=arc-20160816; b=MDShkM8jFCToac/XonXN7aJc2szWP81t1Pt2gqLCssq1k9FQ65fVPB5SDsfHP70yuC pEbl34IJ+mfYUT4YvuWeqk6vqt0SHWbDX1hU1RRSbvsrxUyqWSyd7bvOVMTze59WbATX BhI2mY0ljbnfnE2JKOd6t6gbV6K/8DKjVQEzsmvTEZ8NMtl+7Z08W0s+3rwDhluWtqr7 iHGhsGj+c5dwuqIgQdlzPhHe9KSuUWseRSyVgYGn3NucxtJJnyZOuOUcnkdxRzbcvNjG n9JJ22tE/E+1rUb3I8eAQL7R7l5o5dB2Q3EYXi1t72Vgb+OnQ4Vq79g3h/HAS1pUgI7S bkUw== 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=JEjFdaMPmk/tkVXUZjy9JOFIakNsCk1HRzOZUlOgKpI=; b=GMB3DovQKAiReCYNSJNaZAwEfcsRZLHMj6byA8ZeN8qcyyp4xtKmFR27Tuc70M86rt 7rRP2o+y08pQ/G5wEZsbGWOjSjL608Y2IuUBmkXiqeUkZ51Pwy+ZuRTPF7wkgzJLWvwo xvP/Xk4N9k0gNLCPyTgc2A8FcrGfWww7s25f4B1ZVcoRieEezIKedsjStSNDM+jF2ghx YlBk4Fd9G0RTK84k37XVW6XuFILjBO+C/+GQEUrMiYle8NEVZKaB0GoUKhShnhtOwtDu RJBzPAZfsTIt6CPh5hbTmjGrYvwUDDeg9qpkQDTx/DMeAiUM5f44p3jxTDfwYXc6Rou+ M5Qw== 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 t18si56565494plo.328.2019.08.12.13.00.42; Mon, 12 Aug 2019 13:00:56 -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 S1727066AbfHLUAi (ORCPT + 99 others); Mon, 12 Aug 2019 16:00:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49456 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfHLUAh (ORCPT ); Mon, 12 Aug 2019 16:00:37 -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 8EF897BDCE; Mon, 12 Aug 2019 20:00:37 +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 653311001947; Mon, 12 Aug 2019 20:00:37 +0000 (UTC) Received: by parsley.fieldses.org (Postfix, from userid 2815) id BE622180A60; Mon, 12 Aug 2019 16:00:36 -0400 (EDT) Date: Mon, 12 Aug 2019 16:00:36 -0400 From: "J. Bruce Fields" To: Olga Kornievskaia Cc: linux-nfs Subject: Re: [PATCH v5 5/9] NFSD add COPY_NOTIFY operation Message-ID: <20190812200036.GC29812@parsley.fieldses.org> References: <20190808201848.36640-1-olga.kornievskaia@gmail.com> <20190808201848.36640-6-olga.kornievskaia@gmail.com> <20190812200019.GB29812@parsley.fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190812200019.GB29812@parsley.fieldses.org> 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.26]); Mon, 12 Aug 2019 20:00:37 +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 04:00:19PM -0400, J. Bruce Fields wrote: > 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. (By which I mean, a comment in the code.) --b.