On Wed, 21 Sept 2022 at 11:17, Christian Brauner <brauner@xxxxxxxxxx> wrote: > > Hm, seems like this could avoid the goto into an if-block: > > static int fuse_tmpfile(struct user_namespace *mnt_userns, struct inode *dir, > struct file *file, umode_t mode) > { > struct fuse_conn *fc = get_fuse_conn(dir); > int err; > > if (fc->no_tmpfile) > return -EOPNOTSUPP; > > err = fuse_create_open(dir, file->f_path.dentry, file, file->f_flags, mode, FUSE_TMPFILE); > if (err == -ENOSYS) { > fc->no_tmpfile = 1; > err = -EOPNOTSUPP; > } > return err; > } Okay. > > + > > static int fuse_mkdir(struct user_namespace *mnt_userns, struct inode *dir, > > struct dentry *entry, umode_t mode) > > { > > @@ -1913,6 +1931,7 @@ static const struct inode_operations fuse_dir_inode_operations = { > > .setattr = fuse_setattr, > > .create = fuse_create, > > .atomic_open = fuse_atomic_open, > > + .tmpfile = fuse_tmpfile, > > .mknod = fuse_mknod, > > .permission = fuse_permission, > > .getattr = fuse_getattr, > > diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h > > index 488b460e046f..98a9cf531873 100644 > > --- a/fs/fuse/fuse_i.h > > +++ b/fs/fuse/fuse_i.h > > @@ -784,6 +784,9 @@ struct fuse_conn { > > /* Does the filesystem support per inode DAX? */ > > unsigned int inode_dax:1; > > > > + /* Is tmpfile not implemented by fs? */ > > + unsigned int no_tmpfile:1; > > Just a nit, it might be nicer to turn this into a positive, i.e., > unsigned int has_tmpfile:1. Easier to understand as people usually > aren't great at processing negations. Fuse has zillions of these no_foobar flags. Turning this single one into a positive would be much more confusing IMO. Thanks, Miklos