Skip to content

fs: listmount()/statmount() fix and sample program

Jeff Layton linux-fsdevel lkml 2 versions – Applied

Status from this message: Applied to the vfs-6.14.misc branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected] change-id 20241112-statmount-77808bc02302

Versions newest first

  1. v2 Latest2 patches 1 replyApplied
  2. v11 patch 3 repliesSuperseded

Changes in v2 from the cover letter

- fixed off-by-one bug in listmount last_mnt_id handling
- patch to add the security mount options to statmount()
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2samples: add a mountinfo program to demonstrate statmount()/listmount()samples/vfs/.gitignore samples/vfs/Makefile samples/vfs/mountinfo.c+273 -10 replies
2/2fs: prepend statmount.mnt_opts string with security_sb_mnt_opts()fs/namespace.c+4 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/2] fs: listmount()/statmount() fix and sample program

We had some recent queries internally asking how to use the new statmount() and listmount() interfaces. I was doing some other work in this area, so I whipped up this tool.

My hope is that this will represent something of a "rosetta stone" for how to translate between mountinfo and statmount(), and an example for other people looking to use the new interfaces.

It may also be possible to use this as the basis for a listmount() and statmount() testcase. We can call this program, and compare its output to the mountinfo file.

The second patch adds security mount options to the existing mnt_opts in the statmount() interface, which I think is the final missing piece here. The alternative to doing that would be to add a new string field for that, but I'm not sure that's worthwhile.

---
Changes in v2:
- fixed off-by-one bug in listmount last_mnt_id handling
- patch to add the security mount options to statmount()
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Jeff Layton (2):
samples: add a mountinfo program to demonstrate statmount()/listmount()
fs: prepend statmount.mnt_opts string with security_sb_mnt_opts()

 fs/namespace.c          |   4 +
 samples/vfs/.gitignore  |   1 +
 samples/vfs/Makefile    |   2 +-
 samples/vfs/mountinfo.c | 271 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 277 insertions(+), 1 deletion(-)

---
base-commit: 4be4eaeb1a60a7d52e66123f2f52f2da017c9881
change-id: 20241112-statmount-77808bc02302

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>