Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp193411lqp; Tue, 11 Jun 2024 20:42:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWN8pljfPrmDhbkr5CMU3OuKAaJRpmQDv/dqr8c2Ud5d0lVLdeOhUZVeOnKeYmTt6Fqm516qEoCQ3nkKtmqtBT8+2MCqjTRHCoTPVys+A== X-Google-Smtp-Source: AGHT+IGF7I6XndAf82ZGrVaXcpkeaPfTRnDl5Ke32XXfbU2rhGipQbSxZxERVVTo6jZqXstO6ZLB X-Received: by 2002:a17:90a:2ec5:b0:2c2:f6e9:54fe with SMTP id 98e67ed59e1d1-2c4a7639e8bmr699400a91.27.1718163771671; Tue, 11 Jun 2024 20:42:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718163771; cv=pass; d=google.com; s=arc-20160816; b=x6UxoX4V4mlhdpWOyCiSkPJAuvPTBqFXoNzdYgkkZHI59T35bEpb5F3TftPPixmm4q gTzgAwPYXf0LQwC1Kseg75tVg1tzBzsF+7c+YR5YnX7S/uQd0Xd/VWu970ATbESKstSz uEouQzjMy8EqI9qBaBRF5861DYB4dXc00LgU0BdkNQm6njeh9UhZa1oRoqhxAU4tNJ/m EiCcuVt4A8mAv+z/1Y96gfOxvFc3I0qDHQR1xgNQa+pdJOFlkxv8ih+OIy8RK31oi5P8 7cTSevCzHChj8QJr7fs6Q9iT442HGiLcyZaJ2TB6KMnszSfIuVMRCHwHu0dkd37I0Vn9 7ckQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=q6SHSCxJiHGQF4QfpaX3nRVg8m6YRSNMVYyC2thysFM=; fh=TNZnuejRHwU7DYuC8gHYeOU65/nASn5LRneKZ2qo53Y=; b=SvxiCfT0U63OuI+mgEGafCMWvb9LsL/W4QvtPsFITehCQ8lvwfG4Z2KFK0Z4gRat3Z 1SzSnLw0jv8WE/JC7bqAFzd5IUu2/TBK/34W/AQctBhu+eXMr3ztzZGN/U1C4Bg1zItM 6ZsHI753XEW7qNmE2/wPEVZkJXNsWexA0tN/WTNnGvXtu3/VkUlZUfJCobHVhcjqMRlD VYwl9DscOM/c7LwYTYyl/uFKJnM7++MKOMvGmzbrXB/z/7Yved5kbCZS+9cl5xyoAmmw Xlhy55w59/XPbsCylwfENra7g4AZ0gFnO1hPFgPcg3cXS7xg1JWK7TvjytFkiWU/3xrN y+sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kJP5UOUD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a75fbe69si603016a91.55.2024.06.11.20.42.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 20:42:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kJP5UOUD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3676-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A2FB8B20F70 for ; Wed, 12 Jun 2024 03:41:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B01E317C77; Wed, 12 Jun 2024 03:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kJP5UOUD" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 889821799B for ; Wed, 12 Jun 2024 03:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718163714; cv=none; b=HJfToMyANoNWP724w1/Rou7wxURii+Ynj9uRUoFFSdeo1KFBKMzwL1J8mtvQSRIz3eE8mu62hBozjzCuHLbpoxMsjUrIKp8SDUCve/OnBm+Qc4kWVb88VlDilp4ogsjHouEDYXks+2fmx15XbIyE1ydz4K5SRoO9C3VO/GrRBSs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718163714; c=relaxed/simple; bh=ga/MqvU3cJ12Z0Xy0eMQNUSeR6ri4EDCii7QV3c1On4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OXIgrlPhcTRp7EbVnrsoKslhCXb1lRCV3kqF2TOrcGhfOmVuUeCgSvnzKD2WREQBk/pXpFxwvAqYC8cPThSYB0niF98J8LkkEIX9McIyrrkqu2XTcTAX/fMnYYi3GwMhuHnAh0FC76pjhpv/UfW+kI7xS33GIU7bI3IvZVmaCVs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kJP5UOUD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8CA2C2BD10; Wed, 12 Jun 2024 03:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718163714; bh=ga/MqvU3cJ12Z0Xy0eMQNUSeR6ri4EDCii7QV3c1On4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kJP5UOUDxTIvMJRMYU335fTF4dwnRrexS/sraxn8URKcVQzHkgsUh64RM1lriQ3E+ JBy7vtG4RgjrgPf/VOGLTCsWkCC7451/DmbtyEV1C+naguGz6ZJT/OuOVnRPOLerde nRmTtATT/4OuwlnU9Y23+gRGP6qRxqIIdzSdvBgNWxCU5uFzRhFqG41gOw43YCq9rJ SnMTO0Otzax7nVXZ38f1bNv+Oz4Ou/23+Lbb7Apk0rdGUWFY41Q1TeVw6uFqFCgLfC 2U5dlvX7VV6r+KzqHXa13nxJjc+kzUGiX8BrPmyx+i4uneSRIjh5jaNMIygXCWjT5L UhY8iSu2uRzwA== Date: Tue, 11 Jun 2024 23:41:52 -0400 From: Mike Snitzer To: NeilBrown Cc: Jeff Layton , linux-nfs@vger.kernel.org, Chuck Lever , Trond Myklebust , snitzer@hammerspace.com Subject: Re: [for-6.11 PATCH 10/29] nfs/nfsd: add "local io" support Message-ID: References: <> <171816222529.14261.9832643931623454806@noble.neil.brown.name> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <171816222529.14261.9832643931623454806@noble.neil.brown.name> On Wed, Jun 12, 2024 at 01:17:05PM +1000, NeilBrown wrote: > On Wed, 12 Jun 2024, Mike Snitzer wrote: > > > > SO I looked, and I'm saddened to see Neil's 6.8 commit 1e3577a4521e > > ("SUNRPC: discard sv_refcnt, and svc_get/svc_put"). > > > > [the lack of useful refcounting with the current code kind of blew me > > away.. but nice to see it existed not too long ago.] > > > > Rather than immediately invest the effort to revert commit > > 1e3577a4521e for my apparent needs... I'll send out v2 to allow for > > further review and discussion. > > > > But it really does feel like I _need_ svc_{get,put} and nfsd_{get,put} > > You are taking a reference, and at the right time. But it is to the > wrong thing. Well, that reference is to ensure nfsd (and nfsd_open_local_fh) is available for the duration of a local client connected to it. Really wasn't trying to keep nn->nfsd_serv around with this ;) > You call symbol_request(nfsd_open_local_fh) and so get a reference to > the nfsd module. But you really want a reference to the nfsd service. > > I would suggest that you use symbol_request() to get a function which > you then call and immediately symbol_put().... unless you need to use it > to discard the reference to the service later. Getting the nfsd_open_local_fh symbol once when client handshakes with server is meant to avoid needing to do so for every IO the client issues to the local server. > The function would take nfsd_mutex, check there is an nfsd_serv, sets a > flag or whatever to indicate the serv is being used for local_io, and > maybe returns the nfsd_serv. As long as that flag is set the serv > cannot be destroy. > > Do you need there to be available threads for LOCAL_IO to work? If so > the flag would cause setting the num threads to zero to fail. > If not .... that is weird. It would mean that setting the number of > threads to zero would not destroy the service and I don't think we want > to do that. > > So I think that when LOCAL_IO is in use, setting number of threads to > zero must return EBUSY or similar, even if you don't need the threads. Yes, but I really dislike needing to play games with a tangential characteristic of nfsd_serv (that threads are what hold reference), rather than have the ability to keep the nfsd_serv around in a cleaner way. This localio code doesn't run in nfsd context so it isn't using nfsd's threads. Forcing threads to be held in reserve because localio doesn't want nfsd_serv to go away isn't ideal. Does it maybe make sense to introduce a more narrow svc_get/svc_put for this auxillary usecase? Thanks, Mike