public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PROBLEM: ext2/mount - multiple mounts corrupts inodes
@ 2002-01-30 23:07 Kris Urquhart
  2002-01-30 23:37 ` Andreas Dilger
  0 siblings, 1 reply; 12+ messages in thread
From: Kris Urquhart @ 2002-01-30 23:07 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org'

I have investigated this problem to the best of my resources.  If someone
would
please direct me down some more avenues of discovery, I would greatly
appreciate 
it.  If someone would take the time and effort to duplicate this problem in
a 
different environment, I would be even more grateful.  Thanks.  -Kris

[1.] One line summary of the problem: 
A mount of an already mounted ext2 partition corrupts inodes if there have
been 
recent writes without an intervening sync.

[2.] Full description of the problem/report: 
I have a script that is not sure if an ext2 partition will already be
mounted, so 
it tries the mount and is happy if the exit status is 0 or 32 (already
mounted).  
This worked fine with the 2.2.17 kernel, but I started getting corrupted
inodes 
when I migrated to 2.4.

I see this problem only when I compile my own kernel, but not when I use a
stock
RedHat kernel.  I have searched the web, the RedHat kernel source rpm
patches, 
and the RedHat Bugzilla database, but I can't find anything useful.
 
My .config is very stripped down (see end of email).

I can easily recreate this problem on two very different hardware setups,
with 
two different compilers, and with multiple versions of the 2.4 kernel.

[3.] Keywords (i.e., modules, networking, kernel): 
ext2, mount, file systems, kernel

[4.] Kernel version (from /proc/version): 
Linux version 2.4.10 (kurquhart@bay.sw.littlefeet-inc.com) (gcc version
egcs-2.91.66 
19990314/Linux (egcs-1.1.2 release)) #1 Wed Jan 30 09:46:52 PST 2002

- I have also tried kernel versions 2.4.7 and 2.4.17, as well as gcc 2.96,
but no 
change.

[6.] A small shell script or example program which triggers the problem (if
possible) 
#!/bin/bash
DEVICE=./loopdev
MOUNT=/mnt/hd
umount $MOUNT
dd if=/dev/zero of=$DEVICE bs=1k count=5000
mke2fs -F $DEVICE
rm -rf $MOUNT
mkdir -p $MOUNT
mount -t ext2 -o loop $DEVICE $MOUNT
cp -r /bin/tar $MOUNT
cp -r /bin/zcat $MOUNT
#sleep 5
#sync
mount -t ext2 -o loop $DEVICE $MOUNT
find $MOUNT -ls
umount $MOUNT
umount $MOUNT

- A real block device can be used in place of the loop device, but is
obviously 
destructive.  I have tried local IDE drives (both solid state and magnetic),
as
well as NFS mounted SCSI drives.

- If either the sleep or the sync line is uncommented, then all is fine.

- Here is the output:
umount: /mnt/hd: not mounted
5000+0 records in
5000+0 records out
mke2fs 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1256 inodes, 5000 blocks
250 blocks (5.00%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
1256 inodes per group

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
     2    1 drwxr-xr-x   3 root     root         1024 Jan  1 01:11 /mnt/hd
    11   12 drwxr-xr-x   2 root     root        12288 Jan  1 01:11
/mnt/hd/lost+found
find: /mnt/hd/tar: Input/output error
find: /mnt/hd/zcat: Input/output error

- When a loop device is used, e2fsck finds nothing wrong after the two
umount commands, 
but does find problems if the second umount is commented out.  
- If a real block device is used, e2fsck finds problems in either case:
% e2fsck -f /dev/hda3
e2fsck 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Entry 'tar' in / (2) has deleted/unused inode 12.  Clear<y>? yes

Entry 'zcat' in / (2) has deleted/unused inode 13.  Clear<y>? yes

Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -230 -231 -232 -233 -234 -235 -236 -237 -238 -239
-240 
-241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255
-256 
-257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271
-272 
-273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287
-288 
-289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303
-304 
-305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319
-320 
-321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335
-336 
-337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351
-352 
-353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367
-368 
-369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383
-384 
-385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399
-400 
-401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415
-416 
-417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430
Fix<y>? yes

Free blocks count wrong for group #0 (7762, counted=7963).
Fix<y>? yes

Free blocks count wrong (12919, counted=13120).
Fix<y>? yes

Inode bitmap differences:  -12 -13
Fix<y>? yes

Free inodes count wrong for group #0 (1683, counted=1685).
Fix<y>? yes

Free inodes count wrong (3379, counted=3381).
Fix<y>? yes


/dev/hda3: ***** FILE SYSTEM WAS MODIFIED *****
/dev/hda3: 11/3392 files (0.0% non-contiguous), 446/13566 blocks

[7.] Environment 
I have this problem on two very different systems: an AMD 586 133MHz 32Mb 
RAM with a 16Mb flash drive, and an Intel Celeron 600MHz 128Mb RAM with
large 
IDE drives.  I can provide more details if desired.

[X.] Other notes, patches, fixes, workarounds: 
Non-comment lines of .config for 2.4.10:
CONFIG_X86=y
CONFIG_ISA=y
CONFIG_UID16=y
CONFIG_MODULES=y
CONFIG_M486=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_CMPXCHG=y
CONFIG_X86_XADD=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_X86_L1_CACHE_SHIFT=4
CONFIG_X86_USE_STRING_486=y
CONFIG_X86_ALIGNMENT_16=y
CONFIG_NOHIGHMEM=y
CONFIG_NET=y
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
CONFIG_KCORE_ELF=y
CONFIG_BINFMT_ELF=y
CONFIG_PARPORT=y
CONFIG_PARPORT_PC=y
CONFIG_PARPORT_PC_CML1=y
CONFIG_BLK_DEV_FD=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=20000
CONFIG_BLK_DEV_INITRD=y
CONFIG_PACKET=y
CONFIG_NETLINK=y
CONFIG_RTNETLINK=y
CONFIG_NETLINK_DEV=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDEDISK=y
CONFIG_NETDEVICES=y
CONFIG_NET_ETHERNET=y
CONFIG_NET_PCI=y
CONFIG_CS89x0=y
CONFIG_PPP=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_SERIAL_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=2048
CONFIG_RTC=y
CONFIG_PROC_FS=y
CONFIG_DEVPTS_FS=y
CONFIG_EXT2_FS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_SUNRPC=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_MSDOS_PARTITION=y
CONFIG_VGA_CONSOLE=y
CONFIG_VIDEO_SELECT=y

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: PROBLEM: ext2/mount - multiple mounts corrupts inodes
@ 2002-01-31  1:27 Kris Urquhart
  2002-01-31  4:45 ` Andreas Dilger
  2002-01-31  5:05 ` Alexander Viro
  0 siblings, 2 replies; 12+ messages in thread
From: Kris Urquhart @ 2002-01-31  1:27 UTC (permalink / raw)
  To: 'Alexander Viro', Andreas Dilger
  Cc: 'linux-kernel@vger.kernel.org'



> -----Original Message-----
> From: Alexander Viro [mailto:viro@math.psu.edu]
> Sent: Wednesday, January 30, 2002 4:15 PM
> To: Andreas Dilger
> Cc: Kris Urquhart; 'linux-kernel@vger.kernel.org'
> Subject: Re: PROBLEM: ext2/mount - multiple mounts corrupts inodes
> 
> 
> 
> 
> On Wed, 30 Jan 2002, Andreas Dilger wrote:
> 
> > On Jan 30, 2002  15:07 -0800, Kris Urquhart wrote:
> > > [1.] One line summary of the problem: 
> > > A mount of an already mounted ext2 partition corrupts 
> inodes if there have
> > > been recent writes without an intervening sync.
> > 
> > This _should_ be handled OK by the kernel simply by not mounting the
> > filesystem the second time.  If you try and mount it a 
> second time it
> > _should_ just do a "bind" mount instead of a real mount, I think.
> 
> Which is what actually happens.  I suspect that he ends up 
> forgetting to
> umount it...
> 
> Anyway, try to reproduce it on 2.4.16 or later and give the 
> contents of
> /proc/mounts before and after your script.
> 

I upgraded to 2.4.17, and inserted "cat /proc/mounts" 
several places in my script.  

The results are below, and definitely insightful.  

When using a loop device, the second mount creates a 
new loop device that reads a device file that is in an 
unpredictable state since the first loop device is 
still mounted with that device file as a source.  Makes 
sense to me; GIGO.

When using a disk partition, however, the second mount 
appears to fail, but then yields the exact same results
as the loop device example.  It appears that the second 
mount actually replaced the first one, without giving the 
first one a chance to sync to disk?

----------------- loop device --------------------------
+ DEVICE=./loopdev
+ MOUNT=/mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
+ umount /mnt/hd
umount: /mnt/hd: not mounted
+ dd if=/dev/zero of=./loopdev bs=1k count=5000
5000+0 records in
5000+0 records out
+ mke2fs -F ./loopdev
mke2fs 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1256 inodes, 5000 blocks
250 blocks (5.00%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
1256 inodes per group

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
+ rm -rf /mnt/hd
+ mkdir -p /mnt/hd
+ mount -t ext2 -o loop ./loopdev /mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
/dev/loop0 /mnt/hd ext2 rw 0 0
+ cp -r /bin/tar /mnt/hd
+ cp -r /bin/zcat /mnt/hd
+ mount -t ext2 -o loop ./loopdev /mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
/dev/loop0 /mnt/hd ext2 rw 0 0
/dev/loop1 /mnt/hd ext2 rw 0 0
+ find /mnt/hd -ls
     2    1 drwxr-xr-x   3 root     root         1024 Dec 31 15:25 /mnt/hd
    11   12 drwxr-xr-x   2 root     root        12288 Dec 31 15:25
/mnt/hd/lost+found
find: /mnt/hd/tar: Input/output error
find: /mnt/hd/zcat: Input/output error
+ umount /mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
/dev/loop0 /mnt/hd ext2 rw 0 0
+ umount /mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd

---------------- disk partition ------------------------
+ DEVICE=/dev/hda3
+ MOUNT=/mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
+ umount /mnt/hd
umount: /mnt/hd: not mounted
+ dd if=/dev/zero of=/dev/hda3 bs=1k count=5000
5000+0 records in
5000+0 records out
+ mke2fs -F /dev/hda3
mke2fs 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
3392 inodes, 13566 blocks
678 blocks (5.00%) reserved for the super user
First data block=1
2 block groups
8192 blocks per group, 8192 fragments per group
1696 inodes per group
Superblock backups stored on blocks:
        8193

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
+ rm -rf /mnt/hd
+ mkdir -p /mnt/hd
+ mount -t ext2 /dev/hda3 /mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
/dev/hda3 /mnt/hd ext2 rw 0 0
+ cp -r /bin/tar /mnt/hd
+ cp -r /bin/zcat /mnt/hd
+ mount -t ext2 /dev/hda3 /mnt/hd
mount: /dev/hda3 already mounted or /mnt/hd busy
mount: according to mtab, /dev/hda3 is already mounted on /mnt/hd
+ grep /mnt/hd
+ cat /proc/mounts
/dev/hda3 /mnt/hd ext2 rw 0 0
+ find /mnt/hd -ls
     2    1 drwxr-xr-x   3 root     root         1024 Dec 31 15:17 /mnt/hd
    11   12 drwxr-xr-x   2 root     root        12288 Dec 31 15:17
/mnt/hd/lost+found
find: /mnt/hd/tar: Input/output error
find: /mnt/hd/zcat: Input/output error
+ umount /mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
+ umount /mnt/hd
umount: /mnt/hd: not mounted
+ cat /proc/mounts
+ grep /mnt/hd

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: PROBLEM: ext2/mount - multiple mounts corrupts inodes
@ 2002-01-31 17:28 Kris Urquhart
  2002-01-31 21:57 ` Alexander Viro
  0 siblings, 1 reply; 12+ messages in thread
From: Kris Urquhart @ 2002-01-31 17:28 UTC (permalink / raw)
  To: 'Andreas Dilger'
  Cc: 'Alexander Viro', 'linux-kernel@vger.kernel.org'

> From: Andreas Dilger [mailto:adilger@turbolabs.com]
> Sent: Wednesday, January 30, 2002 8:46 PM
>
> > + find /mnt/hd -ls
> >      2    1 drwxr-xr-x   3 root     root         1024 Dec 
> 31 15:17 /mnt/hd
> >     11   12 drwxr-xr-x   2 root     root        12288 Dec 31 15:17
> > /mnt/hd/lost+found
> > find: /mnt/hd/tar: Input/output error
> > find: /mnt/hd/zcat: Input/output error
> 
> Any interesting output in 'dmesg' when this happens?
> 

Dec 31 23:42:41 jumptec kernel: VFS: Disk change detected on device
ide0(3,3)
Dec 31 23:42:41 jumptec kernel: VFS: Disk change detected on device
ide0(3,3)
Dec 31 23:42:41 jumptec kernel: invalidate: dirty buffer
Dec 31 23:42:41 jumptec kernel: invalidate: busy buffer
Dec 31 23:42:41 jumptec kernel: invalidate: dirty buffer
Dec 31 23:42:41 jumptec kernel: invalidate: busy buffer
Dec 31 23:42:41 jumptec kernel: invalidate: dirty buffer
Dec 31 23:42:41 jumptec kernel: invalidate: busy buffer
Dec 31 23:42:41 jumptec kernel: invalidate: dirty buffer
Dec 31 23:42:41 jumptec kernel: invalidate: busy buffer
Dec 31 23:42:41 jumptec kernel: invalidate: dirty buffer
Dec 31 23:42:41 jumptec kernel: invalidate: dirty buffer
Dec 31 23:42:41 jumptec kernel: VFS: busy inodes on changed media.

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: PROBLEM: ext2/mount - multiple mounts corrupts inodes
@ 2002-01-31 17:31 Kris Urquhart
  0 siblings, 0 replies; 12+ messages in thread
From: Kris Urquhart @ 2002-01-31 17:31 UTC (permalink / raw)
  To: 'Alexander Viro'
  Cc: Andreas Dilger, 'linux-kernel@vger.kernel.org'

> From: Alexander Viro [mailto:viro@math.psu.edu]
> Sent: Wednesday, January 30, 2002 9:05 PM
> 
> > + grep /mnt/hd
> > + cat /proc/mounts
> > /dev/hda3 /mnt/hd ext2 rw 0 0
> > + find /mnt/hd -ls
> >      2    1 drwxr-xr-x   3 root     root         1024 Dec 
> 31 15:17 /mnt/hd
> >     11   12 drwxr-xr-x   2 root     root        12288 Dec 31 15:17
> > /mnt/hd/lost+found
> > find: /mnt/hd/tar: Input/output error
> > find: /mnt/hd/zcat: Input/output error
> 
> WTF???  Very interesting...  What about kernel messages?  It 
> looks like
> stat(2) failing.

Yes, please see my recent reply to Andreas Dilger.

> Just in case - could you put the same find before the second 
> attempt of
> mount?
> 

+ find /mnt/hd -ls
     2    1 drwxr-xr-x   3 root     root         1024 Dec 31 23:42 /mnt/hd
    11   12 drwxr-xr-x   2 root     root        12288 Dec 31 23:42
/mnt/hd/lost+found
    12  149 -rwxr-xr-x   1 root     root       150796 Dec 31 23:42
/mnt/hd/tar
    13   52 -rwxr-xr-x   1 root     root        51228 Dec 31 23:42
/mnt/hd/zcat
+ mount -t ext2 /dev/hda3 /mnt/hd
mount: /dev/hda3 already mounted or /mnt/hd busy
mount: according to mtab, /dev/hda3 is already mounted on /mnt/hd
+ cat /proc/mounts
+ grep /mnt/hd
/dev/hda3 /mnt/hd ext2 rw 0 0
+ find /mnt/hd -ls
     2    1 drwxr-xr-x   3 root     root         1024 Dec 31 23:42 /mnt/hd
    11   12 drwxr-xr-x   2 root     root        12288 Dec 31 23:42
/mnt/hd/lost+found
find: /mnt/hd/tar: Input/output error
find: /mnt/hd/zcat: Input/output error


^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: PROBLEM: ext2/mount - multiple mounts corrupts inodes
@ 2002-01-31 23:46 Kris Urquhart
  0 siblings, 0 replies; 12+ messages in thread
From: Kris Urquhart @ 2002-01-31 23:46 UTC (permalink / raw)
  To: 'Alexander Viro'
  Cc: 'Andreas Dilger', 'linux-kernel@vger.kernel.org'

> -----Original Message-----
> From: Alexander Viro [mailto:viro@math.psu.edu]
> Sent: Thursday, January 31, 2002 1:58 PM

> On Thu, 31 Jan 2002, Kris Urquhart wrote:
> 
> > Dec 31 23:42:41 jumptec kernel: VFS: Disk change detected on device
> > ide0(3,3)
> > Dec 31 23:42:41 jumptec kernel: VFS: Disk change detected on device
> > ide0(3,3)
> > Dec 31 23:42:41 jumptec kernel: invalidate: dirty buffer
> 
> I'd say...  Looks like a broken disk change check and everything after
> that is not a surprise.
> 
> What patches do you have applied and what chipset it is?
>

No patches - linux-2.4.17 right off of www.linux.org.  

The chipset is an ALI 1487/1489.  
The disk itself is a JUMPtec DISKchip with a SanDisk 20-99-00024-1 on it.

The relevant lines from dmesg are:
 Uniform Multi-Platform E-IDE driver Revision: 6.31
 ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
 hda: SunDisk SDTB-128, ATA DISK drive
 ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
 hda: 31360 sectors (16 MB) w/1KiB Cache, CHS=490/2/32
 Partition check:
  hda: hda1 hda2 hda3

% cat /proc/ide/driver
ide-disk version 1.10

There is a CONFIG_BLK_DEV_ALI14XX, but apparently it only turns on 
support for the second channel.  I tried it anyway (along with the 
ide0=ali14xx boot parameter), but the disk was then not recognized 
at boot time (busy/timeout during partition check).  A google search 
did not turn up any problems with ali14xx.c since 2.0.

What else should I try?

Thanks.

-Kris




^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: PROBLEM: ext2/mount - multiple mounts corrupts inodes
@ 2002-02-01  1:00 Ishan O. Jayawardena
  0 siblings, 0 replies; 12+ messages in thread
From: Ishan O. Jayawardena @ 2002-02-01  1:00 UTC (permalink / raw)
  To: linux-kernel

Greetings everyone,

	I'm afraid that try as I may, I couldn't reproduce Kris's symptoms.
This is with 2.4.18pre7aa1, No HIGHMEM, Plus a patch from _Andreas
Dilger_ (appended below), e2fsprogs 1.25, single IDE disk. Everything
works as expected.

Alexander Viro wrote:
> WTF???  Very interesting...  What about kernel messages?  It looks like
> stat(2) failing.

> Just in case - could you put the same find before the second attempt of
> mount?

Did that. Still No Problem. Gentlemen, this is a low end (real) IBM
machine with 64 MB SDRAM, 333 MHz Celeron (pre-Coppermine), 128 kb L2
cache (16 kb (*2?) L1), on sloooow vesafb, in X, while compiling
gcc-3.0.3 for C only :)

(I even did away with the umounts after the first runs were
successful... then just kept mounting over and over on the same
directory.) I'm afraid I can't test with plain 2.4.18-pre7 or anything
else as this is the only 2.4 kernel I have, and Kris did say the faults
were not reproducible on 2.2. Everything was done as root.

My Script:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash
DEVICE=./loopdev
MOUNT=/mnt/tmp

# umount $MOUNT

dd if=/dev/zero of=$DEVICE bs=1k count=1000
mke2fs -v -F $DEVICE
# rm -rf $MOUNT
# mkdir -p $MOUNT
mount -v -t ext2 -o loop $DEVICE $MOUNT
cp -vr /bin/tar $MOUNT
cp -vr /bin/zcat $MOUNT
#sleep 5
#sync

find $MOUNT -ls

mount -t ext2 -o loop $DEVICE $MOUNT

find $MOUNT -ls
# umount $MOUNT
# umount $MOUNT

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Andreas's patch (adopted for 2.4.1[78])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BEGIN PATCH
--- linux/fs/ext2/super.c       Mon Jan 28 14:10:16 2002
+++ linux/fs/ext2/super.c.mod   Mon Jan 28 13:41:06 2002
@@ -286,14 +286,14 @@ static int ext2_setup_super (struct supe
                              struct ext2_super_block * es,
                              int read_only)
 {
-       int res = 0;
+       if (read_only)
+               return 0;
        if (le32_to_cpu(es->s_rev_level) > EXT2_MAX_SUPP_REV) {
                printk ("EXT2-fs warning: revision level too high, "
                        "forcing read-only mode\n");
-               res = MS_RDONLY;
+               sb->s_flags |= MS_RDONLY;
+               return MS_RDONLY;
        }
-       if (read_only)
-               return res;
        if (!(sb->u.ext2_sb.s_mount_state & EXT2_VALID_FS))
                printk ("EXT2-fs warning: mounting unchecked fs, "
                        "running e2fsck is recommended\n");
@@ -328,7 +328,7 @@ static int ext2_setup_super (struct supe
                ext2_check_inodes_bitmap (sb);
        }
 #endif
-       return res;
+       return 0;
 }
 
 static int ext2_check_descriptors (struct super_block * sb)
@@ -751,8 +751,9 @@ int ext2_remount (struct super_block * s
                 * by e2fsck since we originally mounted the partition.)
                 */
                sb->u.ext2_sb.s_mount_state = le16_to_cpu(es->s_state);
-               if (!ext2_setup_super (sb, es, 0))
-                       sb->s_flags &= ~MS_RDONLY;
+               if (ext2_setup_super (sb, es, 0))
+                       return -EROFS;
+               sb->s_flags &= ~MS_RDONLY;
        }
        ext2_sync_super(sb, es);
        return 0;
~~~~~~~~~~~~~~~~~~~~~ END PATCH

Hope this helps...

Cheerio!
	 alvin
~~~~
	We build a virtual shell around us to keep away the sorrows of life.
Most of us are very good at it... Those who aren't good enough, become
saints.
.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2002-01-31 23:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-30 23:07 PROBLEM: ext2/mount - multiple mounts corrupts inodes Kris Urquhart
2002-01-30 23:37 ` Andreas Dilger
2002-01-31  0:14   ` Alexander Viro
2002-01-31  6:35   ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2002-01-31  1:27 Kris Urquhart
2002-01-31  4:45 ` Andreas Dilger
2002-01-31  5:05 ` Alexander Viro
2002-01-31 17:28 Kris Urquhart
2002-01-31 21:57 ` Alexander Viro
2002-01-31 17:31 Kris Urquhart
2002-01-31 23:46 Kris Urquhart
2002-02-01  1:00 Ishan O. Jayawardena

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox