MCPcopy Create free account
hub / github.com/ceph/ceph / fsync

Method fsync

src/client/Client.cc:13031–13066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13029}
13030
13031int Client::fsync(int fd, bool syncdataonly)
13032{
13033 RWRef_t mref_reader(mount_state, CLIENT_MOUNTING);
13034 if (!mref_reader.is_state_satisfied())
13035 return -ENOTCONN;
13036
13037 tout(cct) << "fsync" << std::endl;
13038 tout(cct) << fd << std::endl;
13039 tout(cct) << syncdataonly << std::endl;
13040
13041 std::scoped_lock lock(client_lock);
13042 Fh *f = get_filehandle(fd);
13043 if (!f)
13044 return -EBADF;
13045#if defined(__linux__) && defined(O_PATH)
13046 if (f->flags & O_PATH)
13047 return -EBADF;
13048#endif
13049 int r = _fsync(f, syncdataonly);
13050 if (r == 0) {
13051 // The IOs in this fsync were okay, but maybe something happened
13052 // in the background that we shoudl be reporting?
13053 r = f->take_async_err();
13054 ldout(cct, 5) << "fsync(" << fd << ", " << syncdataonly
13055 << ") = 0, async_err = " << r << dendl;
13056 } else {
13057 // Assume that an error we encountered during fsync, even reported
13058 // synchronously, would also have applied the error to the Fh, and we
13059 // should clear it here to avoid returning the same error again on next
13060 // call.
13061 ldout(cct, 5) << "fsync(" << fd << ", " << syncdataonly << ") = "
13062 << r << dendl;
13063 f->take_async_err();
13064 }
13065 return r;
13066}
13067
13068void Client::C_nonblocking_fsync_state::advance()
13069{

Callers 15

ceph_fsyncFunction · 0.45
play_traceMethod · 0.45
write_fileMethod · 0.45
mksnapfileMethod · 0.45
write_newFunction · 0.45
test_fsyncFunction · 0.45
test_truncateFunction · 0.45
test_ftruncateFunction · 0.45
test_fallocateFunction · 0.45
test_fsyncFunction · 0.45
TESTFunction · 0.45

Calls 2

is_state_satisfiedMethod · 0.80
take_async_errMethod · 0.80

Tested by 13

test_fsyncFunction · 0.36
test_truncateFunction · 0.36
test_ftruncateFunction · 0.36
test_fallocateFunction · 0.36
test_fsyncFunction · 0.36
TESTFunction · 0.36
write_dataFunction · 0.36
create_single_fileFunction · 0.36
write_single_fileFunction · 0.36
many_small_writesMethod · 0.36
do_bluefs_writeFunction · 0.36