Re: [patch-2.3.3] d_alloc_root(arg1,arg2) arg2 optimized away

Matthew Wilcox (Matthew.Wilcox@genedata.com)
Mon, 31 May 1999 01:13:40 +0200


On Sat, May 29, 1999 at 10:45:39AM +0100, tigran@aivazian.demon.co.uk wrote:
> Hello,
>
> I noticed that in d_alloc_root(root,old_root) the second argument is
> unused so I assumed that it is *not* for some future purpose but is a
> leftover of the past and went through all filesystems making them call the
> new one-argument version.
>
> hence the patch against 2.3.3 below:

I noticed that some places have the construct:

root_inode = iget(sb, MSDOS_ROOT_INO);
if (!root_inode)
goto out_no_root;
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root)
goto out_no_root;

while others do:

sb->s_root = d_alloc_root(iget(sb, MSDOS_ROOT_INO));
if (!sb->s_root)
goto out_no_root;

which looks somewhat cleaner at first sight, but can leak an inode if
the iget() succeeds and the d_alloc_root() fails. Do you want to fix
this while you're in the area? :-)

-- 
Matthew Wilcox <willy@bofh.ai>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/