Skip to content

tmpfs: inode: Reduce risk of inum overflow

Chris Down linux-fsdevel linux-mm lkml 6 versions – Applied

Status from this message: [merged] tmpfs-support-64-bit-inums-per-sb.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest2 patches 2 repliesApplied 2/2
  2. v62 patches 2 repliesSuperseded
  3. v52 patches 24 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v42 patches0 repliesSuperseded
v32 patches4 repliesSuperseded
v22 patches5 repliesSuperseded

Changes in v7 from the cover letter

- Fix misalignment in percpu batching, thanks Matthew.

Patches in v7 All 2 applied

#Subject and filesSizeRepliesApplied
1/2tmpfs: Per-superblock i_ino supportinclude/linux/fs.h include/linux/shmem_fs.h mm/shmem.c+78 -51 replyApplied
2/2tmpfs: Support 64-bit inums per-sbDocumentation/filesystems/tmpfs.rst fs/Kconfig include/linux/shmem_fs.h +1 more+90 -24 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchAmir GoldsteinHugh Dickins
1/2A-b
2/2R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/2] tmpfs: inode: Reduce risk of inum overflow

In Facebook production we are seeing heavy i_ino wraparounds on tmpfs. On affected tiers, in excess of 10% of hosts show multiple files with different content and the same inode number, with some servers even having as many as 150 duplicated inode numbers with differing file content.

This causes actual, tangible problems in production. For example, we have complaints from those working on remote caches that their application is reporting cache corruptions because it uses (device, inodenum) to establish the identity of a particular cache object, but because it's not unique any more, the application refuses to continue and reports cache corruption. Even worse, sometimes applications may not even detect the corruption but may continue anyway, causing phantom and hard to debug behaviour.

In general, userspace applications expect that (device, inodenum) should be enough to be uniquely point to one inode, which seems fair enough. One might also need to check the generation, but in this case:

1. That's not currently exposed to userspace (ioctl(...FS_IOC_GETVERSION...) returns ENOTTY on tmpfs);
2. Even with generation, there shouldn't be two live inodes with the same inode number on one device.

In order to mitigate this, we take a two-pronged approach:

1. Moving inum generation from being global to per-sb for tmpfs. This itself allows some reduction in i_ino churn. This works on both 64- and 32- bit machines.
2. Adding inode{64,32} for tmpfs. This fix is supported on machines with 64-bit ino_t only: we allow users to mount tmpfs with a new inode64 option that uses the full width of ino_t, or CONFIG_TMPFS_INODE64.

You can see how this compares to previous related patches which didn't implement this per-superblock:

- https://patchwork.kernel.org/patch/11254001/
- https://patchwork.kernel.org/patch/11023915/

Changes since v6:

- Fix misalignment in percpu batching, thanks Matthew.

Chris Down (2):
tmpfs: Per-superblock i_ino support
tmpfs: Support 64-bit inums per-sb

 Documentation/filesystems/tmpfs.rst |  11 +++
 fs/Kconfig                          |  15 ++++
 include/linux/fs.h                  |  15 ++++
 include/linux/shmem_fs.h            |   3 +
 mm/shmem.c                          | 127 ++++++++++++++++++++++++++--
 5 files changed, 166 insertions(+), 5 deletions(-)
Signature · 1 line
2.27.0