mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David J. Picard" <dave@psind.com>
To: Aaron Sethman <androsyn@ratbox.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PATCH for Corrupted IO on all block devices
Date: Tue, 17 Jul 2001 22:14:50 -0400	[thread overview]
Message-ID: <3B54F11A.DD2767E8@psind.com> (raw)
In-Reply-To: <Pine.LNX.4.33L2.0107172237030.6255-100000@squeaker.ratbox.org>

The issue was in a stack overflow in the test program, as Alexander
pointed out. Is the stack order different on Solaris et.al v. Linux?
Could this be why it worked so well on the other OS's? The correct
version of the program is as follows:

#include <stdio.h>
#include <assert.h>

#define TEST_SZ 25000000
#define RD_BUFF_SZ 5000
int main(int argc, const char **argv, const char **env)
{
    FILE* fp;

    if(argc > 1) fp = fopen(argv[1], "r+");
    else fp =tmpfile();
    if(NULL != fp) {
        int j = -1;
	off_t o;
        while(1) {
            if(++j != TEST_SZ) {
	        if (j == (TEST_SZ - RD_BUFF_SZ) ) o = ftello(fp);
                fwrite(&j, sizeof(int), 1, fp);
            } else {
                int i, buffer[RD_BUFF_SZ];
		fflush(fp);
                fseek(fp, o, SEEK_SET);
                fread(buffer, sizeof(int), RD_BUFF_SZ, fp);
                printf("Validating end of file writes (%d %d)\n",
sizeof(int),
		       RD_BUFF_SZ);
                for(i = (RD_BUFF_SZ - 1); i >= 0; i--) {
                    assert(buffer[i] == --j) ;
                }
                rewind(fp);
		j = -1;
            }
        }
        return 1;
    }
    return 0;
}


Aaron Sethman wrote:
> 
> I'd just like to add that the test program bombs on a reiserfs filesystem
> as well.  So if their is some sort of issue, its not just related to ext2.
> 
> Regards,
> 
> Aaron
> 
> On Tue, 17 Jul 2001, Linus Torvalds wrote:
> 
> >
> > On Tue, 17 Jul 2001, David J. Picard wrote:
> > >
> > > Basically, what is happening is the read requests are being pushed to
> > > the front of the IO queue - before the preceding write for the same
> > > sector.
> >
> > This is a bug in the USER, not in the code.
> >
> > The locking is NOT supposed to be done at the elevator level (or, indeed
> > at ANY _io_ level), but must be done by upper layers.
> >
> > If upper layers do not do this locking, then THAT is the bug.
> >
> > What filesystem do you see the bug with?
> >
> >               Linus
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> >
> >

-- 
David J. Picard
  dave@psind.com

If you can keep your head when all about you are losing theirs,
  then you clearly don't understand the situation.

  reply	other threads:[~2001-07-18  2:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-18  1:37 David J. Picard
2001-07-18  1:43 ` Linus Torvalds
2001-07-18  2:37   ` Aaron Sethman
2001-07-18  2:14     ` David J. Picard [this message]
2001-07-18  2:51       ` Alexander Viro
2001-07-18  3:03       ` David S. Miller
2001-07-18  2:41     ` Aaron Sethman
2001-07-18  2:05 ` David S. Miller
2001-07-18  2:08   ` Linus Torvalds
2001-07-18  2:35   ` Andrea Arcangeli
2001-07-18  2:16 ` Alexander Viro

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=3B54F11A.DD2767E8@psind.com \
    --to=dave@psind.com \
    --cc=androsyn@ratbox.org \
    --cc=dpicard@rcn.com \
    --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

all inboxes | Powered by JetHome®