From 3ae410445fb1a6781ec06ae2cf359a861e55004b Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Mon, 1 Jul 2024 15:12:38 -0700 Subject: [PATCH] ANDROID: fuse: Allow passthrough and not passthrough Android uses passthrough and nonpassthrough files at the same time Change-Id: I227d82f659e53eb586494c9c09d84150b40d5227 Bug: 333497409 Test: atest android.scopedstorage.cts.general.ScopedStorageDeviceTest Signed-off-by: Daniel Rosenberg --- fs/fuse/iomode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/fuse/iomode.c b/fs/fuse/iomode.c index c99e285f3183..7dc0233ae632 100644 --- a/fs/fuse/iomode.c +++ b/fs/fuse/iomode.c @@ -51,11 +51,15 @@ int fuse_file_cached_io_open(struct inode *inode, struct fuse_file *ff) * Check if inode entered passthrough io mode while waiting for parallel * dio write completion. */ + /* Android's use case requires opening files in both passthrough and non + * passthrough modes */ +#if 0 if (fuse_inode_backing(fi)) { clear_bit(FUSE_I_CACHE_IO_MODE, &fi->state); spin_unlock(&fi->lock); return -ETXTBSY; } +#endif WARN_ON(ff->iomode == IOM_UNCACHED); if (ff->iomode == IOM_NONE) { @@ -198,6 +202,7 @@ int fuse_file_io_open(struct file *file, struct inode *inode) { struct fuse_file *ff = file->private_data; struct fuse_inode *fi = get_fuse_inode(inode); + struct fuse_conn *fc = get_fuse_conn(inode); int err; /* @@ -212,7 +217,7 @@ int fuse_file_io_open(struct file *file, struct inode *inode) * which is already open for passthrough. */ err = -EINVAL; - if (fuse_inode_backing(fi) && !(ff->open_flags & FOPEN_PASSTHROUGH)) + if (fuse_inode_backing(fi) && !(ff->open_flags & FOPEN_PASSTHROUGH) && !fc->writeback_cache) goto fail; /*