Page MenuHomeFreeBSD

cp: Expect EINTR while copying
ClosedPublic

Authored by des on Sat, Feb 7, 5:34 PM.
Tags
None
Referenced Files
F145802307: D55167.id171422.diff
Tue, Feb 24, 4:29 PM
F145802299: D55167.id171422.diff
Tue, Feb 24, 4:29 PM
F145794542: D55167.id171421.diff
Tue, Feb 24, 2:20 PM
Unknown Object (File)
Mon, Feb 23, 5:44 PM
Unknown Object (File)
Thu, Feb 19, 3:36 AM
Unknown Object (File)
Tue, Feb 17, 10:45 PM
Unknown Object (File)
Tue, Feb 17, 4:27 PM
Unknown Object (File)
Tue, Feb 17, 2:45 PM
Subscribers

Details

Summary

Both copy_file_range() and copy_fallback() can be interrupted before
they have read anything at all, in which case they return -1 and set
errno to EINTR. If that happens, we should retry, not fail.

MFC after: 1 week
PR: 293028

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70560
Build 67443: arc lint + arc unit

Event Timeline

des requested review of this revision.Sat, Feb 7, 5:34 PM

hang on, that won't actually work, brb

This is probably correct. However, I'd like to see two other things:

  • A reproduction case
  • An audit of the rest of the base system for other utilities that make the same mistake, like install(1).

This is probably correct. However, I'd like to see two other things:

  • A reproduction case
  • An audit of the rest of the base system for other utilities that make the same mistake, like install(1).

The reproducing case is timing dependent. I came up with the discrepancy when a user on the forums interrupted a cp operation with a du and cp bailed out.

I will troll the base system for similar cases.

The reproducing case is timing dependent. I came up with the discrepancy when a user on the forums interrupted a cp operation with a du and cp bailed out.

Do you at least know what fuse file system he was using, and what options it was mounted with?

The reproducing case is timing dependent. I came up with the discrepancy when a user on the forums interrupted a cp operation with a du and cp bailed out.

Do you at least know what fuse file system he was using, and what options it was mounted with?

NTFS. I just asked the user for flags.

The reproducing case is timing dependent. I came up with the discrepancy when a user on the forums interrupted a cp operation with a du and cp bailed out.

Do you at least know what fuse file system he was using, and what options it was mounted with?

NTFS. I just asked the user for flags.

NTFS uses libfuse-2. That version doesn't even support FUSE_COPY_FILE_RANGE. So my guess is that vn_copy_file_range did one read and then one write. The write went through fuse_vnop_write, but then it blocked, because the FUSE daemon was processing other commands. So no FUSE_WRITE operation ever got sent to userspace. Then something sent a signal to the process. So the fusefs module abandoned the write operation, returning EINTR, and vn_copy_file_range faithfully returned it to userspace.

This revision is now accepted and ready to land.Wed, Feb 11, 3:16 PM
This revision was automatically updated to reflect the committed changes.