linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: update d_make_root() description
@ 2019-04-11  4:28 Ian Kent
  0 siblings, 0 replies; only message in thread
From: Ian Kent @ 2019-04-11  4:28 UTC (permalink / raw)
  To: Al Viro; +Cc: Kernel Mailing List, linux-fsdevel

Clearify d_make_root() usage, error handling and cleanup
requirements.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 Documentation/filesystems/porting |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index cf43bc4dbf31..1ebc1c6eb64b 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 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]


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-11  4:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11  4:28 [PATCH] vfs: update d_make_root() description Ian Kent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).