lkml.org 
[lkml]   [1997]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Dubious code in do_pipe of 2.1.51
Andreas Schwab wrote:
>
> The following line from fs/pipe.c:do_pipe look suspicious:
>
> f1->f_dentry = f2->f_dentry = dget(d_alloc_root(inode, NULL));
>
> Two references to a dentry, but only one dget?? Shouldn't that rather be:
>
> f1->f_dentry = dget(d_alloc_root(inode, NULL));
> f2->f_dentry = dget(f1->f_dentry);
>
> Or did i miss something?

No, the code is fine. Pipe inodes are private to the pipe, and
d_alloc_root gives a dentry with use count 1. So we end up with two
references, and with d_count = 2.

Normal root inodes are stored in sb->s_root, so if you're using one of
those you would need two dgets.

Regards,
Bill

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.025 / U:0.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site