hfs/hfsplus: set s_maxbytes from the volume capacity
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | hfsplus: set s_maxbytes from the volume capacityfs/ fs/ | +9 | 0 replies | |
| 2/2 | hfs: set s_maxbytes from the volume capacityfs/ fs/ | +8 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
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