On Thu, 1 Feb 2024 at 00:09, Bernd Schubert <bschubert@xxxxxxx> wrote: > > From: Amir Goldstein <amir73il@xxxxxxxxx> > > In preparation for inode io modes, a server open response could fail > due to conflicting inode io modes. > > Allow returning an error from fuse_finish_open() and handle the error in > the callers. fuse_dir_open() can now call fuse_sync_release(), so handle > the isdir case correctly. While that's true, it may be better to just decouple the dir/regular paths completely, since there isn't much sharing anyway and becoming even less. > diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c > index d19cbf34c634..d45d4a678351 100644 > --- a/fs/fuse/dir.c > +++ b/fs/fuse/dir.c > @@ -692,13 +692,15 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, > d_instantiate(entry, inode); > fuse_change_entry_timeout(entry, &outentry); > fuse_dir_changed(dir); > - err = finish_open(file, entry, generic_file_open); > + err = generic_file_open(inode, file); > + if (!err) { > + file->private_data = ff; > + err = finish_open(file, entry, fuse_finish_open); Need to be careful with moving fuse_finish_open() call inside finish_open() since various fields will be different. In particular O_TRUNC in f_flags will not be cleared and in this case it looks undesirable.