lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120608223332.5fe49193@notabene.brown>
Date:	Fri, 8 Jun 2012 22:33:32 +1000
From:	NeilBrown <neilb@...e.de>
To:	Asdo <asdo@...ftmail.org>
Cc:	linux-raid <linux-raid@...r.kernel.org>, linux-ext4@...r.kernel.org
Subject: Re: Sync does not flush to disk!?

On Fri, 08 Jun 2012 11:53:14 +0200 Asdo <asdo@...ftmail.org> wrote:

> Hello all
> I don't exactly know where to ask this question...
> 
> I have a situation of
> 
> sda1 + sdb1 --> MD raid1
> Above that is an ext4 filesystem. No LVM.
> 
> I am making changes to that filesystem (vi a file) and then i am doing
> sync
> sync
> (twice)
> 
> then I am starting KVM in snapshot mode on the sda and sdb disks so to 
> virtualize the same system on which I am operating.
> 
> kvm -m 1024 -hda /dev/sda -hdb /dev/sdb -snapshot
> 
> The strange thing is that the virtual machine is NOT seeing the latest 
> changes to that file!
> 
> Then I tried to do :
> 
> for i in /dev/md? /dev/sda /dev/sdb ; do blockdev --flushbufs $i ; done
> 
> and restart KVM,
> and NOW it is seeing the changes.
> 
> In the past I had similar problems, and not knowing about blockdev 
> --flushbufs I ended up dismounting the filesystems and stopping the 
> RAIDs. That also appeared to actually commit stuff to disk.
> 
> So sync is not enough? Would somebody explain to me better?

There is a cache associated with /dev/sda and /dev/sdb which md does not make
any use of.  The filesystem doesn't use it either.  It is only used from
user-space reads from /dev/sda or /dev/sdb.
When you "sync" the filesystem, the new data is written out, but the cache it
not changes.  When you then read from /dev/sda, you might get cached data,
which is stale.

blockdev --flushbufs
clears that cache so that subsequent reads come from the device, not from the
cache.

i.e. it is read caching that is causing the confusion you see, not write
caching.

NeilBrown

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ