Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neilb@ownmail.net>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v2 00/42] Clarify module API boundaries
Date: Mon, 26 Jan 2026 07:51:34 -0500	[thread overview]
Message-ID: <448bfee54bdf87e6f2fd8895697c9b4c001e70e2.camel@kernel.org> (raw)
In-Reply-To: <20260123185259.1215767-1-cel@kernel.org>

On Fri, 2026-01-23 at 13:52 -0500, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> The first thirteen patches in this series refactor the lockd code
> base to clearly separate its public API from internal implementation
> details. The remainder are presented for context, but demonstrate
> the intended purpose of the clean-up in the first thirteen.
> 
> The lockd subsystem currently exposes internal implementation headers
> through include/linux/lockd/, creating implicit API contracts that
> complicate maintenance. External consumers such as NFSD and the NFS
> client have developed dependencies on internal structures like struct
> nlm_host, and wire protocol constants leak into high-level module
> interfaces.
> 
> These patches work to establish clean architectural boundaries. The
> public API in include/linux/lockd/ is reduced to bind.h and nlm.h,
> which define the contract between lockd and its consumers. Private
> implementation details including XDR definitions, share management,
> and host structures are relocated to fs/lockd/ where they belong.
> Layering violations are corrected: the NFS client now uses accessor
> helpers instead of dereferencing internal structures, and nlm_fopen()
> returns errno values instead of wire protocol codes.
> 
> These changes enable subsequent work to modernize the NLMv4 XDR
> layer using xdrgen without risk of breaking external consumers.
> This work appears in the remaining patches in this series, which
> are presented here only to provide context for the API adjustments.
> No need to review those closely just yet.
> 
> The series is based on the public nfsd-testing branch.
> 
> ---
> 
> Changes since v1:
> - Refine the pre-requisite header adjustments
> - Reduce stack consumption by moving large structures to wrappers
> - Additional extensive clean up
> 
> Chuck Lever (42):
>   lockd: Simplify cast_status() in svcproc.c
>   lockd: Introduce nlm__int__deadlock
>   lockd: Have nlm_fopen() return errno values
>   lockd: Relocate nlmsvc_unlock API declarations
>   NFS: Use nlmclnt_rpc_clnt() helper to retrieve nlm_host's rpc_clnt
>   lockd: Move xdr4.h from include/linux/lockd/ to fs/lockd/
>   lockd: Move share.h from include/linux/lockd/ to fs/lockd/
>   lockd: Relocate include/linux/lockd/lockd.h
>   lockd: Remove lockd/debug.h
>   lockd: Move xdr.h from include/linux/lockd/ to fs/lockd/
>   lockd: Make linux/lockd/nlm.h an internal header
>   lockd: Move nlm4svc_set_file_lock_range()
>   lockd: Relocate svc_version definitions to XDR layer
>   Documentation: Add the RPC language description of NLM version 4
>   lockd: Use xdrgen XDR functions for the NLMv4 NULL procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 TEST procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 LOCK procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 CANCEL procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 UNLOCK procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 GRANTED procedure
>   lockd: Refactor nlm4svc_callback()
>   lockd: Use xdrgen XDR functions for the NLMv4 TEST_MSG procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 LOCK_MSG procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 CANCEL_MSG procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 UNLOCK_MSG procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 GRANTED_MSG procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 TEST_RES procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 LOCK_RES procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 CANCEL_RES procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 UNLOCK_RES procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 GRANTED_RES procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 SM_NOTIFY procedure
>   lockd: Convert server-side undefined procedures to xdrgen
>   lockd: Hoist file_lock init out of nlm4svc_decode_shareargs()
>   lockd: Prepare share helpers for xdrgen conversion
>   lockd: Use xdrgen XDR functions for the NLMv4 SHARE procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 UNSHARE procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 NM_LOCK procedure
>   lockd: Use xdrgen XDR functions for the NLMv4 FREE_ALL procedure
>   lockd: Add LOCKD_SHARE_SVID constant for DOS sharing mode
>   lockd: Remove C macros that are no longer used
>   lockd: Remove dead code from fs/lockd/xdr4.c
> 
>  Documentation/sunrpc/xdr/nlm4.x     |  211 ++++
>  fs/lockd/Makefile                   |   30 +-
>  fs/lockd/clnt4xdr.c                 |    5 +-
>  fs/lockd/clntlock.c                 |    2 +-
>  fs/lockd/clntproc.c                 |    2 +-
>  fs/lockd/clntxdr.c                  |    3 +-
>  fs/lockd/host.c                     |    2 +-
>  {include/linux => fs}/lockd/lockd.h |   99 +-
>  fs/lockd/mon.c                      |    2 +-
>  {include/linux => fs}/lockd/nlm.h   |    8 +-
>  fs/lockd/nlm4xdr_gen.c              |  724 +++++++++++
>  fs/lockd/nlm4xdr_gen.h              |   32 +
>  {include/linux => fs}/lockd/share.h |   19 +-
>  fs/lockd/svc.c                      |   50 +-
>  fs/lockd/svc4proc.c                 | 1783 ++++++++++++++++++---------
>  fs/lockd/svclock.c                  |   12 +-
>  fs/lockd/svcproc.c                  |   99 +-
>  fs/lockd/svcshare.c                 |   40 +-
>  fs/lockd/svcsubs.c                  |   32 +-
>  fs/lockd/trace.h                    |    3 +-
>  fs/lockd/xdr.c                      |    6 +-
>  {include/linux => fs}/lockd/xdr.h   |   15 +-
>  fs/lockd/xdr4.c                     |  347 ------
>  fs/nfs/sysfs.c                      |   10 +-
>  fs/nfsd/lockd.c                     |   51 +-
>  fs/nfsd/nfsctl.c                    |    2 +-
>  include/linux/lockd/bind.h          |   23 +-
>  include/linux/lockd/debug.h         |   40 -
>  include/linux/lockd/xdr4.h          |   43 -
>  include/linux/sunrpc/xdrgen/nlm4.h  |  233 ++++
>  30 files changed, 2750 insertions(+), 1178 deletions(-)
>  create mode 100644 Documentation/sunrpc/xdr/nlm4.x
>  rename {include/linux => fs}/lockd/lockd.h (84%)
>  rename {include/linux => fs}/lockd/nlm.h (91%)
>  create mode 100644 fs/lockd/nlm4xdr_gen.c
>  create mode 100644 fs/lockd/nlm4xdr_gen.h
>  rename {include/linux => fs}/lockd/share.h (58%)
>  rename {include/linux => fs}/lockd/xdr.h (91%)
>  delete mode 100644 fs/lockd/xdr4.c
>  delete mode 100644 include/linux/lockd/debug.h
>  delete mode 100644 include/linux/lockd/xdr4.h
>  create mode 100644 include/linux/sunrpc/xdrgen/nlm4.h

I went through the series and it looks good overall. I definitely like
moving away from hand-rolled XDR handling. You can add this to the
series:

Reviewed-by: Jeff Layton <jlayton@kernel.org>

There is still the matter of the race vs. the shutdown file, but that's
a preexisting problem. I presume you intend to let this sit in -next
for a while? It's a big change so it'd be good to have a nice long test
cycle with it.

  parent reply	other threads:[~2026-01-26 12:51 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 18:52 [PATCH v2 00/42] Clarify module API boundaries Chuck Lever
2026-01-23 18:52 ` [PATCH v2 01/42] lockd: Simplify cast_status() in svcproc.c Chuck Lever
2026-01-23 18:52 ` [PATCH v2 02/42] lockd: Introduce nlm__int__deadlock Chuck Lever
2026-01-26 12:34   ` Jeff Layton
2026-01-26 14:36     ` Chuck Lever
2026-01-23 18:52 ` [PATCH v2 03/42] lockd: Have nlm_fopen() return errno values Chuck Lever
2026-01-23 18:52 ` [PATCH v2 04/42] lockd: Relocate nlmsvc_unlock API declarations Chuck Lever
2026-01-23 18:52 ` [PATCH v2 05/42] NFS: Use nlmclnt_rpc_clnt() helper to retrieve nlm_host's rpc_clnt Chuck Lever
2026-01-23 20:23   ` Jeff Layton
2026-01-23 20:44     ` Chuck Lever
2026-01-23 21:30       ` Jeff Layton
2026-01-23 21:37         ` Chuck Lever
2026-01-23 18:52 ` [PATCH v2 06/42] lockd: Move xdr4.h from include/linux/lockd/ to fs/lockd/ Chuck Lever
2026-01-23 18:52 ` [PATCH v2 07/42] lockd: Move share.h " Chuck Lever
2026-01-23 18:52 ` [PATCH v2 08/42] lockd: Relocate include/linux/lockd/lockd.h Chuck Lever
2026-01-23 18:52 ` [PATCH v2 09/42] lockd: Remove lockd/debug.h Chuck Lever
2026-01-23 18:52 ` [PATCH v2 10/42] lockd: Move xdr.h from include/linux/lockd/ to fs/lockd/ Chuck Lever
2026-01-24  1:20   ` kernel test robot
2026-01-24  2:57   ` kernel test robot
2026-01-23 18:52 ` [PATCH v2 11/42] lockd: Make linux/lockd/nlm.h an internal header Chuck Lever
2026-01-23 18:52 ` [PATCH v2 12/42] lockd: Move nlm4svc_set_file_lock_range() Chuck Lever
2026-01-23 18:52 ` [PATCH v2 13/42] lockd: Relocate svc_version definitions to XDR layer Chuck Lever
2026-01-23 18:52 ` [PATCH v2 14/42] Documentation: Add the RPC language description of NLM version 4 Chuck Lever
2026-01-23 18:52 ` [PATCH v2 15/42] lockd: Use xdrgen XDR functions for the NLMv4 NULL procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 16/42] lockd: Use xdrgen XDR functions for the NLMv4 TEST procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 17/42] lockd: Use xdrgen XDR functions for the NLMv4 LOCK procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 18/42] lockd: Use xdrgen XDR functions for the NLMv4 CANCEL procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 19/42] lockd: Use xdrgen XDR functions for the NLMv4 UNLOCK procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 20/42] lockd: Use xdrgen XDR functions for the NLMv4 GRANTED procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 21/42] lockd: Refactor nlm4svc_callback() Chuck Lever
2026-01-23 18:52 ` [PATCH v2 22/42] lockd: Use xdrgen XDR functions for the NLMv4 TEST_MSG procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 23/42] lockd: Use xdrgen XDR functions for the NLMv4 LOCK_MSG procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 24/42] lockd: Use xdrgen XDR functions for the NLMv4 CANCEL_MSG procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 25/42] lockd: Use xdrgen XDR functions for the NLMv4 UNLOCK_MSG procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 26/42] lockd: Use xdrgen XDR functions for the NLMv4 GRANTED_MSG procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 27/42] lockd: Use xdrgen XDR functions for the NLMv4 TEST_RES procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 28/42] lockd: Use xdrgen XDR functions for the NLMv4 LOCK_RES procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 29/42] lockd: Use xdrgen XDR functions for the NLMv4 CANCEL_RES procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 30/42] lockd: Use xdrgen XDR functions for the NLMv4 UNLOCK_RES procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 31/42] lockd: Use xdrgen XDR functions for the NLMv4 GRANTED_RES procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 32/42] lockd: Use xdrgen XDR functions for the NLMv4 SM_NOTIFY procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 33/42] lockd: Convert server-side undefined procedures to xdrgen Chuck Lever
2026-01-23 18:52 ` [PATCH v2 34/42] lockd: Hoist file_lock init out of nlm4svc_decode_shareargs() Chuck Lever
2026-01-23 18:52 ` [PATCH v2 35/42] lockd: Prepare share helpers for xdrgen conversion Chuck Lever
2026-01-23 18:52 ` [PATCH v2 36/42] lockd: Use xdrgen XDR functions for the NLMv4 SHARE procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 37/42] lockd: Use xdrgen XDR functions for the NLMv4 UNSHARE procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 38/42] lockd: Use xdrgen XDR functions for the NLMv4 NM_LOCK procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 39/42] lockd: Use xdrgen XDR functions for the NLMv4 FREE_ALL procedure Chuck Lever
2026-01-23 18:52 ` [PATCH v2 40/42] lockd: Add LOCKD_SHARE_SVID constant for DOS sharing mode Chuck Lever
2026-01-23 18:52 ` [PATCH v2 41/42] lockd: Remove C macros that are no longer used Chuck Lever
2026-01-23 18:52 ` [PATCH v2 42/42] lockd: Remove dead code from fs/lockd/xdr4.c Chuck Lever
2026-01-26 12:51 ` Jeff Layton [this message]
2026-01-26 14:35   ` [PATCH v2 00/42] Clarify module API boundaries Chuck Lever

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=448bfee54bdf87e6f2fd8895697c9b4c001e70e2.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@ownmail.net \
    --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