summaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorIan Kent2019-04-11 06:28:02 +0200
committerAl Viro2019-06-27 02:28:15 +0200
commit8811249f0cfdd6552152173f881fddc7f20f427e (patch)
treea3aa302dc3be4f29b00bdce3b4b3caed61d5a40b /Documentation/filesystems
parentLinux 5.2-rc1 (diff)
downloadkernel-qcow2-linux-8811249f0cfdd6552152173f881fddc7f20f427e.tar.gz
kernel-qcow2-linux-8811249f0cfdd6552152173f881fddc7f20f427e.tar.xz
kernel-qcow2-linux-8811249f0cfdd6552152173f881fddc7f20f427e.zip
vfs: update d_make_root() description
Clearify d_make_root() usage, error handling and cleanup requirements. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/porting15
1 files changed, 13 insertions, 2 deletions
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 3bd1148d8bb6..f6714f7e6bb5 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -428,8 +428,19 @@ release it yourself.
--
[mandatory]
d_alloc_root() is gone, along with a lot of bugs caused by code
-misusing it. Replacement: d_make_root(inode). The difference is,
-d_make_root() drops the reference to inode if dentry allocation fails.
+misusing it. Replacement: d_make_root(inode). On success d_make_root(inode)
+allocates and returns a new dentry instantiated with the passed in inode.
+On failure NULL is returned and the passed in inode is dropped so the reference
+to inode is consumed in all cases and failure handling need not do any cleanup
+for the inode. If d_make_root(inode) is passed a NULL inode it returns NULL
+and also requires no further error handling. Typical usage is:
+
+ inode = foofs_new_inode(....);
+ s->s_root = d_make_inode(inode);
+ if (!s->s_root)
+ /* Nothing needed for the inode cleanup */
+ return -ENOMEM;
+ ...
--
[mandatory]