Re: [PATCH 1/6 v7] vfs: add i_op->open()

From: Miklos Szeredi
Date: Tue Mar 22 2011 - 14:12:52 EST


On Tue, 22 Mar 2011, Linus Torvalds wrote:
> > + Â Â Â Â Â Â Â struct inode *inode = nd->path.dentry->d_inode;
> > +
> > + Â Â Â Â Â Â Â if (inode->i_op->open) {
> > + Â Â Â Â Â Â Â Â Â Â Â int flags = filp->f_flags;
> > + Â Â Â Â Â Â Â Â Â Â Â put_filp(filp);
> > + Â Â Â Â Â Â Â Â Â Â Â filp = inode->i_op->open(nd->path.dentry, flags, cred);
> > + Â Â Â Â Â Â Â } else {
> > + Â Â Â Â Â Â Â Â Â Â Â filp = __dentry_open(&nd->path, filp, NULL, cred);
> > + Â Â Â Â Â Â Â }
>
> This seems broken.
>
> Why don't you just pass in the filp to the ->open routine, and drop
> that "flags" argument. Maybe other filesystems want to use ->open, but
> don't want to put_filp() on the filp we already allocated, only to
> allocate a new one?

Maybe, although I don't see the reason to do that. Why keep the
original one? It doesn't contain any information besides the flags
and the dentry/vfsmount.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/