GNU bug report logs - #55724
cp --reflink=always failing when --reflink=auto reflinks successfully on OpenZFS

Previous Next

Package: coreutils;

Reported by: Rich <rincebrain <at> gmail.com>

Date: Mon, 30 May 2022 10:58:02 UTC

Severity: normal

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rich <rincebrain <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: cp --reflink=always failing when --reflink=auto reflinks successfully
 on OpenZFS
Date: Mon, 30 May 2022 05:13:05 -0400
[Message part 1 (text/plain, inline)]
Hi!

So, OpenZFS is adding reflink support Soon(tm), including across
filesystems on a pool, which is nice.

Unfortunately, Linux's VFS returns EXDEV for trying FICLONE or
FICLONERANGE (but not copy_file_range) cross-filesystem before you ever ask
the filesystem-specific code, so currently, the following strange behavior
occurs:

On coreutils 8.30 or 8.32, cp --reflink=always across filesystems will fail
with EXDEV and --reflink=auto will not reflink (because they're not trying
copy_file_range as a fallback).
On coreutils git, as of b3331d59e, cp --reflink=always across filesystems
will fail with EXDEV without ever getting out of Linux's VFS code, cp
--reflink=auto will reflink silently (since it falls back to
copy_file_range after getting EXDEV), cp --reflink=never will not reflink.

(On the same filesystem, in all of the above versions, cp --reflink=always
and =auto do the same thing and reflink correctly.)

I'm not sure what the "correct" behavior here should be, but at least =auto
working and =always failing seems like a surprising and incorrect outcome
to me, though it's not readily obvious to me how the code "should" flow
instead to avoid that - and since the failure cases happen before calling
into OpenZFS, I don't see any way it could be handled better there.

Happy to point people at the WIP code being used to demonstrate this if it
would be helpful, but this seems like it's only OpenZFS specific in that
nobody else has this functionality but would hit this case (because IIUC
btrfs avoids clone_file failing with EXDEV by pretending they're not
distinct filesystems, and there's not many other FSes where reflink across
filesystems would make sense).

Thanks for any insights,
- Rich
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.