Skip to content

vfs: return EOPNOTSUPP for FICLONE/FICLONERANGE/FIDEDUPERANGE#12853

Merged
copybara-service[bot] merged 1 commit intogoogle:masterfrom
tanyifeng:vfs-ficlone-eopnotsupp
Apr 3, 2026
Merged

vfs: return EOPNOTSUPP for FICLONE/FICLONERANGE/FIDEDUPERANGE#12853
copybara-service[bot] merged 1 commit intogoogle:masterfrom
tanyifeng:vfs-ficlone-eopnotsupp

Conversation

@tanyifeng
Copy link
Copy Markdown
Contributor

Linux returns EOPNOTSUPP when a filesystem does not support reflink. gVisor returned ENOTTY, breaking programs like syncthing that rely on EOPNOTSUPP to gracefully fall back to regular copy.

Handle these ioctls in FileDescriptionDefaultImpl.Ioctl() so all filesystems without custom Ioctl get the correct errno automatically.

Linux returns EOPNOTSUPP when a filesystem does not support reflink.
gVisor returned ENOTTY, breaking programs like syncthing that rely
on EOPNOTSUPP to gracefully fall back to regular copy.

Handle these ioctls in FileDescriptionDefaultImpl.Ioctl() so all
filesystems without custom Ioctl get the correct errno automatically.

Signed-off-by: Tan Yifeng <yiftan@tencent.com>
@tanyifeng tanyifeng force-pushed the vfs-ficlone-eopnotsupp branch from 1bbc082 to 7435a6c Compare April 2, 2026 09:09
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2026
Linux returns EOPNOTSUPP when a filesystem does not support reflink. gVisor returned ENOTTY, breaking programs like syncthing that rely on EOPNOTSUPP to gracefully fall back to regular copy.

Handle these ioctls in FileDescriptionDefaultImpl.Ioctl() so all filesystems without custom Ioctl get the correct errno automatically.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12853 from tanyifeng:vfs-ficlone-eopnotsupp 7435a6c
PiperOrigin-RevId: 893757418
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2026
Linux returns EOPNOTSUPP when a filesystem does not support reflink. gVisor returned ENOTTY, breaking programs like syncthing that rely on EOPNOTSUPP to gracefully fall back to regular copy.

Handle these ioctls in FileDescriptionDefaultImpl.Ioctl() so all filesystems without custom Ioctl get the correct errno automatically.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12853 from tanyifeng:vfs-ficlone-eopnotsupp 7435a6c
PiperOrigin-RevId: 893757418
INSTANTIATE_TEST_SUITE_P(IoctlTest, IoctlTestSIOCGIFCONF,
::testing::ValuesIn(IoctlSocketTypes()));

// FICLONE/FICLONERANGE/FIDEDUPERANGE should return EOPNOTSUPP on
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests will fail when run on Linux. IMO syscall test is not required for this change. We primarliy use them to compare gVisor <-> Linux compatibility.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right — I realized that on filesystems that support reflink, these ioctls would succeed instead of returning EOPNOTSUPP, so the tests could indeed fail on native Linux depending on the filesystem. I've send a follow-up pr #12863 to remove these test cases. Thanks for catching this!

@copybara-service copybara-service bot merged commit b03a9f5 into google:master Apr 3, 2026
6 checks passed
tanyifeng added a commit to tanyifeng/gvisor that referenced this pull request Apr 3, 2026
Remove the EOPNOTSUPP test cases for FICLONE, FICLONERANGE,
and FIDEDUPERANGE ioctls added in google#12853

These tests assume the ioctls always fail with EOPNOTSUPP,
which is only true on filesystems that do not support reflink,
causing the tests to fail on native Linux.

Signed-off-by: Tan Yifeng <yiftan@tencent.com>
copybara-service bot pushed a commit that referenced this pull request Apr 3, 2026
Remove the EOPNOTSUPP test cases for FICLONE, FICLONERANGE, and FIDEDUPERANGE ioctls added in #12853

These tests assume the ioctls always fail with EOPNOTSUPP, which is only true on filesystems that do not support reflink, causing the tests to fail on native Linux.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12863 from tanyifeng:remove-ficlone-tests e1e815c
PiperOrigin-RevId: 893842986
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants