From: Hyunchul Lee <hyc.lee@gmail.com>
To: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Cc: "glaubitz@physik.fu-berlin.de" <glaubitz@physik.fu-berlin.de>,
"frank.li@vivo.com" <frank.li@vivo.com>,
"slava@dubeyko.com" <slava@dubeyko.com>,
"hch@infradead.org" <hch@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"cheol.lee@lge.com" <cheol.lee@lge.com>
Subject: Re: [PATCH] hfsplus: limit sb_maxbytes to partition size
Date: Fri, 6 Mar 2026 09:57:51 +0900 [thread overview]
Message-ID: <aaomj9LgbfSem-aF@hyunchul-PC02> (raw)
In-Reply-To: <e979abaf61fa6d7fab444eac293fcbc2993c78ee.camel@ibm.com>
On Thu, Mar 05, 2026 at 11:21:19PM +0000, Viacheslav Dubeyko wrote:
> On Thu, 2026-03-05 at 10:52 +0900, Hyunchul Lee wrote:
> > > >
> > > > Sorry it's generic/285, not generic/268.
> > > > in generic/285, there is a test that creates a hole exceeding the block
> > > > size and appends small data to the file. hfsplus fails because it fills
> > > > the block device and returns ENOSPC. However if it returns EFBIG
> > > > instead, the test is skipped.
> > > >
> > > > For writes like xfs_io -c "pwrite 8t 512", should fops->write_iter
> > > > returns ENOSPC, or would it be better to return EFBIG?
> > > > >
> > >
> > > Current hfsplus_file_extend() implementation doesn't support holes. I assume you
> > > mean this code [1]:
> > >
> > > len = hip->clump_blocks;
> > > start = hfsplus_block_allocate(sb, sbi->total_blocks, goal, &len);
> > > if (start >= sbi->total_blocks) {
> > > start = hfsplus_block_allocate(sb, goal, 0, &len);
> > > if (start >= goal) {
> > > res = -ENOSPC;
> > > goto out;
> > > }
> > > }
> > >
> > > Am I correct?
> > >
> > Yes,
> >
> > hfsplus_write_begin()
> > cont_write_begin()
> > cont_expand_zero()
> >
> > 1) xfs_io -c "pwrite 8t 512"
> > 2) hfsplus_begin_write() is called with offset 2^43 and length 512
> > 3) cont_expand_zero() allocates and zeroes out one block repeatedly
> > for the range
> > 0 to 2^43 - 1. To achieve this, hfsplus_write_begin() is called repeatedly.
> > 4) hfsplus_write_begin() allocates one block through hfsplus_get_block() =>
> > hfsplus_file_extend()
>
> I think we can consider these directions:
>
> (1) Currently, HFS+ code doesn't support holes. So, it means that
> hfsplus_write_begin() can check pos variable and i_size_read(inode). If pos is
> bigger than i_size_read(inode), then hfsplus_file_extend() will reject such
> request. So, we can return error code (probably, -EFBIG) for this case without
> calling hfsplus_file_extend(). But, from another point of view, maybe,
> hfsplus_file_extend() could be one place for this check. Does it make sense?
>
> (2) I think that hfsplus_file_extend() could treat hole or absence of free
> blocks like -ENOSPC. Probably, we can change the error code from -ENOSPC to -
> EFBIG in hfsplus_write_begin(). What do you think?
>
Even if holes are not supported, shouldn't the following writes be
supported?
xfs_io -f -c "pwrite 4k 512" <file-path>
If so, since we need to support cases where pos > i_size_read(inode),
wouldn't the condition "pos - i_size_read(inode) > free space" be better?
Also instead of checking every time in hfsplus_write_begin() or
hfsplus_file_extend(), how about implementing the check in the
file_operations->write_iter callback function, and returing EFBIG?
> >
> > > Do you mean that calling logic expects -EFBIG? Potentially, if we tries to
> > > extend the file, then -EFBIG could be more appropriate. But it needs to check
> > > the whole call trace.
> >
> > generic/285 creates a hole by pwrite at offset 2^43 + @ and handle the
> > error as follow:
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kdave_xfstests_blob_master_src_seek-5Fsanity-5Ftest.c-23L271&d=DwIFaQ&c=BSDicqBQBDjDI9RkVyTcHQ&r=q5bIm4AXMzc8NJu1_RGmnQ2fMWKq4Y4RAkElvUgSs00&m=84S8DZyqlgcJA0uzXVPYD-cvdonhvyi5kMWaklKdNjD8otp-dvtHXuL2O2CridFV&s=6jI_AQCduo5Tim8ioI5V8Xy50jguCLUTx1CSFEF__D0&e=
> >
> > if (errno == EFBIG) {
> > fprintf(stdout, "Test skipped as fs doesn't support so large files.\n");
> > ret = 0
> >
>
> I believe we need follow to system call documentation but not what some
> particular script expects to see. :) But -EFBIG sounds like reasonable error
> code.
>
I agree.
> Thanks,
> Slava.
>
> >
--
Thanks,
Hyunchul
next prev parent reply other threads:[~2026-03-06 0:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 8:28 [PATCH] hfsplus: limit sb_maxbytes to partition size Hyunchul Lee
2026-03-04 13:08 ` Christoph Hellwig
2026-03-04 20:04 ` Viacheslav Dubeyko
2026-03-05 0:29 ` Hyunchul Lee
2026-03-05 0:46 ` Viacheslav Dubeyko
2026-03-05 1:52 ` Hyunchul Lee
2026-03-05 23:21 ` Viacheslav Dubeyko
2026-03-06 0:57 ` Hyunchul Lee [this message]
2026-03-06 1:23 ` Viacheslav Dubeyko
2026-03-06 2:05 ` Hyunchul Lee
2026-03-06 20:08 ` Viacheslav Dubeyko
2026-03-09 0:52 ` Hyunchul Lee
2026-03-09 19:47 ` Viacheslav Dubeyko
2026-03-09 23:25 ` Hyunchul Lee
2026-03-05 14:27 ` hch
2026-03-06 0:40 ` Hyunchul Lee
2026-03-04 23:49 ` Hyunchul Lee
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=aaomj9LgbfSem-aF@hyunchul-PC02 \
--to=hyc.lee@gmail.com \
--cc=Slava.Dubeyko@ibm.com \
--cc=cheol.lee@lge.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=slava@dubeyko.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