2003-07-30 11:23:29

by Pilaszy Istvan

[permalink] [raw]
Subject: bug in loopback device (Linux version 2.6.0-test2)

Hi!

I found a bug in the loopback device.
See this two different results (the difference: in the second case I use
`-o loop' mount option for mounting /dev/hda3 to /hda3_copy

First case:
mount -t reiserfs /dev/hda3 /hda3
mount -t reiserfs /dev/hda3 /hda3_copy
rm -f /hda3/* /hda3_copy/*
ls -l /hda3/ /hda3_copy/
touch /hda3/xxx /hda3_copy/yyy
echo
ls -l /hda3 /hda3_copy
umount /hda3
umount /hda3_copy

The result is:
/hda3/:
total 0

/hda3_copy/:
total 0

/hda3:
total 0
-rw-r--r-- 1 root root 0 Jul 30 13:15 xxx
-rw-r--r-- 1 root root 0 Jul 30 13:15 yyy

/hda3_copy:
total 0
-rw-r--r-- 1 root root 0 Jul 30 13:15 xxx
-rw-r--r-- 1 root root 0 Jul 30 13:15 yyy

Everything is OK.
-----------------------------------------------------------------------
Second case:

mount -t reiserfs /dev/hda3 /hda3
mount -o loop -t reiserfs /dev/hda3 /hda3_copy
rm -f /hda3/* /hda3_copy/*
ls -l /hda3/ /hda3_copy/
touch /hda3/xxx /hda3_copy/yyy
echo
ls -l /hda3 /hda3_copy
umount /hda3
umount /hda3_copy

And the result:
/hda3/:
total 0

/hda3_copy/:
total 0

/hda3:
total 0
-rw-r--r-- 1 root root 0 Jul 30 13:17 xxx

/hda3_copy:
total 0
-rw-r--r-- 1 root root 0 Jul 30 13:17 yyy
---------------------------------------------------------------------------
Its quite interesting :-) Why to store to copy of the directory in the
memory? It causes inconsistency, and wastes memory.

Bye,
Istvan



2003-07-30 14:20:23

by Andries Brouwer

[permalink] [raw]
Subject: Re: bug in loopback device (Linux version 2.6.0-test2)

On Wed, Jul 30, 2003 at 01:23:17PM +0200, Pilaszy Istvan wrote:

> I found a bug in the loopback device.

Not really.

If you setup a loop device on a file or other device,
then the block device involved is the loop device.
Any access to that same file or device not via the
loop device will give undesired results.