With FUSE_PASSTHROUGH_INO, the backing file is associated with the inode at lookup time. Allow the server to pass in backing_id=0 in the open response. On the kernel side, this uses the backing file already set up on the inode. Signed-off-by: Joanne Koong --- fs/fuse/passthrough.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c index d62a1c751157..ae0137caa06d 100644 --- a/fs/fuse/passthrough.c +++ b/fs/fuse/passthrough.c @@ -193,13 +193,17 @@ int fuse_passthrough_readdir(struct file *file, struct dir_context *ctx) */ struct fuse_backing *fuse_passthrough_open(struct file *file, int backing_id) { + struct fuse_inode *fi = get_fuse_inode(file_inode(file)); struct fuse_file *ff = file->private_data; struct fuse_conn *fc = ff->fm->fc; struct fuse_backing *fb = NULL; struct file *backing_file; int err; - fb = fuse_backing_id_get(fc, backing_id); + if (!backing_id && fc->passthrough_ino) + fb = fuse_backing_get(fuse_inode_backing(fi)); + else + fb = fuse_backing_id_get(fc, backing_id); if (IS_ERR_OR_NULL(fb)) { err = fb ? PTR_ERR(fb) : -ENOENT; fb = NULL; -- 2.52.0