Skip to content

Subject: Clarify module API boundaries

Chuck Lever linux-nfs oe-kbuild-all 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest14 patches 0 repliesNew
  2. v314 patches 0 repliesSuperseded
  3. v242 patches 8 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v136 patches2 repliesSuperseded

Changes in v4 from the cover letter

- Address a build failure due to header reorganization

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14lockd: Simplify cast_status() in svcproc.cfs/lockd/svcproc.c+19 -210 replies
2/14lockd: Relocate and rename nlm_drop_replyfs/lockd/svc4proc.c fs/lockd/svclock.c fs/lockd/svcproc.c +3 more+38 -220 replies
3/14lockd: Introduce nlm__int__deadlockfs/lockd/svc4proc.c fs/lockd/svclock.c fs/lockd/svcproc.c +1 more+13 -100 replies
4/14lockd: Have nlm_fopen() return errno valuesfs/lockd/svc4proc.c fs/lockd/svcproc.c fs/lockd/svcsubs.c +3 more+82 -370 replies
5/14lockd: Relocate nlmsvc_unlock API declarationsfs/nfsd/nfsctl.c include/linux/lockd/bind.h include/linux/lockd/lockd.h+8 -70 replies
6/14NFS: Use nlmclnt_shutdown_rpc_clnt() to safely shut down NLMfs/lockd/host.c fs/nfs/sysfs.c include/linux/lockd/bind.h+32 -20 replies
7/14lockd: Move xdr4.h from include/linux/lockd/ to fs/lockd/fs/lockd/clnt4xdr.c fs/lockd/svc4proc.c fs/lockd/xdr4.c +3 more+12 -180 replies
8/14lockd: Move share.h from include/linux/lockd/ to fs/lockd/fs/lockd/share.h fs/lockd/svc4proc.c fs/lockd/svcproc.c +3 more+12 -90 replies
9/14lockd: Relocate include/linux/lockd/lockd.hfs/lockd/clnt4xdr.c fs/lockd/clntlock.c fs/lockd/clntproc.c +13 more+22 -250 replies
10/14lockd: Remove lockd/debug.hfs/lockd/lockd.h include/linux/lockd/debug.h+23 -410 replies
11/14lockd: Move xdr.h from include/linux/lockd/ to fs/lockd/fs/lockd/lockd.h fs/lockd/xdr.h fs/nfs/nfs3proc.c +1 more+7 -90 replies
12/14lockd: Make linux/lockd/nlm.h an internal headerfs/lockd/lockd.h fs/lockd/nlm.h fs/lockd/svclock.c +1 more+4 -80 replies
13/14lockd: Move nlm4svc_set_file_lock_range()fs/lockd/clnt4xdr.c fs/lockd/lockd.h fs/lockd/xdr4.c +1 more+27 -140 replies
14/14lockd: Relocate svc_version definitions to XDR layerfs/lockd/lockd.h fs/lockd/svc.c fs/lockd/svc4proc.c +2 more+74 -460 replies

Reviews trailers per patch

13 of 14 patches have a Reviewed-by or Acked-by.

PatchJeff Layton
1/14R-b
2/14
3/14R-b
4/14R-b
5/14R-b
6/14R-b
7/14R-b
8/14R-b
9/14R-b
10/14R-b
11/14R-b
12/14R-b
13/14R-b
14/14R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/14] Subject: Clarify module API boundaries

From: Chuck Lever <[email protected]>

The patches in this series refactor the lockd code base to clearly separate its public API from internal implementation and NLM protocol details.

As context, the patches in this series are pre-requisite to the XDR changes posted earlier:

https://lore.kernel.org/linux-nfs/[email protected]/T/#t

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 v3:
- Address a build failure due to header reorganization

Changes since v2:
- Serialize client-side NLM shutdown to avoid UAF and NPD
- Address a build failure due to header reorganization
- Rename internal status code nlm_drop_reply

Changes since v1:
- Refine the pre-requisite header adjustments
- Reduce stack consumption by moving large structures to wrappers
- Additional extensive clean up

Chuck Lever (14):
lockd: Simplify cast_status() in svcproc.c
lockd: Relocate and rename nlm_drop_reply
lockd: Introduce nlm__int__deadlock
lockd: Have nlm_fopen() return errno values
lockd: Relocate nlmsvc_unlock API declarations
NFS: Use nlmclnt_shutdown_rpc_clnt() to safely shut down NLM
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

 fs/lockd/clnt4xdr.c                 |   7 +-
 fs/lockd/clntlock.c                 |   2 +-
 fs/lockd/clntproc.c                 |   2 +-
 fs/lockd/clntxdr.c                  |   3 +-
 fs/lockd/host.c                     |  31 +++++++-
 {include/linux => fs}/lockd/lockd.h |  94 +++++++++++++++++-----
 fs/lockd/mon.c                      |   2 +-
 {include/linux => fs}/lockd/nlm.h   |   8 +-
 {include/linux => fs}/lockd/share.h |   8 +-
 fs/lockd/svc.c                      |  50 +++---------
 fs/lockd/svc4proc.c                 |  77 ++++++++++++++----
 fs/lockd/svclock.c                  |  16 ++--
 fs/lockd/svcproc.c                  | 119 ++++++++++++++++++++--------
 fs/lockd/svcshare.c                 |   5 +-
 fs/lockd/svcsubs.c                  |  32 ++++++--
 fs/lockd/trace.h                    |   3 +-
 fs/lockd/xdr.c                      |   3 +-
 {include/linux => fs}/lockd/xdr.h   |  15 +---
 fs/lockd/xdr4.c                     |  16 +---
 {include/linux => fs}/lockd/xdr4.h  |  16 +---
 fs/nfs/nfs3proc.c                   |   1 +
 fs/nfs/sysfs.c                      |   4 +-
 fs/nfsd/lockd.c                     |  50 +++++++-----
 fs/nfsd/nfsctl.c                    |   2 +-
 include/linux/lockd/bind.h          |  26 +++---
 include/linux/lockd/debug.h         |  40 ----------
 26 files changed, 368 insertions(+), 264 deletions(-)
 rename {include/linux => fs}/lockd/lockd.h (85%)
 rename {include/linux => fs}/lockd/nlm.h (91%)
 rename {include/linux => fs}/lockd/share.h (85%)
 rename {include/linux => fs}/lockd/xdr.h (91%)
 rename {include/linux => fs}/lockd/xdr4.h (80%)
 delete mode 100644 include/linux/lockd/debug.h
Signature · 1 line
2.52.0