Re: Patch, forward release() return values to the close() call

David Brown (
Mon, 25 Mar 2002 08:33:50 -0500

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Mar 25, 2002 at 10:50:17AM +0100, Axel Kittenberger wrote:
> > This is me talking prior to having coffee, but Chapter 3 of the
> > Rubini/Corbet book says:
> >
> > The flush operation is invoked when a process closes its copy of a fi=
> > descriptor for a device; it should execute (and wait for) any outstan=
> > operations on the device. This must not be confused with the fsync
> > operation requested by user programs. Currently, flush is used only in =
> > network file system (NFS) code. If flush is NULL, it is simply not invo=
> >
> > I guess it doesn't specifically say it's not called in midstream, but
> > it reads as if flush() is called on /only/ close(). I may test this
> > today, just for fun.
> Oh thats interesting, indeed, so the function name "flush" is just=20
> contra-intentional. Oxay I know now how I could have written this driver=
> without patching the kernel.....

And FWIW, I tested this behavior with a dummy chardev and printks()
around open(), release, and flush(). flush() is indeed called only on
each close.

> Still the basic issue/idea is remaining. release() is defined as int retu=
> type, but everywhere it's called it's value is discarded. (except interna=
> in "intermezzo" whatever that is)
> btw: blkdev_put() has int return type and seems to return correctly the=
> return value from release()s for block devices, so I guess it would be th=
> right thing for char devs to do also.
> The other way I would also see as okay is to state release() can't return=
> anything senseful to anybody, bet then declare it as void return instead.=
> as the state is currently it's suboptimal from both views.

Agreed, but the question is which approach to use. :) Declaring it as void
sounds like it may involve a lot of driver fixup work.

- Dave

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at