From: Jan Kara Subject: Re: Sync does not flush to disk!? Date: Fri, 8 Jun 2012 16:11:39 +0200 Message-ID: <20120608141139.GD21080@quack.suse.cz> References: <4FD1CB8A.9080805@shiftmail.org> <20120608223332.5fe49193@notabene.brown> <4FD202CD.7000309@turmel.org> <4FD204B0.3000204@shiftmail.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Phil Turmel , NeilBrown , linux-raid , linux-ext4@vger.kernel.org To: Asdo Return-path: Received: from cantor2.suse.de ([195.135.220.15]:49075 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932339Ab2FHOLm (ORCPT ); Fri, 8 Jun 2012 10:11:42 -0400 Content-Disposition: inline In-Reply-To: <4FD204B0.3000204@shiftmail.org> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Fri 08-06-12 15:57:04, Asdo wrote: > On 06/08/12 15:49, Phil Turmel wrote: > > > >To put it another way: You can't safely access ext filesystems via > >raw devices in two systems. The kernel cache won't be synchronized, > >and you almost certainly *will* corrupt the contents. > > Thanks both of you for your explanations > > I might say that it seems to me a bad design: never before I saw a > cache that is not updated by writes. > Here the cache content is *older* than the data on the real devices!? > if it was *newer*, there are known cases (writeback cache not > flushed yet), but *older*... never seen. Well, the problem is in inconsistency of caches. There is one cache - page cache - used by filesystems to read & write file data which is addressed by inode, offset. And there is another cache caching the whole device addressed by device, offset. It would be too costly to keep both these caches consistent and most people don't care so we don't. BTW, if you configured KVM to use direct IO or virt IO when accessing the devices (a good idea anyway), you wouldn't have the problems either. Honza -- Jan Kara SUSE Labs, CR