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

fix(interactive): Fix the Invalid cross-device link error occurring with copy_file_range in the Docker environment. #3454

Merged
merged 2 commits into from
Dec 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions flex/storages/rt_mutable_graph/file_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ inline void copy_file(const std::string& src, const std::string& dst) {
LOG(ERROR) << "Failed to set read/write permission for file: " << dst
<< " " << errorCode.message() << std::endl;
}

// For a newly created file, you may need to close and then reopen it,
// otherwise you may encounter a copy_file_range "Invalid cross-device link"
// error, one possible cause of the error could be that the
// file's metadata has not yet been flushed to the file system.
close(dst_fd);
dst_fd = open(dst.c_str(), O_WRONLY);
}
ssize_t ret;
do {
Expand Down