linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: libc-alpha@sourceware.org,  linux-fsdevel@vger.kernel.org,
	 Trond Myklebust <trondmy@hammerspace.com>
Subject: Re: posix_fallocate behavior in glibc
Date: Mon, 29 Jul 2024 20:52:00 +0200	[thread overview]
Message-ID: <877cd4jajz.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20240729184430.GA1010@lst.de> (Christoph Hellwig's message of "Mon, 29 Jul 2024 20:44:30 +0200")

* Christoph Hellwig:

> On Mon, Jul 29, 2024 at 07:57:54PM +0200, Florian Weimer wrote:
>> When does the kernel return EOPNOTSUPP these days?
>
> In common code whenever the file system does not implement the
> fallocate file operation, and various file systems can also
> return it from inside the method if the feature is not actually
> supported for the particular file system or file it is called on.
>
>> Last time I looked at this I concluded that it does not make sense to
>> push this write loop from glibc to the applications.  That's what would
>> happen if we had a new version of posix_fallocate that didn't do those
>> writes.  We also updated the manual:
>
> That assumes that the loop is the right thing to do for file systems not
> supporting fallocate.  That's is generally the wrong thing to do, and
> spectacularly wrong for file systems that write out of place.

In this case, the file system could return another error code besides
EOPNOTSUPP.  There's a difference between “no one bothered to implement
this” and “this can't be implemented correctly”, and it could be
reflected in the error code.

> The applications might not know about glibc/Linux implementation details
> and expect posix_fallocate to either fail if can't be supported or
> actually give the guarantees it is supposed to provide, which this
> "fallback" doesn't actually do for the not entirely uncommon case of a 
> file system that is writing out of place.

I think people are aware that with thin provisioning and whatnot, even a
successful fallocate call doesn't mean that there's sufficient space to
complete the actual write.

Thanks,
Florian


  reply	other threads:[~2024-07-29 18:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 16:09 posix_fallocate behavior in glibc Christoph Hellwig
2024-07-29 17:23 ` Paul Eggert
2024-07-29 17:43   ` Christoph Hellwig
2024-07-29 17:54     ` Adhemerval Zanella Netto
     [not found]     ` <CAPBLoAf11hM0PLhqPG5gUyivU9U1manpOOhDWCPugUmWc1VVUw@mail.gmail.com>
2024-07-29 18:45       ` Christoph Hellwig
2024-07-29 17:57 ` Florian Weimer
2024-07-29 18:44   ` Christoph Hellwig
2024-07-29 18:52     ` Florian Weimer [this message]
2024-07-29 19:01       ` Christoph Hellwig
2024-07-29 19:23         ` Florian Weimer
2024-07-30 15:47           ` Christoph Hellwig
2024-07-30 16:11             ` Paul Eggert
2024-07-30 16:20               ` Christoph Hellwig
2024-07-30 17:03                 ` Florian Weimer
2024-07-30 17:08                   ` Christoph Hellwig
2024-07-30 17:29                     ` Florian Weimer
2024-07-30 17:52                   ` Mark Wielaard
2024-07-31  2:32                   ` Theodore Ts'o
2024-07-29 23:53       ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2024-06-26  6:01 Christoph Hellwig
2024-07-29 15:09 ` Christoph Hellwig
2024-07-29 15:11   ` Sam James

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=877cd4jajz.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=hch@lst.de \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=trondmy@hammerspace.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;
as well as URLs for NNTP newsgroup(s).