diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2025-09-12 11:20:27 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2025-09-16 23:59:38 -0400 |
| commit | fe91e078b60d1beabf5cef4a37c848457a6d2dfb (patch) | |
| tree | 5cc6dca7466c5faf47e9cce9011fa7d78fd30500 /fs/open.c | |
| parent | 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c (diff) | |
| download | tip-fe91e078b60d1beabf5cef4a37c848457a6d2dfb.tar.gz | |
allow finish_no_open(file, ERR_PTR(-E...))
... allowing any ->lookup() return value to be passed to it.
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
| -rw-r--r-- | fs/open.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/open.c b/fs/open.c index 9655158c38853e..4890b13461c7bd 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(). * * 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; } |
