Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on ZFS because of fallocate not being supported #802

Closed
emacsomancer opened this issue May 19, 2017 · 10 comments
Closed

Fails on ZFS because of fallocate not being supported #802

emacsomancer opened this issue May 19, 2017 · 10 comments

Comments

@emacsomancer
Copy link

Is there a way to force flatpak to use dd instead of fallocate? I am unable to install any flatpaks on a ZFS filesystem (on Linux).

@alexlarsson
Copy link
Member

This seems to be from ostree, because flatpak never calls this itself. The only calls seem to be in _ostree_repo_open_content_bare() and create_regular_tmpfile_linkable_with_content().

@cgwalters, is there any chance fallocate calls in ostree could be optional? A fallback could just use ftruncate() right?

@cgwalters
Copy link
Collaborator

There's one in libglnx too. Hmm, but glibc has a fallback for this. Are you not using glibc? And is this a new kernel? Can you try e.g.:

strace -f -o strace.log flatpak ...
and then:
grep fallocate strace.log?

@emacsomancer
Copy link
Author

emacsomancer commented May 22, 2017

I'm using musl libc.

......
OUTPUT of -

strace -f -o strace.log flatpak ...
 ....
grep fallocate strace.log

28197 fallocate(4, 0, 0, 37) = -1 EOPNOTSUPP (Not supported)

@cgwalters
Copy link
Collaborator

Right, compare:
http://git.musl-libc.org/cgit/musl/commit/src?id=1c76683cb4377a481dc1085b63170bb276512267
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/posix_fallocate64.c;h=eb05f7c5d0631e288ce9a01ff19f92549fff5472;hb=HEAD

So...it looks like coreutils does silently ignore ENOSYS and EOPNOTSUPP, but e.g. systemd doesn't. I suspect you're going to be hitting this in more places.

@emacsomancer
Copy link
Author

So it's an edge case involving [+ZFS,-glibc,-systemd] ?

Where does the responsibility here lie, do you think? With musl or with the init manager?

Interestingly, this is the first time I'm run into this issue, though admittedly I've only been running this system a couple of months.

(My current workaround for the flatpak issue is an ext4-formatted .img, mounted at /var/lib/flatpak/ )

@alexlarsson
Copy link
Member

Systemd is not involved in this particular case, just musl, but systemd will also run into similar issues.
Possible fixes are makeing musl posix_fallocate() have an ENOSYS/EOPNOTSUPP fallback, or finding every user in the world and adding the fallback to them. Since the later touches a lot of software, and is only needed for musl, i think the proper fix should go into musl.

@alexlarsson
Copy link
Member

@richfelker
Copy link

The glibc "fallback" is dangerously buggy and the subject of a bug report that was closed as wontfix: https://sourceware.org/bugzilla/show_bug.cgi?id=15661

musl will obviously not be adopting the same.

posix_fallocate is permitted to fail, and must fail if it can't accomplish what it's specified to do on success. I'm not sure what flatpak needs from it; simply using ftruncate to set the file size to the desired length might suffice, or it might be necessary to perform writes on every block.

cgwalters added a commit to cgwalters/libglnx that referenced this issue Jun 12, 2017
The glibc `posix_fallocate()` implementation has a bad fallback,
and further we need to handle `EOPNOTSUPP` for musl.
flatpak/flatpak#802
@cgwalters
Copy link
Collaborator

GNOME/libglnx#52

gnomesysadmins pushed a commit to GNOME/libglnx that referenced this issue Jun 13, 2017
The glibc `posix_fallocate()` implementation has a bad fallback,
and further we need to handle `EOPNOTSUPP` for musl.
flatpak/flatpak#802
@cgwalters
Copy link
Collaborator

Fixed by ostreedev/ostree#970

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants