Loopback caching bug in 2.2.14-15

From: Byron Stanoszek (gandalf@winds.org)
Date: Wed Jun 07 2000 - 08:56:15 EST


I've noticed a caching bug which didn't exist in earlier 2.2 kernels.

The problem manifests itself when you mount a file as a loopback image, then
read the contents of the file, change something in a directory under the mount
point, then reread the contents of the file. Here is an example:

# ls -l diskimage
-rw-r--r-- 1 root root 33554432 Jun 7 09:00 diskimage

# mount -o loop diskimage /ext0

# cat diskimage > diskimage.1

# mkdir /ext0/test

# sync

# cat diskimage > diskimage.2

# diff diskimage.1 diskimage.2

---
The binary files diskimage.1 and diskimage.2 do not differ at this point.

It appears that the file 'diskimage' was cached into memory during the first read. Subsequent writes to the actual /dev/loop device do not invalidate the cached blocks of the 'diskimage' file. The timestamp on 'diskimage' also does not update when anything in /ext0 is modified.

If I instead read directly from the loop device, as in 'cat /dev/loop0 > diskimage.2' instead, then the binary files indeed differ, as expected.

This difference in functionality was first noticed in kernel 2.2.14. The cached contents of 'diskimage' persist even after /ext0 is unmounted, and therefore I classify that as a bug.

-Byron Stanoszek <gandalf@winds.org>

- 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 Jun 07 2000 - 21:00:28 EST