mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
allow finish_no_open(file, ERR_PTR(-E...))
[ Upstream commit fe91e078b6 ]
... 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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
47c5304f1f
commit
d346157fc4
10
fs/open.c
10
fs/open.c
@@ -1059,18 +1059,20 @@ EXPORT_SYMBOL(finish_open);
|
|||||||
* finish_no_open - finish ->atomic_open() without opening the file
|
* finish_no_open - finish ->atomic_open() without opening the file
|
||||||
*
|
*
|
||||||
* @file: file pointer
|
* @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
|
* NB: unlike finish_open() this function does consume the dentry reference and
|
||||||
* the caller need not dput() it.
|
* the caller need not dput() it.
|
||||||
*
|
*
|
||||||
* Returns "0" which must be the return value of ->atomic_open() after having
|
* Returns 0 or -E..., which must be the return value of ->atomic_open() after
|
||||||
* called this function.
|
* having called this function.
|
||||||
*/
|
*/
|
||||||
int finish_no_open(struct file *file, struct dentry *dentry)
|
int finish_no_open(struct file *file, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
|
if (IS_ERR(dentry))
|
||||||
|
return PTR_ERR(dentry);
|
||||||
file->f_path.dentry = dentry;
|
file->f_path.dentry = dentry;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user