mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <slava@dubeyko.com>
To: glaubitz@physik.fu-berlin.de, frank.li@vivo.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	vdubeyko@coreweave.com, Viacheslav Dubeyko <slava@dubeyko.com>
Subject: [PATCH 0/2] hfs/hfsplus: set s_maxbytes from the volume capacity
Date: Thu,  5 Nov 2026 16:49:21 -0800	[thread overview]
Message-ID: <20261106004923.1844283-1-slava@dubeyko.com> (raw)

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(-)

-- 
2.43.0


             reply	other threads:[~2026-11-06  0:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  0:49 Viacheslav Dubeyko [this message]
2026-11-06  0:49 ` [PATCH 1/2] hfsplus: " Viacheslav Dubeyko
2026-11-06  0:49 ` [PATCH 2/2] hfs: " Viacheslav Dubeyko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261106004923.1844283-1-slava@dubeyko.com \
    --to=slava@dubeyko.com \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vdubeyko@coreweave.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®