public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy <genanr@emsphone.com>
To: linux-kernel@vger.kernel.org
Cc: cattelan@sgi.com, linux-xfs@oss.sgi.com, nathans@sgi.com,
	ctierney@hpti.com
Subject: XFS over NFS corruption
Date: Wed, 9 Jun 2004 11:54:42 -0500	[thread overview]
Message-ID: <20040609165442.GA9569@thumper2> (raw)

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

I thought I had seen the bug even writing to an non-XFS nfs server, but I
can't absolutely confirm this at the time (I was not doing the testing at the
time, and some of the result may not have been accurate)

But, the description of bug #198 on the XFS bugzilla, does sound like what I
am seeing.  

What I do in my tests is take a file of offsets (every group of 4 bytes
contains the offset of the 1st byte of the group) and copy that file to an
nfs mounted volume and then compare the local copy to the remote copy
(copying to several systems, each server is also receiving from several
systems).  After a while I will see errors in the compare, data appearing at
the wrong offset in the file.  The amount of data is small (<64k), always an
8k boundary at a large offset discrepancy (100's of megs).  I've attached
the mkoffsetfile.c and cmpoffsets.c programs used for testing.

Sample of cmpoffsets output :

431128576-431161343 (32768) (held data from 738426880-738459647)
 starts at a 65536-byte block
 ends at a 524288-byte block

Hope this helps.

Andy

[-- Attachment #2: mkoffsetfile.c --]
[-- Type: text/x-csrc, Size: 223 bytes --]

#include <stdio.h>
#include <netinet/in.h>

int main(void)
{
	unsigned int i;
	unsigned int o;
	FILE *out = fopen("offsets","w");
	for (i = 0;i<1536*1024*1024; i+=4)
	{
		o = htonl(i);
		fwrite(&o,1,4,out);
	}
	return 0;
}

[-- Attachment #3: cmpoffsets.c --]
[-- Type: text/x-csrc, Size: 1877 bytes --]

#if 0 /* Magic self-executing C source code.  Run "sh cmpoffsets.c"   -dnelson
set -ex
gcc -g -Wall -O2 -march=i686 $0 -o cmpoffsets
exit 0
*/
#endif


#include <stdio.h>
#include <netinet/in.h>
#include <stdlib.h>

unsigned int boundarycheck(unsigned int number);

int main(int argc, char **argv)
{
	unsigned int i;
	FILE *in;
	int tosmall = 0;
	unsigned int firstbad = -1, lastbad = -1;
	unsigned int firstbadoff = 0, lastbadoff = 0;
	int failed = 0;

	if (argc != 2)
	{
		printf("Usage: cmpoffsets file.copy\n");
		exit(1);
	}
	in = fopen(argv[1], "rb");
	if (!in)
	{
		perror("cannot open file");
		exit(1);
	}
	setvbuf(in, malloc(65536), _IOFBF, 65536);

	for (i = 0; i < 1536 * 1024 * 1024 && !tosmall; i += 4)
	{
		unsigned int o;

		if (fread(&o, 4, 1, in) != 1)
		{
			o = htonl(i);
			tosmall = 1;
		}
		o = ntohl(o);
		if (o != i)
		{
			failed = 1;
			if (lastbad != i - 4)
			{
				firstbad = i;
				firstbadoff = o;
			}
			lastbad = i;
			lastbadoff = o;
		} else
		{
			if (lastbad == i - 4)
			{
				if (firstbad == lastbad)
				{	/* range of one */
					printf("%u (4) (held data from %u)\n", firstbad, firstbadoff);
				} else
				{	/* range > 1 */
					printf("%u-%u (%u) (held data from %u-%u)\n", firstbad, lastbad + 3,
					       lastbad + 4 - firstbad,
					       firstbadoff, lastbadoff + 3);
					if (boundarycheck(firstbadoff) > 2048)
						printf(" starts at a %u-byte block\n", boundarycheck(firstbadoff));
					if (boundarycheck(lastbadoff + 4) > 2048)
						printf(" ends at a %u-byte block\n", boundarycheck(lastbadoff + 4));
				}

				firstbad = lastbad = -1;
			}
		}
	}
	if (tosmall)
	{
		printf("file is truncated\n");
		failed = 1;
	}
	return failed;
}

unsigned int boundarycheck(unsigned int number)
{
	long long block = 1;
	while (block < number)
	{
		block *= 2;
		if (number / block * block != number)
			break;
	}
	return block;
}

             reply	other threads:[~2004-06-09 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09 16:54 Andy [this message]
     [not found] ` <200406091949.47774.marat@GSTJ2W>
2004-06-09 18:20   ` XFS over NFS corruption Craig Tierney

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=20040609165442.GA9569@thumper2 \
    --to=genanr@emsphone.com \
    --cc=cattelan@sgi.com \
    --cc=ctierney@hpti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@oss.sgi.com \
    --cc=nathans@sgi.com \
    /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