Skip to content

Commit 176b41f

Browse files
committed
FST: Check if opening device for disk measurements fails and fall-back
to open without O_DIRECT flag. Log notice message signalling that the disk measurements were skipped. Fixes EOS-6600
1 parent 6fa526f commit 176b41f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

fst/storage/FileSystem.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,19 @@ FileSystem::IoPing()
347347

348348
// Open the file for direct access
349349
int fd = open(device_path.c_str(), O_RDONLY | O_DIRECT);
350+
351+
if (fd < 0) {
352+
// Fallback to open without O_DIRECT flag
353+
fd = open(device_path.c_str(), O_RDONLY);
354+
355+
if (fd < 0) {
356+
eos_static_notice("msg=\"skip disk measurements, failed to open "
357+
"device\" path=\"%s\" errno=%i",
358+
GetPath().c_str(), errno);
359+
return;
360+
}
361+
}
362+
350363
using namespace std::chrono;
351364
auto start_iops = high_resolution_clock::now();
352365
IOPS = eos::fst::ComputeIops(fd);

0 commit comments

Comments
 (0)