Skip to content

shmem: Allow userspace monitoring of tmpfs for lack of space.

Gabriel Krisman Bertazi linux-fsdevel linux-mm oe-kbuild oe-kbuild-all 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 8 repliesIn review
  2. v1 posting 2/23 patches 2 repliesSuperseded
  3. v23 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 posting 1/23 patches2 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3shmem: Keep track of out-of-memory and out-of-space errorsinclude/linux/shmem_fs.h mm/shmem.c+7 -10 replies
2/3shmem: Introduce /sys/fs/tmpfs supportinclude/linux/shmem_fs.h mm/shmem.c+45 -30 replies
3/3shmem: Expose space and accounting error countDocumentation/ABI/testing/sysfs-fs-tmpfs mm/shmem.c+38 -00 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/3] shmem: Allow userspace monitoring of tmpfs for lack of space.

The only difference from v2 is applying Viro's coment on how the life of the sbinfo should now be tied to the kobject. I hope it is correct the way i did it. Tested by mount/umount while holding a reference.

* v2 cover:

the only difference from v1 is addressing Amir's comment about generating the directory in sysfs using the minor number.

* Original cover letter

When provisioning containerized applications, multiple very small tmpfs are used, for which one cannot always predict the proper file system size ahead of time. We want to be able to reliably monitor filesystems for ENOSPC errors, without depending on the application being executed reporting the ENOSPC after a failure. It is also not enough to watch statfs since that information might be ephemeral (say the application recovers by deleting data, the issue can get lost). For this use case, it is also interesting to differentiate IO errors caused by lack of virtual memory from lack of FS space.

This patch exposes two counters on sysfs that log the two conditions that are interesting to observe for container provisioning. They are recorded per tmpfs superblock, and can be polled by a monitoring application.

I proposed a more general approach [1] using fsnotify, but considering the specificity of this use-case, people agreed it seems that a simpler solution in sysfs is more than enough.

[1] https://lore.kernel.org/linux-mm/[email protected]/T/#mee338d25b0e1e07cbe0861f9a5ca8cc439b3edb8

To: Hugh Dickins <[email protected]>
To: Andrew Morton <[email protected]>
To: Amir Goldstein <[email protected]>
Cc: Khazhismel Kumykov <[email protected]>
Cc: Linux MM <[email protected]>
Cc: linux-fsdevel <[email protected]>

Gabriel Krisman Bertazi (3):
shmem: Keep track of out-of-memory and out-of-space errors
shmem: Introduce /sys/fs/tmpfs support
shmem: Expose space and accounting error count

 Documentation/ABI/testing/sysfs-fs-tmpfs | 13 ++++
 include/linux/shmem_fs.h                 |  5 ++
 mm/shmem.c                               | 76 ++++++++++++++++++++++--
 3 files changed, 90 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-fs-tmpfs
Signature · 1 line
2.35.1