Implement FUSE_FSYNC request.

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

Bug: 6488845
Change-Id: I3d676c2e40f6e6b37d5d270c7cb40f1bf8c1fa47
This commit is contained in:
Jeff Brown 2012-05-25 15:01:21 -07:00
parent 847158476c
commit 6fd921ae03
1 changed files with 15 additions and 1 deletions

View File

@ -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: