Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: "Jeff Layton" <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
	"Olga Kornievskaia" <okorniev@redhat.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	"Chuck Lever" <chuck.lever@oracle.com>
Subject: Re: [PATCH v5 2/7] NFSD: Add NFSD_CMD_UNLOCK_IP netlink command
Date: Fri, 27 Mar 2026 11:19:43 -0400	[thread overview]
Message-ID: <d22d6a1b-13c7-4b02-bf82-d1d701e912c2@app.fastmail.com> (raw)
In-Reply-To: <b7cbff660e5222d3c2b9c48d6040f73132f5f312.camel@kernel.org>



On Fri, Mar 27, 2026, at 8:06 AM, Jeff Layton wrote:
> On Thu, 2026-03-26 at 13:55 -0400, Chuck Lever wrote:

>> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
>> index 988a79ec4a79..e1e89d52e6de 100644
>> --- a/fs/nfsd/nfsctl.c
>> +++ b/fs/nfsd/nfsctl.c

>> @@ -2200,6 +2200,44 @@ int nfsd_nl_pool_mode_get_doit(struct sk_buff *skb, struct genl_info *info)
>>  	return err;
>>  }
>>  
>> +/**
>> + * nfsd_nl_unlock_ip_doit - release NLM locks held by an IP address
>> + * @skb: reply buffer
>> + * @info: netlink metadata and command arguments
>> + *
>> + * Return: 0 on success or a negative errno.
>> + */
>> +int nfsd_nl_unlock_ip_doit(struct sk_buff *skb, struct genl_info *info)
>> +{
>> +	struct sockaddr *sap;
>> +
>> +	if (GENL_REQ_ATTR_CHECK(info, NFSD_A_UNLOCK_IP_ADDRESS))
>> +		return -EINVAL;
>> +	sap = nla_data(info->attrs[NFSD_A_UNLOCK_IP_ADDRESS]);
>> +	switch (sap->sa_family) {
>> +	case AF_INET:
>> +		if (nla_len(info->attrs[NFSD_A_UNLOCK_IP_ADDRESS]) <
>> +		    sizeof(struct sockaddr_in))
>> +			return -EINVAL;
>> +		break;
>> +	case AF_INET6:
>> +		if (nla_len(info->attrs[NFSD_A_UNLOCK_IP_ADDRESS]) <
>> +		    sizeof(struct sockaddr_in6))
>> +			return -EINVAL;
>> +		break;
>> +	default:
>> +		return -EAFNOSUPPORT;
>> +	}
>> +	/*
>> +	 * nlmsvc_unlock_all_by_ip() releases matching locks
>> +	 * across all network namespaces because lockd operates
>> +	 * a single global instance.
>> +	 */
>> +	trace_nfsd_ctl_unlock_ip(genl_info_net(info), sap,
>> +				 svc_addr_len(sap));
>
> All of the tracepoints get passed svc_addr_len(sap) for the length. Any
> reason not to just determine the length inside the tracepoint, so you
> don't need to calc the length unless it's enabled?

Unless I'm mistaken, the trace_nfsd_ctl_unlock_ip() call site
expands to a static branch that skips everything, including
argument evaluation, when the tracepoint is disabled. The
svc_addr_len() call, being part of the argument list, is
already behind that branch.


>> +	return nlmsvc_unlock_all_by_ip(sap);
>> +}
>> +
>>  /**
>>   * nfsd_net_init - Prepare the nfsd_net portion of a new net namespace
>>   * @net: a freshly-created network namespace


-- 
Chuck Lever

  reply	other threads:[~2026-03-27 15:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 17:55 [PATCH v5 0/7] Automatic NFSv4 state revocation on filesystem unmount Chuck Lever
2026-03-26 17:55 ` [PATCH v5 1/7] NFSD: Extract revoke_one_stid() utility function Chuck Lever
2026-03-27  5:26   ` kernel test robot
2026-03-27  5:56   ` kernel test robot
2026-03-27 10:08   ` kernel test robot
2026-03-27 11:13   ` kernel test robot
2026-03-27 12:00   ` Jeff Layton
2026-03-27 12:21   ` Jeff Layton
2026-03-27 14:18     ` Chuck Lever
2026-03-26 17:55 ` [PATCH v5 2/7] NFSD: Add NFSD_CMD_UNLOCK_IP netlink command Chuck Lever
2026-03-27 12:06   ` Jeff Layton
2026-03-27 15:19     ` Chuck Lever [this message]
2026-03-27 15:52       ` Jeff Layton
2026-03-27 16:02         ` Chuck Lever
2026-03-26 17:55 ` [PATCH v5 3/7] NFSD: Add NFSD_CMD_UNLOCK_FILESYSTEM " Chuck Lever
2026-03-26 17:55 ` [PATCH v5 4/7] NFSD: Replace idr_for_each_entry_ul in find_one_sb_stid() Chuck Lever
2026-03-26 17:55 ` [PATCH v5 5/7] NFSD: Track svc_export in nfs4_stid Chuck Lever
2026-03-26 17:55 ` [PATCH v5 6/7] NFSD: Add NFSD_CMD_UNLOCK_EXPORT netlink command Chuck Lever
2026-03-26 17:55 ` [PATCH v5 7/7] NFSD: Close cached file handles when revoking export state Chuck Lever
2026-03-27 12:03 ` [PATCH v5 0/7] Automatic NFSv4 state revocation on filesystem unmount Jeff Layton
2026-03-27 13:29   ` Chuck Lever
2026-03-27 12:18 ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d22d6a1b-13c7-4b02-bf82-d1d701e912c2@app.fastmail.com \
    --to=cel@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).