public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ishan O. Jayawardena" <ioshadi@sltnet.lk>
To: linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: ext2/mount - multiple mounts corrupts inodes
Date: Thu, 31 Jan 2002 20:00:21 -0500	[thread overview]
Message-ID: <3C59E8A5.6878F0FD@sltnet.lk> (raw)

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.
.

             reply	other threads:[~2002-01-31 13:55 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C59E8A5.6878F0FD@sltnet.lk \
    --to=ioshadi@sltnet.lk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox