Messages in this thread | | | Date | Fri, 22 Aug 1997 07:41:12 -0400 | From | Bill Hawes <> | Subject | Re: 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
| |