Skip to content

fuse: add subvol_root_ino mount option for subvolume support#192

Open
ukernel wants to merge 1 commit into
redfs-ubuntu-noble-6.8.0-58.60from
fuse-subvol-root-ino
Open

fuse: add subvol_root_ino mount option for subvolume support#192
ukernel wants to merge 1 commit into
redfs-ubuntu-noble-6.8.0-58.60from
fuse-subvol-root-ino

Conversation

@ukernel

@ukernel ukernel commented Jul 24, 2026

Copy link
Copy Markdown

Filesystems that support snapshots and subvolumes may have inodes with the same inode number across different subvolumes. When these inodes are accessed through the same FUSE mount, tools like cp(1) can incorrectly report "File X and Y are the same file" because they share the same device number (sb->s_dev).

Add a new mount option "subvol_root_ino" that specifies the inode number of snapshot/subvolume root. When set, FUSE allocates unique anonymous block device ID for inodes whose orig_ino matches this value, and all inodes under that subvolume inherit the same device ID. This gives each subvolume a distinct device number in stat(2), avoiding inode number conflicts.

The feature is implemented by:

  • Adding sub_dev to fuse_inode, to track per-subvolume device ID
  • Adding subvol_root_ino to fuse_conn
  • Extending fuse_iget and fuse_lookup_name to propagate sub_dev
  • Reporting fi->sub_dev in fuse_fillattr/fuse_getattr when set
  • Disabling NFS export_support when subvol_root_ino is enabled, since the two features are incompatible

Filesystems that support snapshots and subvolumes may have inodes
with the same inode number across different subvolumes. When these
inodes are accessed through the same FUSE mount, tools like cp(1)
can incorrectly report "File X and Y are the same file" because
they share the same device number (sb->s_dev).

Add a new mount option "subvol_root_ino" that specifies the inode
number of snapshot/subvolume root. When set, FUSE allocates unique
anonymous block device ID for inodes whose orig_ino matches this
value, and all inodes under that subvolume inherit the same device
ID. This gives each subvolume a distinct device number in stat(2),
avoiding inode number conflicts.

The feature is implemented by:
- Adding sub_dev to fuse_inode, to track per-subvolume device ID
- Adding subvol_root_ino to fuse_conn
- Extending fuse_iget and fuse_lookup_name to propagate sub_dev
- Reporting fi->sub_dev in fuse_fillattr/fuse_getattr when set
- Disabling NFS export_support when subvol_root_ino is enabled,
  since the two features are incompatible

Signed-off-by: "Yan, Zheng" <ukernel@gmail.com>
@ukernel

ukernel commented Jul 24, 2026

Copy link
Copy Markdown
Author

the reason we don't use submount feature is that:
we want to support very large number of snapshots and linkable-datasets. Too many mounts will flood /proc/mounts and add heavy burden to VFS.

@ukernel
ukernel requested review from achhenderson and hbirth and removed request for achhenderson and hbirth July 24, 2026 09:10
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