On Sat, 13 Sep 2025, Al Viro wrote: > ... allowing any ->lookup() return value to be passed to it. > > Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx> > --- > fs/open.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/fs/open.c b/fs/open.c > index 9655158c3885..4890b13461c7 100644 > --- a/fs/open.c > +++ b/fs/open.c > @@ -1059,18 +1059,20 @@ EXPORT_SYMBOL(finish_open); > * finish_no_open - finish ->atomic_open() without opening the file > * > * @file: file pointer > - * @dentry: dentry or NULL (as returned from ->lookup()) > + * @dentry: dentry, ERR_PTR(-E...) or NULL (as returned from ->lookup()) > * > - * This can be used to set the result of a successful lookup in ->atomic_open(). > + * This can be used to set the result of a lookup in ->atomic_open(). This is my favourite part of the series - removing the word "successful". It makes the API more general. My only other thought is that if (d_in_lookup(dentry)) { struct dentry *res = dir->i_op->lookup(dir, dentry, 0); if (res || d_really_is_positive(dentry)) return finish_no_open(file, res); } is a common pattern. It would be nice if we could factor it out into a help but I cannot think of a clean way to do that. You can add Reviewed-by: NeilBrown <neil@xxxxxxxxxx> if you like. Thanks, NeilBrown > * > * NB: unlike finish_open() this function does consume the dentry reference and > * the caller need not dput() it. > * > - * Returns "0" which must be the return value of ->atomic_open() after having > - * called this function. > + * Returns 0 or -E..., which must be the return value of ->atomic_open() after > + * having called this function. > */ > int finish_no_open(struct file *file, struct dentry *dentry) > { > + if (IS_ERR(dentry)) > + return PTR_ERR(dentry); > file->f_path.dentry = dentry; > return 0; > } > -- > 2.47.2 > >