Skip to content

NFS: Create NFS Modules

[email protected] linux-nfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest23 patches 4 repliesIn review
  2. v1 RFC21 patches 4 repliesSuperseded

Changes in v4 from the cover letter

-------------
- Use request_module to load modules
- Correct Makefile for $(CONFIG_NFS_V3_ACL)
- Various compiler errors found while changing CONFIG_NFS_* values
- Fix dependency cycle with NFS v4.1 enabled

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23NFS: Relocate the stat_to_errno() functionfs/nfs/client.c fs/nfs/nfs2xdr.c+66 -640 replies
2/23NFS: Make v2 configurablefs/nfs/Kconfig fs/nfs/Makefile fs/nfs/client.c+22 -30 replies
3/23NFS: Add version registering frameworkfs/lockd/clnt4xdr.c fs/lockd/clntxdr.c fs/lockd/mon.c +17 more+280 -634 replies
4/23NFS: Convert v2 into a modulefs/nfs/Kconfig fs/nfs/Makefile fs/nfs/client.c +5 more+34 -70 replies
5/23NFS: Break up the nfs_fs_mount functionfs/nfs/client.c fs/nfs/nfs.h fs/nfs/nfs2super.c +4 more+96 -410 replies
6/23NFS: Create a single nfs_clone_super() functionfs/nfs/super.c+7 -260 replies
7/23NFS: Version specific xdev mountingfs/nfs/nfs.h fs/nfs/nfs2super.c fs/nfs/nfs3super.c +3 more+56 -1040 replies
8/23NFS: Only initialize the ACL client in the v3 casefs/nfs/Makefile fs/nfs/client.c fs/nfs/nfs.h +5 more+88 -500 replies
9/23NFS: Convert v3 into a modulefs/nfs/Kconfig fs/nfs/Makefile fs/nfs/client.c +11 more+108 -900 replies
10/23NFS: Initialize NFS v4 from nfs4super.cfs/nfs/Makefile fs/nfs/client.c fs/nfs/inode.c +5 more+57 -780 replies
11/23NFS: Move lots of code from super.cfs/nfs/nfs.h fs/nfs/nfs4super.c fs/nfs/super.c+625 -6250 replies
12/23NFS: module-specific submount functionfs/nfs/namespace.c fs/nfs/nfs.h fs/nfs/nfs2super.c +5 more+61 -330 replies
13/23NFS: Custom alloc and free client functions for modulesfs/nfs/Makefile fs/nfs/client.c fs/nfs/nfs.h +5 more+127 -760 replies
14/23NFS: Move nfs4_set_client() and support code to nfs4client.cfs/nfs/client.c fs/nfs/nfs.h fs/nfs/nfs4client.c+356 -3420 replies
15/23NFS: Move the nfs4_init_client() to nfs4client.cfs/nfs/client.c fs/nfs/nfs.h fs/nfs/nfs4client.c+132 -1310 replies
16/23NFS: Move the v4 getroot code to nfs4getroot.cfs/nfs/Makefile fs/nfs/getroot.c fs/nfs/nfs.h +1 more+141 -1350 replies
17/23NFS: Deal with delegationsfs/nfs/delegation.c fs/nfs/delegation.h fs/nfs/inode.c +6 more+57 -390 replies
18/23NFS: Create a v4-specific fsync functionfs/nfs/Makefile fs/nfs/file.c fs/nfs/nfs.h +2 more+105 -580 replies
19/23NFS: Create custom NFS v4 write_inode() functionfs/nfs/nfs4super.c fs/nfs/write.c+20 -160 replies
20/23NFS: Create custom init_read() and init_write() functionsfs/nfs/internal.h fs/nfs/nfs.h fs/nfs/nfs2super.c +7 more+36 -180 replies
21/23NFS: Give modules a custom set / unset layoutdriver functionsfs/nfs/client.c fs/nfs/nfs.h fs/nfs/nfs2super.c +2 more+32 -20 replies
22/23NFS: Use the IS_ENABLED macro for CONFIG_NFS_V4fs/nfs/callback.h fs/nfs/client.c fs/nfs/delegation.h +13 more+42 -420 replies
23/23NFS: Convert v4 into a modulefs/nfs/Kconfig fs/nfs/Makefile fs/nfs/client.c +14 more+95 -230 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 00/23] NFS: Create NFS Modules

From: Bryan Schumaker <[email protected]>

This patch series turns NFS v2, v3 and v4 into loadable kernel modules that are requested before using. This should eventually help clean up all of the NFS code by giving us a chance to remove most of the ifdefs that check for CONFIG_NFS_V3 and CONFIG_NFS_V4.

I have tried to move as little code as possible while making these patches since version specific code can be moved later once the basic framework has been merged and tested. I still had to move a large chunk of code out of super.c and into nfs4super.c, but the other files are mostly untouched.

Initial size (without v4.1):
584 nfs.ko (without v4.1)

Final sizes (without v4.1):
312 nfs.ko
44 nfs2.ko
68 nfs3.ko
264 nfs4.ko

Initial size (with v4.1):
708 nfs.ko

Final sizes (with v4.1):
316 nfs.ko
44 nfs2.ko
68 nfs3.ko
384 nfs4.ko

Patch Map
---------
- Patch 1 moves a function out of v2-specific code
- Patch 2 makes NFS v2 configurable
- Patch 3 adds the modules framework
- Patch 4 makes NFS v2 an optional kernel module
- Patches 5 - 9 make NFS v3 an optional kernel module
- Patches 10 - 24 make NFS v4 an optional kernel module

Changes in v4
-------------
- Use request_module to load modules
- Correct Makefile for $(CONFIG_NFS_V3_ACL)
- Various compiler errors found while changing CONFIG_NFS_* values
- Fix dependency cycle with NFS v4.1 enabled

Known bug
---------
I found that if 2 - 3 threads all try to mount NFS v4 at almost the exact same time then try_then_request_module() will sometimes return success before the nfs4.ko module is fully initialized. This leads to get_nfs_version() returning -EPROTONOSUPPORT to one thread (the others are all able to use v4 without a problem). Doing schedule() then try_then_request_module() a second time seems to fix the problem, but that feels more like a workaround than a real fix.

I've left it out for now with hope that there is a better way to handle this. For my own testing, I've started doing modprobe nfs4 before mounting anything using NFS 4.

Comments and suggestions are appreciated. Thanks!

- Bryan

Bryan Schumaker (23):
NFS: Relocate the stat_to_errno() function
NFS: Make v2 configurable
NFS: Add version registering framework
NFS: Convert v2 into a module
NFS: Break up the nfs_fs_mount function
NFS: Create a single nfs_clone_super() function
NFS: Version specific xdev mounting
NFS: Only initialize the ACL client in the v3 case
NFS: Convert v3 into a module
NFS: Initialize NFS v4 from nfs4super.c
NFS: Move lots of code from super.c
NFS: module-specific submount function
NFS: Custom alloc and free client functions for modules
NFS: Move nfs4_set_client() and support code to nfs4client.c
NFS: Move the nfs4_init_client() to nfs4client.c
NFS: Move the v4 getroot code to nfs4getroot.c
NFS: Deal with delegations
NFS: Create a v4-specific fsync function
NFS: Create custom NFS v4 write_inode() function
NFS: Create custom init_read() and init_write() functions
NFS: Give modules a custom set / unset layoutdriver functions
NFS: Use the IS_ENABLED macro for CONFIG_NFS_V4
NFS: Convert v4 into a module

 fs/lockd/clnt4xdr.c               |    2 +-
 fs/lockd/clntxdr.c                |    6 +-
 fs/lockd/mon.c                    |    4 +-
 fs/nfs/Kconfig                    |   13 +-
 fs/nfs/Makefile                   |   25 +-
 fs/nfs/callback.h                 |    2 +-
 fs/nfs/client.c                   |  799 ++++++++-----------------------
 fs/nfs/delegation.c               |    8 +-
 fs/nfs/delegation.h               |   11 +-
 fs/nfs/dir.c                      |   77 ++-
 fs/nfs/direct.c                   |    2 +-
 fs/nfs/dns_resolve.c              |    3 +
 fs/nfs/file.c                     |  114 ++---
 fs/nfs/fscache.c                  |    3 +
 fs/nfs/getroot.c                  |  136 +-----
 fs/nfs/inode.c                    |   72 +--
 fs/nfs/internal.h                 |   19 +-
 fs/nfs/mount_clnt.c               |    6 +-
 fs/nfs/namespace.c                |   59 +--
 fs/nfs/netns.h                    |    2 +-
 fs/nfs/nfs.h                      |  147 ++++++
 fs/nfs/nfs2super.c                |   92 ++++
 fs/nfs/nfs2xdr.c                  |   66 +--
 fs/nfs/nfs3client.c               |   75 +++
 fs/nfs/nfs3super.c                |  123 +++++
 fs/nfs/nfs3xdr.c                  |    4 +-
 fs/nfs/nfs4_fs.h                  |   24 +-
 fs/nfs/nfs4client.c               |  543 +++++++++++++++++++++
 fs/nfs/nfs4file.c                 |   57 +++
 fs/nfs/nfs4getroot.c              |  135 ++++++
 fs/nfs/nfs4namespace.c            |   11 +
 fs/nfs/nfs4proc.c                 |    8 +-
 fs/nfs/nfs4super.c                |  703 +++++++++++++++++++++++++++
 fs/nfs/{sysctl.c => nfs4sysctl.c} |   43 +-
 fs/nfs/nfs4xdr.c                  |    2 +-
 fs/nfs/pagelist.c                 |    3 +
 fs/nfs/pnfs.c                     |   16 +-
 fs/nfs/pnfs.h                     |   13 +-
 fs/nfs/read.c                     |    8 +-
 fs/nfs/super.c                    |  938 ++++++-------------------------------
 fs/nfs/sysctl.c                   |   26 -
 fs/nfs/unlink.c                   |    3 +-
 fs/nfs/write.c                    |   36 +-
 fs/nfsd/nfs4callback.c            |    2 +-
 include/linux/lockd/xdr4.h        |    2 +-
 include/linux/nfs_fs.h            |   10 +-
 include/linux/nfs_fs_sb.h         |    6 +-
 include/linux/nfs_idmap.h         |    2 +-
 include/linux/nfs_xdr.h           |   12 +-
 include/linux/sunrpc/clnt.h       |    2 +-
 net/sunrpc/rpcb_clnt.c            |    8 +-
 51 files changed, 2530 insertions(+), 1953 deletions(-)
 create mode 100644 fs/nfs/dangling.txt
 create mode 100644 fs/nfs/nfs.h
 create mode 100644 fs/nfs/nfs2super.c
 create mode 100644 fs/nfs/nfs3client.c
 create mode 100644 fs/nfs/nfs3super.c
 create mode 100644 fs/nfs/nfs4client.c
 create mode 100644 fs/nfs/nfs4file.c
 create mode 100644 fs/nfs/nfs4getroot.c
 create mode 100644 fs/nfs/nfs4super.c
 copy fs/nfs/{sysctl.c => nfs4sysctl.c} (51%)
Signature · 1 line
1.7.9.4