ANDROID: fuse-bpf: fix wrong logic in read backing

1. Direct IO support is handled at the open(), so there's no need to
   handle it at the read.
2. Ensure that return value is correctly returned in error situation.

Bug: 409455146
Change-Id: I7675b429ddaa548e88930d6aa2f3b3b5eed6c4ba
Signed-off-by: yoonho.shin <yoonho.shin@samsung.com>
This commit is contained in:
yoonho.shin
2025-04-09 15:45:21 +09:00
committed by Todd Kjos
parent 8dedd2a376
commit cc59263d5d

View File

@@ -799,10 +799,6 @@ int fuse_file_read_iter_initialize(
.size = to->count,
};
fri->frio = (struct fuse_read_iter_out) {
.ret = fri->fri.size,
};
/* TODO we can't assume 'to' is a kvec */
/* TODO we also can't assume the vector has only one component */
*fa = (struct fuse_bpf_args) {
@@ -837,11 +833,6 @@ int fuse_file_read_iter_backing(struct fuse_bpf_args *fa,
if (!iov_iter_count(to))
return 0;
if ((iocb->ki_flags & IOCB_DIRECT) &&
(!ff->backing_file->f_mapping->a_ops ||
!ff->backing_file->f_mapping->a_ops->direct_IO))
return -EINVAL;
/* TODO This just plain ignores any change to fuse_read_in */
if (is_sync_kiocb(iocb)) {
ret = vfs_iter_read(ff->backing_file, to, &iocb->ki_pos,
@@ -864,14 +855,13 @@ int fuse_file_read_iter_backing(struct fuse_bpf_args *fa,
fuse_bpf_aio_cleanup_handler(aio_req);
}
frio->ret = ret;
/* TODO Need to point value at the buffer for post-modification */
out:
fuse_file_accessed(file, ff->backing_file);
return ret;
frio->ret = ret;
return ret < 0 ? ret : 0;
}
void *fuse_file_read_iter_finalize(struct fuse_bpf_args *fa,