Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6fd921ae authored by Jeff Brown's avatar Jeff Brown
Browse files

Implement FUSE_FSYNC request.

This request is needed for application correctness, without which
data corruption may result.

Bug: 6488845
Change-Id: I3d676c2e40f6e6b37d5d270c7cb40f1bf8c1fa47
parent 84715847
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -853,7 +853,21 @@ void handle_fuse_request(struct fuse *fuse,
        return;
    }

//    case FUSE_FSYNC:
    case FUSE_FSYNC: {
        const struct fuse_fsync_in *req = data;
        int is_data_sync = req->fsync_flags & 1;
        struct handle *h = id_to_ptr(req->fh);
        int res;
        TRACE("FSYNC %p(%d) is_data_sync=%d\n", h, h->fd, is_data_sync);
        res = is_data_sync ? fdatasync(h->fd) : fsync(h->fd);
        if (res < 0) {
            fuse_status(fuse, hdr->unique, -errno);
            return;
        }
        fuse_status(fuse, hdr->unique, 0);
        return;
    }

//    case FUSE_SETXATTR:
//    case FUSE_GETXATTR:
//    case FUSE_LISTXATTR: