Skip to content

hfs/hfsplus: set s_maxbytes from the volume capacity

Viacheslav Dubeyko linux-fsdevel lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2hfsplus: set s_maxbytes from the volume capacityfs/hfsplus/inode.c fs/hfsplus/super.c+9 -80 replies
2/2hfs: set s_maxbytes from the volume capacityfs/hfs/inode.c fs/hfs/super.c+8 -70 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/2] hfs/hfsplus: set s_maxbytes from the volume capacity

HFS and HFS+ do not support sparse files: every byte of a file up to end-of-file has to be backed by an allocated block. As a result, a write, truncate or copy_file_range() far beyond the current end-of-file makes the driver zero-fill the whole gap, which runs out of free space and fails with -ENOSPC rather than reporting -EFBIG.

Since a file can never be larger than the volume, this series sets s_maxbytes to the volume capacity instead (capped by MAX_LFS_FILESIZE for HFS+ and by MAX_NON_LFS for HFS). The VFS then returns -EFBIG for write(), copy_file_range(), truncate and fallocate beyond the limit, and trims writes that straddle it. The now redundant local checks are removed.

Viacheslav Dubeyko (2):
hfsplus: set s_maxbytes from the volume capacity
hfs: set s_maxbytes from the volume capacity

 fs/hfs/inode.c     |  7 -------
 fs/hfs/super.c     |  8 ++++++++
 fs/hfsplus/inode.c |  7 -------
 fs/hfsplus/super.c | 10 +++++++++-
 4 files changed, 17 insertions(+), 15 deletions(-)
Signature · 1 line
2.43.0