Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2829671ybx; Fri, 8 Nov 2019 09:54:43 -0800 (PST) X-Google-Smtp-Source: APXvYqznIM4RRqWeoeojw0eyg8H7LXTLwqvcy0Zw+1P4sDgSMWIgUQgjFDDhFDAJUAvywAveGDtH X-Received: by 2002:aa7:d842:: with SMTP id f2mr11615471eds.262.1573235683729; Fri, 08 Nov 2019 09:54:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573235683; cv=none; d=google.com; s=arc-20160816; b=xlBYLsOH5WbGq+VAN9w3bATEfJ/BCs5Dgg+FfW61xSh3jVwI8Q5y7GE42sHGS4z2gF 8egO0CHNrgnmQ6gnAKCdp4dK0fk3+C9pNWu4DIp7oTUQFhL1EhlUI+Y5vLwrfzsEaIt1 +Am0Bgvv69BXghXW8nH3G9VOWyQ7+hYZOAMK1DmcKFO4PUZ+GpjebwxUqGjOs5pI7vXm Z6mHK7SFtR+jiGxc1TO0v31+SH3j/0/ePxHKZiUd8Xp7IglgYI3pYakx6dHIhvqMo9Zg TAimtihc1U5iroIRaxm2x28VdJwbogYgOjVWgdZD3gF8tEzTJzID6Wf4teQ5UK8yW2jS OXZg== 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=bbvf3Zjkxlkul6IM/qAPE5pQGPyJPWV2tiJMLgl3p7Q=; b=sb1QwjNPYm7fdG+UHIUeOZtvrlW5sAGxKGiE27TcYaxiB+eAjBBWzapN+S2rxUmtXb SmWfswptGCv0D5fMVtUku8MTwBMSiV3pM1x1kRM4keQ45mQ73FYsuH17Bm4rcK0UowmF xkcjuylEaB6B87hlu3t+qCWBiCJI6/V1VREBb/y4whgd0kMSQMzK9NgvD50gE6a6L/bN gNYYmPZL3z0mjvyuLb94y1c4ayLhrmIRVctV/eBBhK3ZSazBGboYYvuImBwo+d5PGr4G tBME9m7WfHPXOnVyPRPKMAKbPvceXJJLKtpAAgCo8kavWcKOcUKSO5Lk1T8JUm7aHnNu inNQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si5127507edl.273.2019.11.08.09.54.19; Fri, 08 Nov 2019 09:54:43 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbfKHRyS (ORCPT + 99 others); Fri, 8 Nov 2019 12:54:18 -0500 Received: from fieldses.org ([173.255.197.46]:36448 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfKHRyS (ORCPT ); Fri, 8 Nov 2019 12:54:18 -0500 Received: by fieldses.org (Postfix, from userid 2815) id D5F571C15; Fri, 8 Nov 2019 12:54:17 -0500 (EST) Date: Fri, 8 Nov 2019 12:54:17 -0500 From: "J. Bruce Fields" To: "J. Bruce Fields" Cc: Trond Myklebust , "linux-nfs@vger.kernel.org" Subject: [PATCH] nfsd: document callback_wq serialization of callback code Message-ID: <20191108175417.GC758@fieldses.org> References: <20191023214318.9350-1-trond.myklebust@hammerspace.com> <20191025145147.GA16053@pick.fieldses.org> <97f56de86f0aeafb56998023d0561bb4a6233eb8.camel@hammerspace.com> <20191025152119.GC16053@pick.fieldses.org> <20191025153336.GA20283@fieldses.org> <20191029214705.GA29280@fieldses.org> <20191107222712.GB10806@fieldses.org> <20191108175109.GA758@fieldses.org> <20191108175228.GB758@fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191108175228.GB758@fieldses.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: "J. Bruce Fields" Date: Tue, 29 Oct 2019 16:02:18 -0400 The callback code relies on the fact that much of it is only ever called from the ordered workqueue callback_wq, and this is worth documenting. Reported-by: Trond Myklebust Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4callback.c | 6 ++++++ 1 file changed, 6 insertions(+) Also adding a comment, since I know this was a source of confusion when investigating these races. diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index c94768b096a3..24534db87e86 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -1243,6 +1243,12 @@ static struct nfsd4_conn * __nfsd4_find_backchannel(struct nfs4_client *clp) return NULL; } +/* + * Note there isn't a lot of locking in this code; instead we depend on + * the fact that it is run from the callback_wq, which won't run two + * work items at once. So, for example, callback_wq handles all access + * of cl_cb_client and all calls to rpc_create or rpc_shutdown_client. + */ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) { struct nfs4_cb_conn conn; -- 2.23.0