BACKPORT: ANDROID: fuse-bpf: Ignore readaheads unless they go to the daemon

readpages will be triggered on the fuse fs in passthrough mode though
system calls like fadvise. If the daemon isn't aware of the file, this
will likely cause a hang.

For the moment, simply ignore fadvise in this situation

Bug: 301201239
Test: fuse_test, atest ScopedStorageDeviceTest both pass
Signed-off-by: Paul Lawrence <paullawrence@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:ac9071df3ba6715219a16a44d4711f041b0c25de)
Merged-In: I524a84aeeb1b1593e51264fcc37f7cfa66757168
Change-Id: I524a84aeeb1b1593e51264fcc37f7cfa66757168
This commit is contained in:
Paul Lawrence 2023-11-15 14:29:23 -08:00 • committed by Alexander Martinz
commit fa625f8622
No known key found for this signature in database
GPG key ID: CF15BDD9A321A9B2

View file

@ -1033,6 +1033,19 @@ static int fuse_readpages_fill(void *_data, struct page *page)
struct inode *inode = data->inode;
struct fuse_conn *fc = get_fuse_conn(inode);
#ifdef CONFIG_FUSE_BPF
/*
* Currently no meaningful readahead is possible with fuse-bpf within
* the kernel, so unless the daemon is aware of this file, ignore this
* call.
*/
if (!get_fuse_inode(inode)->nodeid)
return -EIO;
#endif
if (fuse_is_bad(inode))
return -EIO;
fuse_wait_on_page_writeback(inode, page->index);
if (ap->num_pages &&