Commit 2b7d3af2 authored by Ramon Nou's avatar Ramon Nou
Browse files

Add a simple fsync implementation to solve warning on ior.

parent 953537e8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -105,6 +105,8 @@ int hook_statfs(const char* path, struct statfs* buf);

int hook_fstatfs(unsigned int fd, struct statfs* buf);

int hook_fsync(unsigned int fd);

} // namespace hook
} // namespace gkfs

+14 −0
Original line number Diff line number Diff line
@@ -814,5 +814,19 @@ int hook_fstatfs(unsigned int fd, struct statfs* buf) {
    return syscall_no_intercept(SYS_fstatfs, fd, buf);
}

/* The function should broadcast a flush message (pmem_persist i.e.) if the application needs the capabilities*/
int hook_fsync(unsigned int fd) {

    LOG(DEBUG, "{}() called with fd: {}",
        __func__, fd);

    if (CTX->file_map()->exist(fd)) {
        errno = 0;
        return 0;
    }

    return syscall_no_intercept(SYS_fsync, fd);
}

} // namespace hook
} // namespace gkfs
+4 −0
Original line number Diff line number Diff line
@@ -726,6 +726,10 @@ int hook(long syscall_number,
                                              reinterpret_cast<struct statfs*>(arg1));
            break;

        case SYS_fsync:
            *result = gkfs::hook::hook_fsync(static_cast<unsigned int>(arg0));
            break;

        default:
            // ignore any other syscalls, i.e.: pass them on to the kernel
            // (syscalls forwarded to the kernel that return are logged in