From mboxrd@z Thu Jan 1 00:00:00 1970 From: Camille Moncelier Subject: Re: [ext3] Changes to block device after an ext3 mount point has been remounted readonly Date: Thu, 18 Feb 2010 17:50:37 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE To: linux-fsdevel@vger.kernel.org Return-path: Received: from qw-out-2122.google.com ([74.125.92.24]:19778 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755850Ab0BRQu7 convert rfc822-to-8bit (ORCPT ); Thu, 18 Feb 2010 11:50:59 -0500 Received: by qw-out-2122.google.com with SMTP id 8so28442qwh.37 for ; Thu, 18 Feb 2010 08:50:58 -0800 (PST) In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Just forgot to post the script: ------------ 8< test.sh 8< ------------ #!/bin/bash while true; do dd bs=3D1M count=3D3 if=3D/dev/zero of=3D/tmp/sample.img > /tmp/tes= tsha.log 2>&1 losetup /dev/loop0 /tmp/sample.img >> /tmp/testsha.lo= g 2>&1 mkfs.ext3 /dev/loop0 >> /tmp/testsha.lo= g 2>&1 mount /dev/loop0 /mnt >> /tmp/testsha.lo= g 2>&1 touch /mnt/test >> /tmp/testsha.lo= g 2>&1 echo 's' > /proc/sysrq-trigger tail -n1 /var/log/messages.log >> /tmp/testsha.lo= g 2>&1 mount -o remount,ro,sync,dirsync /mnt >> /tmp/testsha.lo= g 2>&1 dd if=3D/dev/loop0 of=3D/tmp/hash1.img >> /tmp/testsh= a.log 2>&1 HASH_1=3D$(sha1sum /tmp/hash1.img | cut -d" " -f1) umount /mnt >> /tmp/testsha.lo= g 2>&1 dd if=3D/dev/loop0 of=3D/tmp/hash2.img >> /tmp/testsh= a.log 2>&1 HASH_2=3D$(sha1sum /tmp/hash2.img | cut -d" " -f1) mount -o ro /dev/loop0 /mnt >> /tmp/testsha.lo= g 2>&1 umount /mnt >> /tmp/testsha.lo= g 2>&1 dd if=3D/dev/loop0 of=3D/tmp/hash3.img >> /tmp/testsh= a.log 2>&1 HASH_3=3D$(sha1sum /tmp/hash3.img | cut -d" " -f1) losetup -d /dev/loop0 >> /tmp/testsha.lo= g 2>&1 if [ "$HASH_1" =3D "$HASH_2" -a "$HASH_1" =3D "$HASH_3" ] ; then rm /tmp/hash{1,2,3}.img echo All right ! else echo Something gone wrong: cat /tmp/testsha.log echo HASH_1: $HASH_1 echo HASH_2: $HASH_2 echo HASH_3: $HASH_3 exit 1 fi done ------------ 8< test.sh 8< ------------ ----------------- 8< ----------------- $ sudo bash test.sh All right ! All right ! Something gone wrong: 3+0 records in 3+0 records out 3145728 bytes (3.1 MB) copied, 0.00673144 s, 467 MB/s mke2fs 1.41.9 (22-Aug-2009) =46ilesystem label=3D OS type: Linux Block size=3D1024 (log=3D0) =46ragment size=3D1024 (log=3D0) 768 inodes, 3072 blocks 153 blocks (4.98%) reserved for the super user =46irst data block=3D1 Maximum filesystem blocks=3D3145728 1 block group 8192 blocks per group, 8192 fragments per group 768 inodes per group Writing inode tables: done Creating journal (1024 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. =46eb 18 17:40:15 graves kernel: EXT3-fs: mounted filesystem with writeback data mode. 6144+0 records in 6144+0 records out 3145728 bytes (3.1 MB) copied, 0.0271642 s, 116 MB/s 6144+0 records in 6144+0 records out 3145728 bytes (3.1 MB) copied, 0.0315827 s, 99.6 MB/s 6144+0 records in 6144+0 records out 3145728 bytes (3.1 MB) copied, 0.0293324 s, 107 MB/s HASH_1: 5a08a18d139fced51a874a091c52eb31c36d37b5 HASH_2: 6114873f3ef93a4a2636a04e172dd3a80ea54950 HASH_3: 6114873f3ef93a4a2636a04e172dd3a80ea54950 ----------------- 8< ----------------- On Thu, Feb 18, 2010 at 5:45 PM, PiX wrote: > I'm experiencing a strange behavior. After having remounted / to > readonly, I'm doing a sha1sum on /dev/sda1 (which is mounted on /) > Then, I reboot, GRUB starts the kernel with the ro option, when=A0I d= o a > hash of /dev/sda1 the sum has changed. > This only happen when the rootfs hash been mounted ro, then remounted > rw to make some changes and remounted ro. > On the next reboot the hash will change, but only one time. Next > reboots=A0will not alter the control sum, until of course I remount i= t > RW. > Here's a small shell script that show that some changes are made > between "mount -o remount,ro" and umount. > On my system the might run 1 time before failing as well as 20. > For the record: > $ uname -a > Linux cortex 2.6.32-ARCH #1 SMP PREEMPT Tue Feb 9 14:46:08 UTC 2010 > i686 Intel(R) Core(TM)2 Duo CPU E4400 @ 2.00GHz GenuineIntel GNU/Linu= x > -- > Camille Moncelier > http://devlife.org/ > > If Java had true garbage collection, most programs would > delete themselves upon execution. > --=20 Camille Moncelier http://devlife.org/ If Java had true garbage collection, most programs would delete themselves upon execution. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html