[PATCH v2 00/31] fs: require filesystems to explicitly opt-in to nfsd export support

Jeff Layton
2026-01-19T16:27:20Z

This patchset adds a flag that indicates whether the filesystem supports
stable filehandles (i.e. that they don't change over the life of the
file). It then makes any filesystem that doesn't set that flag
ineligible for nfsd export.

The main only place I found where this was an issue today is cgroupfs,
which sane people don't export anyway. So, I don't see this as
addressing a major problem that we have today. Rather, this patchset
ensures that new filesystems that are added in the future make export
eligibility via nfsd a deliberate step, rather than something they've
inadvertently enabled just by adding filehandle support.

After some lively bikeshedding on v1, I think the consensus is to stick
with EXPORT_OP_STABLE_HANDLES as the flag name. Amir is correct that
checking this in check_export() is the better place to do this, since
the filehandle can't be decoded without resolving the export first.

There are a few other fixes and cleanups, and some doc updates too.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Changes in v2:
- don't set flag in ovl_export_fid_operations or fuse_export_fid_operations
- check for flag in check_export() instead of __fh_verify()
- document missing flags in exporting.rst
- convert dprintk() messages in check_export() to static tracepoints
- Link to v1: https://lore.kernel.org/r/20260115-exportfs-nfsd-v1-0-8e80160e3c0c@kernel.org

---
Jeff Layton (31):
Documentation: document EXPORT_OP_NOLOCKS
exportfs: add new EXPORT_OP_STABLE_HANDLES flag
tmpfs: add EXPORT_OP_STABLE_HANDLES flag to export operations
ext4: add EXPORT_OP_STABLE_HANDLES flag to export operations
ext2: add EXPORT_OP_STABLE_HANDLES flag to export operations
erofs: add EXPORT_OP_STABLE_HANDLES flag to export operations
efs: add EXPORT_OP_STABLE_HANDLES flag to export operations
xfs: add EXPORT_OP_STABLE_HANDLES flag to export operations
ceph: add EXPORT_OP_STABLE_HANDLES flag to export operations
btrfs: add EXPORT_OP_STABLE_HANDLES flag to export operations
befs: add EXPORT_OP_STABLE_HANDLES flag to export operations
ufs: add EXPORT_OP_STABLE_HANDLES flag to export operations
udf: add EXPORT_OP_STABLE_HANDLES flag to export operations
affs: add EXPORT_OP_STABLE_HANDLES flag to export operations
squashfs: add EXPORT_OP_STABLE_HANDLES flag to export operations
smb/client: add EXPORT_OP_STABLE_HANDLES flag to export operations
ovl: add EXPORT_OP_STABLE_HANDLES flag to export operations
orangefs: add EXPORT_OP_STABLE_HANDLES flag to export operations
ocfs2: add EXPORT_OP_STABLE_HANDLES flag to export operations
ntfs3: add EXPORT_OP_STABLE_HANDLES flag to export operations
nilfs2: add EXPORT_OP_STABLE_HANDLES flag to export operations
nfs: add EXPORT_OP_STABLE_HANDLES flag to export operations
jfs: add EXPORT_OP_STABLE_HANDLES flag to export operations
jffs2: add EXPORT_OP_STABLE_HANDLES flag to export operations
isofs: add EXPORT_OP_STABLE_HANDLES flag to export operations
gfs2: add EXPORT_OP_STABLE_HANDLES flag to export operations
fuse: add EXPORT_OP_STABLE_HANDLES flag to export operations
fat: add EXPORT_OP_STABLE_HANDLES flag to export operations
f2fs: add EXPORT_OP_STABLE_HANDLES flag to export operations
nfsd: only allow filesystems that set EXPORT_OP_STABLE_HANDLES
nfsd: convert dprintks in check_export() to tracepoints

Documentation/filesystems/nfs/exporting.rst | 13 ++++++++
fs/affs/namei.c | 1 +
fs/befs/linuxvfs.c | 1 +
fs/btrfs/export.c | 1 +
fs/ceph/export.c | 1 +
fs/efs/super.c | 1 +
fs/erofs/super.c | 1 +
fs/ext2/super.c | 1 +
fs/ext4/super.c | 1 +
fs/f2fs/super.c | 1 +
fs/fat/nfs.c | 2 ++
fs/fuse/inode.c | 1 +
fs/gfs2/export.c | 1 +
fs/isofs/export.c | 1 +
fs/jffs2/super.c | 1 +
fs/jfs/super.c | 1 +
fs/nfs/export.c | 3 +-
fs/nfsd/export.c | 24 ++++++++-----
fs/nfsd/trace.h | 52 +++++++++++++++++++++++++++++
fs/nilfs2/namei.c | 1 +
fs/ntfs3/super.c | 1 +
fs/ocfs2/export.c | 1 +
fs/orangefs/super.c | 1 +
fs/overlayfs/export.c | 1 +
fs/smb/client/export.c | 1 +
fs/squashfs/export.c | 3 +-
fs/udf/namei.c | 1 +
fs/ufs/super.c | 1 +
fs/xfs/xfs_export.c | 1 +
include/linux/exportfs.h | 16 +++++----
mm/shmem.c | 1 +
31 files changed, 120 insertions(+), 17 deletions(-)
---
base-commit: c537e12daeecaecdcd322c56a5f70659d2de7bde
change-id: 20260114-exportfs-nfsd-12515072e9a9

Best regards,
--
Jeff Layton <jlayton@kernel.org>