Skip to content

Commit 1a16dba

Browse files
author
Al Viro
committed
Document d_splice_alias() calling conventions for ->lookup() users.
Short version: it does the right thing when given NULL or ERR_PTR(...) and its calling conventions are chosen to have minimal PITA when used in ->lookup() instances. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 3837d20 commit 1a16dba

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Documentation/filesystems/porting

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,3 +622,14 @@ in your dentry operations instead.
622622
alloc_file_clone(file, flags, ops) does not affect any caller's references.
623623
On success you get a new struct file sharing the mount/dentry with the
624624
original, on failure - ERR_PTR().
625+
--
626+
[recommended]
627+
->lookup() instances doing an equivalent of
628+
if (IS_ERR(inode))
629+
return ERR_CAST(inode);
630+
return d_splice_alias(inode, dentry);
631+
don't need to bother with the check - d_splice_alias() will do the
632+
right thing when given ERR_PTR(...) as inode. Moreover, passing NULL
633+
inode to d_splice_alias() will also do the right thing (equivalent of
634+
d_add(dentry, NULL); return NULL;), so that kind of special cases
635+
also doesn't need a separate treatment.

0 commit comments

Comments
 (0)