Skip to content

nfs mbt: add a generic external VFS backend to the replayers - #1916

Draft
suniljoshi137 wants to merge 1 commit into
chimera-nas:mainfrom
suniljoshi137:mbt-ext-backend
Draft

suniljoshi137 wants to merge 1 commit into
chimera-nas:mainfrom
suniljoshi137:mbt-ext-backend

Conversation

@suniljoshi137

Copy link
Copy Markdown
Collaborator

Summary

Adds --backend ext to the NFS model-based trace replayers (nfs3_mbt_replay and nfs4_mbt_replay; the aux and drc replayers include the same header and gain the option too, but only the nfs3 and nfs4 ones were exercised). It loads an out-of-tree VFS module the same way the daemon does, so a module built outside this repository can be replayed against the same Quint-generated corpus and model as memfs, diskfs, cairn, linux and io_uring.

Why

The replayers hard-code the list of backends. A downstream VFS module (built against src/vfs/sdk) has no way to reuse the corpus and the in-process server/client harness; it would have to carry a private copy of the replayers or re-implement the harness. With this change it needs only a shared object.

How it works

The module is configured through the environment, so none of the replayers' option parsing changes:

Variable Meaning
CHIMERA_MBT_EXT_NAME Module name (required)
CHIMERA_MBT_EXT_PATH Shared object to load
CHIMERA_MBT_EXT_CONFIG Module config JSON
CHIMERA_MBT_EXT_MOUNT Path passed to the module's mount (default /); the first %s is replaced by the per-trace filesystem name

A module has no mkfs, so each trace is a fresh mount of that path and the filesystem is not removed at the end of the trace (rmfs is skipped). The module therefore has to give every mount an empty tree of its own, for example by mounting a new subdirectory per trace. The mount template comes from the environment and is substituted by hand, never used as a printf format. The option is documented in docs/vfs-module-sdk.md and added to the replayers' usage text.

Built-in behaviour is unchanged: the new code is only reached when --backend ext is given.

Testing

On Ubuntu 24.04, release build, cairn and GSSAPI off (no rocksdb/krb5 headers on the build host), against main at 38fcd25:

  • uncrustify 0.78.1 with etc/uncrustify.cfg reports no formatting issue in any touched C/H file.
  • nfs4_mbt_replay --trace-dir <corpus>/nfs4/memfs41_root and nfs3_mbt_replay --trace-dir <corpus>/nfs3/ref on memfs: exit 0, all traces replayed, as before.
  • --backend ext without CHIMERA_MBT_EXT_NAME exits with --backend ext needs CHIMERA_MBT_EXT_NAME.
  • An out-of-tree module (built against an older SDK) is found, loaded and checked: chimera rejects it with module ... was built against VFS SDK version 6; this chimera provides version 7, which is the expected version check.
  • An earlier revision of this change, on an older base, ran the corpus end to end against an out-of-tree module, one process per trace with a fresh mount each.

Not run: the full make check sweep (debug build, scan-build, reuse-lint, copyright-check) and the extended tier.

Notes for review

  • --backend ext is treated like a new backend by the replayers' strictness logic: the checks that are relaxed for the built-in passthrough backends (linux, io_uring) are keyed on the backend name, so an external module is held to the strict model. Say if you would rather it were configurable.
  • Environment variables rather than command-line options keep the change to one shared header. I can switch to options if you prefer that interface.
  • I did not add a ctest case: there is no in-tree module to point it at that is not already covered by the built-in backends. Suggestions welcome.

The NFS model-based trace replayers can only run against the built-in
backends (memfs, diskfs, cairn, linux, io_uring). Add --backend ext, which
loads an out-of-tree VFS module the way the daemon does (by name, optionally
from a shared object path), so such a module can be held to the same model
and corpus as the in-tree backends.

The module is configured through the environment, so the replayers' option
parsing does not change:

  CHIMERA_MBT_EXT_NAME    module name (required)
  CHIMERA_MBT_EXT_PATH    shared object to load
  CHIMERA_MBT_EXT_CONFIG  module config JSON
  CHIMERA_MBT_EXT_MOUNT   path handed to the module's mount; the first %s is
                          replaced by the per-trace filesystem name

A module has no mkfs, so each trace is a fresh mount of that path and the
filesystem is not removed afterwards; the module has to give every mount an
empty tree of its own. The template is substituted by hand and never used as
a printf format. Document the option in the VFS module SDK doc and add it to
the replayers' usage text.
@github-actions

github-actions Bot commented Dec 6, 2026

Copy link
Copy Markdown

Quick-tier test coverage

Component Functions Lines Branches
src/server/nfs █████████░ 91%
1,144/1,256
████████░░ 77%
24,296/31,441
██████░░░░ 61%
11,914/19,429
src/server/smb █████████░ 89%
698/786
███████░░░ 70%
16,801/23,886
██████░░░░ 59%
6,950/11,844
src/vfs █████████░ 91%
884/976
████████░░ 77%
17,742/22,970
██████░░░░ 63%
6,247/9,883
src/vfs/diskfs ████████░░ 83%
665/800
███████░░░ 75%
12,269/16,425
██████░░░░ 60%
3,135/5,202
src/vfs/nfs ████████░░ 75%
220/293
██████░░░░ 62%
5,461/8,878
█████░░░░░ 48%
1,505/3,124
src/server/s3 █████████░ 92%
313/342
████████░░ 77%
6,495/8,449
██████░░░░ 60%
1,991/3,292
src/posix ███████░░░ 70%
218/312
██████░░░░ 60%
3,270/5,427
█████░░░░░ 51%
843/1,665
src/vfs/memfs ██████████ 96%
93/97
████████░░ 79%
3,878/4,899
███████░░░ 72%
1,509/2,096
src/vfs/cairn ████████░░ 84%
106/126
███████░░░ 73%
3,466/4,772
██████░░░░ 63%
956/1,506
src/vfs/smb ██████████ 99%
173/175
████████░░ 82%
3,521/4,271
██████░░░░ 61%
840/1,366
src/common ████████░░ 79%
148/187
█████░░░░░ 51%
1,897/3,721
███░░░░░░░ 28%
805/2,825
src/server/fuse ████████░░ 77%
150/196
██████░░░░ 62%
2,297/3,700
█████░░░░░ 53%
1,370/2,601
src/server/rest ██████░░░░ 62%
58/94
█████░░░░░ 47%
1,114/2,377
████░░░░░░ 36%
333/938
src/vfs/io_uring █████████░ 93%
51/55
████████░░ 77%
1,783/2,320
██████░░░░ 62%
604/971
src/vfs/linux █████████░ 91%
58/64
███████░░░ 72%
1,675/2,320
██████░░░░ 60%
663/1,111
src/server ███████░░░ 66%
188/284
██████░░░░ 56%
1,175/2,104
████░░░░░░ 36%
190/532
src/client ██████░░░░ 61%
80/132
█████░░░░░ 50%
1,008/2,003
██░░░░░░░░ 24%
83/347
src/smb_common ██████████ 100%
51/51
████████░░ 78%
1,239/1,582
███████░░░ 68%
510/746
src/vfs/sdk █████████░ 94%
32/34
███████░░░ 71%
350/495
████████░░ 79%
129/164
src/nfs_common ██████████ 100%
15/15
███████░░░ 65%
231/355
███████░░░ 75%
139/186
src/vfs/memkv ██████████ 100%
14/14
█████████░ 90%
257/286
███████░░░ 72%
114/158
src/metrics ██████████ 100%
10/10
████████░░ 81%
198/243
██████░░░░ 61%
56/92
Total █████████░ 85%
5,369/6,299
███████░░░ 72%
110,423/152,924
██████░░░░ 58%
40,886/70,078
make coverage CTEST_ARGS="--output-on-failure"

Coverage of this pull request's changes

This pull request changes no instrumented source, so there is nothing to measure.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant