On Sat, Aug 25, 2012 at 09:39:58PM +0400, Cyrill Gorcunov wrote: > On Sat, Aug 25, 2012 at 06:16:05PM +0100, Al Viro wrote: > > On Thu, Aug 23, 2012 at 02:43:24PM +0400, Cyrill Gorcunov wrote: > > > This patch prepares the ground for further extension of > > > /proc/pid/fd[info] handling code by moving fdinfo handling > > > code into fs/proc/fd.c. > > > > > > I think such move makes both fs/proc/base.c and fs/proc/fd.c > > > easier to read. > > > > BTW, looking at the other stuff in fs/proc/base.c, why the hell is > > struct file * grabbed in proc_map_files_readdir()? All we do with > > it is passing it to proc_fill_cache(), which passes it to > > proc_map_files_instantiate(), which looks at two sodding bits > > in file->f_mode. Then we go and fput() all those struct file > > references we'd been putting into the array... What for? > > Well, this could be simplified indeed, if I understand you correctly > you propose just save f_mode in flexible array and use it instead > of struct file, right? (which will require to rewrite code a bit) Yes. FWIW, proc_fill_cache() is really atrocious ;-/ Not to mention anything else, if we ever get a negative dentry there, we have a dentry leak. I don't think it's possible in practice, but... Furthermore, if (!child || IS_ERR(child) || !child->d_inode) goto end_instantiate; inode = child->d_inode; if (inode) { ino = inode->i_ino; type = inode->i_mode >> 12; } dput(child); looks really weird - how can we possibly get !inode when we'd just checked that child->inode is non-NULL? Moreover, that find_inode_number() a bit below is also as weird as it gets - in effect, we repeat d_lookup() we'd just done earlier. How *can* it get us anything? -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html