[bug] Windows-to-Linux remote mount overlapped I/O is not detecting EOF for read operations #48
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
Scott E. Graves 2025-04-17 09:21:28 -05:00
parent 3e09adaba3
commit 28fefca765
3 changed files with 4 additions and 9 deletions

View File

@ -226,6 +226,7 @@ using WCHAR = wchar_t;
#define STATUS_DEVICE_BUSY std::uint32_t{0x80000011L} #define STATUS_DEVICE_BUSY std::uint32_t{0x80000011L}
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::uint32_t{0xC0000468L} #define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::uint32_t{0xC0000468L}
#define STATUS_DIRECTORY_NOT_EMPTY std::uint32_t{0xC0000101L} #define STATUS_DIRECTORY_NOT_EMPTY std::uint32_t{0xC0000101L}
#define STATUS_END_OF_FILE std::uint32_t{0xC0000011L};
#define STATUS_FILE_IS_A_DIRECTORY std::uint32_t{0xC00000BAL} #define STATUS_FILE_IS_A_DIRECTORY std::uint32_t{0xC00000BAL}
#define STATUS_FILE_TOO_LARGE std::uint32_t{0xC0000904L} #define STATUS_FILE_TOO_LARGE std::uint32_t{0xC0000904L}
#define STATUS_INSUFFICIENT_RESOURCES std::uint32_t{0xC000009AL} #define STATUS_INSUFFICIENT_RESOURCES std::uint32_t{0xC000009AL}

View File

@ -28,7 +28,6 @@
#include "drives/directory_iterator.hpp" #include "drives/directory_iterator.hpp"
#include "drives/remote/remote_open_file_table.hpp" #include "drives/remote/remote_open_file_table.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/debug_log.hpp"
#include "events/types/remote_server_event.hpp" #include "events/types/remote_server_event.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "types/remote.hpp" #include "types/remote.hpp"
@ -1379,18 +1378,15 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
auto res = pread64(static_cast<native_handle>(handle), buffer, length, auto res = pread64(static_cast<native_handle>(handle), buffer, length,
static_cast<off_t>(offset)); static_cast<off_t>(offset));
event_system::instance().raise<debug_log>(
function_name,
fmt::format("read|offset|{}|len|{}|res|{}", offset, length, res));
if (res >= 0) { if (res >= 0) {
*bytes_transferred = static_cast<UINT32>(res); *bytes_transferred = static_cast<UINT32>(res);
if (*bytes_transferred == 0U) {
ret = STATUS_END_OF_FILE;
}
} else { } else {
ret = ret =
static_cast<packet::error_type>(utils::unix_error_to_windows(errno)); static_cast<packet::error_type>(utils::unix_error_to_windows(errno));
} }
event_system::instance().raise<debug_log>(
function_name, fmt::format("read|offset|{}|len|{}|res|{}|tx|{}", offset,
length, res, *bytes_transferred));
} }
RAISE_REMOTE_FUSE_SERVER_EVENT( RAISE_REMOTE_FUSE_SERVER_EVENT(

View File

@ -342,8 +342,6 @@ static void test_overlapped_file(auto &&mount_location, auto &&file_path,
overlapped.Offset = 3U * bytes_per_sector; overlapped.Offset = 3U * bytes_per_sector;
ret = ::ReadFile(handle, read_buffer.data(), bytes_per_sector, &bytes_read, ret = ::ReadFile(handle, read_buffer.data(), bytes_per_sector, &bytes_read,
&overlapped); &overlapped);
fmt::println("size|{}|offset|{}|read|{}|ret|{}|err|{}", size.QuadPart,
overlapped.Offset, bytes_read, ret, ::GetLastError());
EXPECT_TRUE(ret || ERROR_IO_PENDING == ::GetLastError() || EXPECT_TRUE(ret || ERROR_IO_PENDING == ::GetLastError() ||
ERROR_HANDLE_EOF == ::GetLastError()); ERROR_HANDLE_EOF == ::GetLastError());
if (ERROR_HANDLE_EOF != ::GetLastError()) { if (ERROR_HANDLE_EOF != ::GetLastError()) {