Re: [RFC][PATCH 06/30] make open_namei() return a filp

Christoph Hellwig
2008-02-09T05:09:25Z

On Fri, Feb 08, 2008 at 02:26:54PM -0800, Dave Hansen wrote:
>
> open_namei() will, in the future, need to take mount write counts
> over its creation and truncation (via may_open()) operations. It
> needs to keep these write counts until any potential filp that is
> created gets __fput()'d.
>
> This gets complicated in the error handling and becomes very murky
> as to how far open_namei() actually got, and whether or not that
> mount write count was taken.
>
> Creating the filps inside of open_namei() lets us shift the write
> count to be taken and released along with the filp. We can hold
> a temporary write count during those creation and truncation
> operations, then release them once the write for the filp has
> been established.
>
> Any caller who gets a 'struct file' back must consider that filp
> instantiated and fput() it normally. The callers no longer
> have to worry about ever manually releasing a mnt write count.

This patch description is not correct anymore, open_namei is actually
gone with this patch as it got merged into do_filp_open.