Re: BUG in bread ?

From: Steve Dodd (steved@loth.demon.co.uk)
Date: Sat May 27 2000 - 16:23:26 EST


[BTW, don't feel you have to post the same questions over and over..]

On Wed, May 24, 2000 at 11:22:55AM +0300, BenHanokh Gabriel wrote:

> i have notice that bread on the new kernel returns the "on disk" block
> and not the cached block.
> i.e. if i overwrite a file block, calling bread will return the OLD data
> from disk,
> and not the new data which is in the cache now.

bread will return the buffer cache block. file/inode data never hits the
buffer cache in 2.3 (for almost all filesystems). The I/O is done through
the page cache (see mm/filemap.c).

> i guess that the write is performs to the cache, but bread
> doesn't know about it, and it reads the block from the disk.
> ( if i call sync() before bread, i get the new data )
>
> i have tried the same code with kernel 2.2.14 and it works fine( i.e. i
> get the recent data from the cache )
> but kernel 2.3.99-pre8 changes this behavior.

It changed pretty early in 2.3 IIRC. I'm sure if you search the archives
of l-k and -fsdevel you'll find messages about it.

> is this a bug of a feature ?

A feature. What are you trying to do? Are you working on a filesystem driver
or something else?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:21 EST