From: Jan Kara Subject: Re: [ext3] Changes to block device after an ext3 mount point has been remounted readonly Date: Tue, 23 Feb 2010 00:05:52 +0100 Message-ID: <20100222230552.GB13882@atrey.karlin.mff.cuni.cz> References: <9F53CAF8-B6B4-40EB-89FA-CD6779D17DBE@sun.com> <20100222223252.GA13882@atrey.karlin.mff.cuni.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Andreas Dilger , ext4 development To: Camille Moncelier Return-path: Received: from ksp.mff.cuni.cz ([195.113.26.206]:52934 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754457Ab0BVXGI (ORCPT ); Mon, 22 Feb 2010 18:06:08 -0500 Content-Disposition: inline In-Reply-To: <20100222223252.GA13882@atrey.karlin.mff.cuni.cz> Sender: linux-ext4-owner@vger.kernel.org List-ID: > > On Thu, Feb 18, 2010 at 10:41 PM, Andreas Dilger wrote: > > > > > Are you sure this isn't because e2fsck has been run at boot time and changed > > > e.g. the "last checked" timestamp in the superblock? > > > > > No, I replaced /sbin/init by something which compute the sha1sum of > > the root partition, display it then call /sbin/init and I can see that > > the hash has changed after mount -o remount,ro. > > > > As little as I understand, I managed to make a diff between two > > hexdump of small images where changes happened after I created a file > > and remounted the fs ro and it seems that, the driver didn't wrote > > changes to the disk until unmount ( The hexdump clearly shows that > > /lost+found and /test file has been written after the umount ) > > > > workaround: Is there some knob in /proc or /sys which can trigger all > > pending changes to disk ? ( Like /proc/sys/vm/drop_caches but for > > filesystems ? ) > I've looked at your script. The problem is that "echo s >/proc/sysrq_trigger" > isn't really a data integrity operation. In particular it does not wait on > IO to finish (with the new writeback code it does not even wait for IO to be > submitted) so you sometimes take the image checksum before the sync actually > happens. If you used sync(1) instead, everything should work as expected... Hmm, and apparently there is some subtlety in the loopback device code because even when I use sync(1), the first and second images sometimes differ (although it's much rarer). But I see a commit block of the transaction already in the first image (the commit block is written last) but the contents of the transaction is present only in the second image. Honza -- Jan Kara SuSE CR Labs