On Mon, May 15, 2023 at 10:29 AM Miklos Szeredi <miklos@xxxxxxxxxx> wrote: > > On Fri, 12 May 2023 at 21:37, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > > I was waiting for LSFMM to see if and how FUSE-BPF intends to > > address the highest value use case of read/write passthrough. > > > > From what I've seen, you are still taking a very broad approach of > > all-or-nothing which still has a lot of core design issues to address, > > while these old patches already address the most important use case > > of read/write passthrough of fd without any of the core issues > > (credentials, hidden fds). > > > > As far as I can tell, this old implementation is mostly independent of your > > lookup based approach - they share the low level read/write passthrough > > functions but not much more than that, so merging them should not be > > a blocker to your efforts in the longer run. > > Please correct me if I am wrong. > > > > As things stand, I intend to re-post these old patches with mandatory > > FOPEN_PASSTHROUGH_AUTOCLOSE to eliminate the open > > questions about managing mappings. > > > > Miklos, please stop me if I missed something and if you do not > > think that these two approaches are independent. > > Do you mean that the BPF patches should use their own passthrough mechanism? > > I think it would be better if we could agree on a common interface for > passthough (or per Paul's suggestion: backing) mechanism. Well, not exactly different. With BFP patches, if you have a backing inode that was established during LOOKUP with rules to do passthrough for open(), you'd get a backing file and that backing file would be used to passthrough read/write. FOPEN_PASSTHROUGH is another way to configure passthrough read/write to a backing file that is controlled by the server per open fd instead of by BFP for every open of the backing inode. Obviously, both methods would use the same backing_file field and same read/write passthrough methods regardless of how the backing file was setup. Obviously, the BFP patches will not use the same ioctl to setup passthrough (and/or BPF program) to a backing inode, but I don't think that matters much. When we settle on ioctls for setting up backing inodes, we can also add new ioctls for setting up backing file with optional BPF program. I don't see any reason to make the first ioctl more complicated than this: struct fuse_passthrough_out { uint32_t fd; /* For future implementation */ uint32_t len; void *vec; }; One advantage with starting with FOPEN_PASSTHROUGH, besides dealing with the highest priority performance issue, is how it deals with resource limits on open files. While the backing files are not accounted to the server, the server is very likely to keep an open fd for the backing file until release, otherwise, the server will not be able to perform other non-passthrough file operations (e.g. fallocate) on the backing fd, so at least with FOPEN_PASSTHROUGH_AUTOCLOSE, there should be only up to 2 times the number of open files, very much the same as overlayfs. I intend to enforce this heuristically by counting the number of passthrough fds and restrict new passthrough fd setup to the number of current open fds by the server, so a malicious or misbehaving server cannot setup infinite number of backing fds that it does not also keep open itself. > > Let's see this patchset and then we can discuss how this could be > usable for the BPF case as well. > OK. I'll try to dust off these patches and re-submit. Thanks, Amir.