Merge "Fix sdcard's FUSE_FSYNCDIR handling."
This commit is contained in:
commit
6e141aea18
1 changed files with 16 additions and 7 deletions
|
|
@ -1309,14 +1309,23 @@ static int handle_release(struct fuse* fuse, struct fuse_handler* handler,
|
||||||
static int handle_fsync(struct fuse* fuse, struct fuse_handler* handler,
|
static int handle_fsync(struct fuse* fuse, struct fuse_handler* handler,
|
||||||
const struct fuse_in_header* hdr, const struct fuse_fsync_in* req)
|
const struct fuse_in_header* hdr, const struct fuse_fsync_in* req)
|
||||||
{
|
{
|
||||||
int is_data_sync = req->fsync_flags & 1;
|
bool is_dir = (hdr->opcode == FUSE_FSYNCDIR);
|
||||||
struct handle *h = id_to_ptr(req->fh);
|
bool is_data_sync = req->fsync_flags & 1;
|
||||||
int res;
|
|
||||||
|
|
||||||
TRACE("[%d] FSYNC %p(%d) is_data_sync=%d\n", handler->token,
|
int fd = -1;
|
||||||
h, h->fd, is_data_sync);
|
if (is_dir) {
|
||||||
res = is_data_sync ? fdatasync(h->fd) : fsync(h->fd);
|
struct dirhandle *dh = id_to_ptr(req->fh);
|
||||||
if (res < 0) {
|
fd = dirfd(dh->d);
|
||||||
|
} else {
|
||||||
|
struct handle *h = id_to_ptr(req->fh);
|
||||||
|
fd = h->fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("[%d] %s %p(%d) is_data_sync=%d\n", handler->token,
|
||||||
|
is_dir ? "FSYNCDIR" : "FSYNC",
|
||||||
|
id_to_ptr(req->fh), fd, is_data_sync);
|
||||||
|
int res = is_data_sync ? fdatasync(fd) : fsync(fd);
|
||||||
|
if (res == -1) {
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue