From: Dirk Eibach <eibach@gdsys.de>
To: linux-mtd@lists.infradead.org
Cc: dwmw2@infradead.org
Subject: jffs2: filesystem corruption caused by writing and powercycle
Date: Mon, 17 Mar 2008 10:42:51 +0100 [thread overview]
Message-ID: <47DE3D1B.7050007@gdsys.de> (raw)
Hello,
I have a problem with jffs2 filesystem corruption.
My environment is kernel 2.6.23.4, running on PPC.
Flash is Spansion 29GL512 NOR-Flash.
The problem can be reproduced simply by turning off power while writing.
After 3 or 4 powercycles I get errormessages when trying to copy the file I wrote before turning off power:
/ # cp /data/tst /data/tst2
Data CRC ee9173b1 != calculated CRC 6af6806d for node at 0221f108
cp: read error: Input/output error
/ #
This is my code to reproduce the problem:
#include <cstdlib>
#include <iostream>
#include <fcntl.h>
#include <errno.h>
#define MAXDATASIZE 10000.0
#define MINDATASIZE 10.0
int doStressTest (std::string filename)
{
std::string data;
int dataSize;
int fd;
fd = open(filename.c_str(), O_CREAT | O_RDWR);
if ( fd == -1 ) {
std::cerr << "Open file failed." << std::endl;
return 1;
}
data = std::string("");
// Create random data
for ( int i=0; i < MAXDATASIZE; i++ )
data.push_back(1+rand()%255);
for(;;) {
dataSize = (int)(MINDATASIZE+(MAXDATASIZE-MINDATASIZE+1)*rand()/RAND_MAX);
std::cout << "Write " << dataSize << " bytes..." << std::endl;
if ( write(fd, data.data(), dataSize) != dataSize ) {
std::cerr << "Write data failed: " << strerror(errno) << std::endl;
return 1;
}
}
close(fd);
return 0;
}
int main (int argc, char **argv)
{
if ( argc < 2 ) {
std::cerr << "usage: stresstest <FILENAME>" << std::endl;
exit(EXIT_FAILURE);
}
std::cout << "Stresstest running..." << std::endl;
return doStressTest (std::string(argv[1]));
}
Cheers
--
Dirk Eibach
Entwicklung
Guntermann & Drunck GmbH Systementwicklung
Telefon: +49 2739 8901-100
Fax: +49 2739 8901-120
EMail: mailto:eibach@gdsys.de
-------------------------------------------------------------------------------
Guntermann & Drunck GmbH Systementwicklung
Dortmunder Str. 4a
D-57234 Wilnsdorf - Germany
Tel: +49 (0) 27 39 / 89 01 - 100 Fax: +49 (0) 27 39 / 89 01 - 120
E-Mail: mailto:sales@gdsys.de Web: www.gdsys.de
-------------------------------------------------------------------------------
Geschäftsführer: Udo Guntermann - Martin Drunck - Reiner Ruelmann - Klaus Tocke
HRB 2884, Amtsgericht Siegen
USt.-Id.-Nr. DE 126575222 - Steuer-Nr. 342 / 5835 / 1041
-------------------------------------------------------------------------------
reply other threads:[~2008-03-17 9:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=47DE3D1B.7050007@gdsys.de \
--to=eibach@gdsys.de \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.