* [PATCH 1/4] integck.c: Only verify the operation after all datastructures have been updated
2013-03-01 18:37 [PATCH 0/4] mtd-utils: integck improvements Elie De Brauwer
@ 2013-03-01 18:37 ` Elie De Brauwer
2013-03-01 18:37 ` [PATCH 2/4] integck.c: rework file_check_data to immediately dump the buffer containing the errors Elie De Brauwer
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Elie De Brauwer @ 2013-03-01 18:37 UTC (permalink / raw)
To: linux-mtd; +Cc: eliedebrauwer
Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>
---
tests/fs-tests/integrity/integck.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 087a18b..2c6ffea 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -960,9 +960,6 @@ static void file_write_info(struct file_info *file, int fd, off_t offset,
w->random_seed = seed;
file->raw_writes = w;
- if (args.verify_ops && !args.power_cut_mode)
- file_check_data(file, fd, new_write);
-
/* Insert it into file->writes */
inserted = 0;
end = offset + size;
@@ -1028,6 +1025,9 @@ static void file_write_info(struct file_info *file, int fd, off_t offset,
/* Update file length */
if (end > file->length)
file->length = end;
+
+ if (args.verify_ops && !args.power_cut_mode)
+ file_check_data(file, fd, new_write);
}
/* Randomly select offset and and size to write in a file */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/4] integck.c: rework file_check_data to immediately dump the buffer containing the errors
2013-03-01 18:37 [PATCH 0/4] mtd-utils: integck improvements Elie De Brauwer
2013-03-01 18:37 ` [PATCH 1/4] integck.c: Only verify the operation after all datastructures have been updated Elie De Brauwer
@ 2013-03-01 18:37 ` Elie De Brauwer
2013-03-01 18:37 ` [PATCH 3/4] integck.c: Fix buffer overflow in save_file, avoid possible failure to write buffers when the filename length is equal to max_name_len Elie De Brauwer
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Elie De Brauwer @ 2013-03-01 18:37 UTC (permalink / raw)
To: linux-mtd; +Cc: eliedebrauwer
Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>
---
tests/fs-tests/integrity/integck.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 2c6ffea..5ea3642 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -1502,7 +1502,8 @@ static void file_check_data(struct file_info *file, int fd,
{
size_t remains, block, i;
off_t r;
- char buf[IO_BUFFER_SIZE];
+ unsigned char read_buf[IO_BUFFER_SIZE];
+ unsigned char check_buf[IO_BUFFER_SIZE];
unsigned int seed = w->random_seed;
if (args.power_cut_mode && !file->clean)
@@ -1517,17 +1518,28 @@ static void file_check_data(struct file_info *file, int fd,
block = IO_BUFFER_SIZE;
else
block = remains;
- CHECK(read(fd, buf, block) == block);
- for (i = 0; i < block; ++i) {
- char c = (char)rand_r(&seed);
- if (buf[i] != c) {
- errmsg("file_check_data failed at %zu checking "
- "data at %llu size %zu", w->size - remains + i,
- (unsigned long long)w->offset, w->size);
- file_info_display(file);
- save_file(fd, file);
- }
- CHECK(buf[i] == c);
+ CHECK(read(fd, read_buf, block) == block);
+ for (i = 0; i < block; ++i)
+ check_buf[i] = (char)rand_r(&seed);
+
+ if (memcmp(check_buf, read_buf, block) != 0) {
+ errmsg("file_check_data failed, dumping "
+ "data at offset %llu size %zu",
+ (unsigned long long)w->offset, w->size);
+
+ fprintf (stderr, "Read data:\n");
+ for (r = 0; r < block; ++r)
+ fprintf(stderr, "%02x%c",
+ read_buf[r], ((r+1)%16)?' ':'\n');
+ fprintf(stderr, "\nExpected data:\n");
+ for (r = 0; r < block; ++r)
+ fprintf(stderr, "%02x%c",
+ check_buf[r], ((r+1)%16)?' ':'\n');
+ fprintf(stderr, " \n");
+
+ file_info_display(file);
+ save_file(fd, file);
+ CHECK(0);
}
remains -= block;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/4] integck.c: Fix buffer overflow in save_file, avoid possible failure to write buffers when the filename length is equal to max_name_len
2013-03-01 18:37 [PATCH 0/4] mtd-utils: integck improvements Elie De Brauwer
2013-03-01 18:37 ` [PATCH 1/4] integck.c: Only verify the operation after all datastructures have been updated Elie De Brauwer
2013-03-01 18:37 ` [PATCH 2/4] integck.c: rework file_check_data to immediately dump the buffer containing the errors Elie De Brauwer
@ 2013-03-01 18:37 ` Elie De Brauwer
2013-03-01 18:37 ` [PATCH 4/4] Typo fixes: avaiable -> available and priortiry -> priority Elie De Brauwer
2013-03-11 8:49 ` [PATCH 0/4] mtd-utils: integck improvements Artem Bityutskiy
4 siblings, 0 replies; 6+ messages in thread
From: Elie De Brauwer @ 2013-03-01 18:37 UTC (permalink / raw)
To: linux-mtd; +Cc: eliedebrauwer
Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>
---
tests/fs-tests/integrity/integck.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 5ea3642..ee37a0d 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -32,11 +32,11 @@
#include <assert.h>
#include <mntent.h>
#include <execinfo.h>
+#include <bits/stdio_lim.h>
#include <sys/mman.h>
#include <sys/vfs.h>
#include <sys/mount.h>
#include <sys/statvfs.h>
-#include <linux/fs.h>
#define PROGRAM_VERSION "1.1"
#define PROGRAM_NAME "integck"
@@ -1433,12 +1433,17 @@ static void save_file(int fd, struct file_info *file)
int w_fd;
struct write_info *w;
char buf[IO_BUFFER_SIZE];
- char name[256];
+ char name[FILENAME_MAX];
+ const char * read_suffix = ".integ.sav.read";
+ const char * write_suffix = ".integ.sav.written";
+ size_t fname_len = strlen(get_file_name(file));
/* Open file to save contents to */
strcpy(name, "/tmp/");
- strcat(name, get_file_name(file));
- strcat(name, ".integ.sav.read");
+ if (fname_len + strlen(read_suffix) > fsinfo.max_name_len)
+ fname_len = fsinfo.max_name_len - strlen(read_suffix);
+ strncat(name, get_file_name(file), fname_len);
+ strcat(name, read_suffix);
normsg("Saving %sn", name);
w_fd = open(name, O_CREAT | O_WRONLY, 0777);
CHECK(w_fd != -1);
@@ -1457,8 +1462,10 @@ static void save_file(int fd, struct file_info *file)
/* Open file to save contents to */
strcpy(name, "/tmp/");
- strcat(name, get_file_name(file));
- strcat(name, ".integ.sav.written");
+ if (fname_len + strlen(write_suffix) > fsinfo.max_name_len)
+ fname_len = fsinfo.max_name_len - strlen(write_suffix);
+ strncat(name, get_file_name(file), fname_len);
+ strcat(name, write_suffix);
normsg("Saving %s", name);
w_fd = open(name, O_CREAT | O_WRONLY, 0777);
CHECK(w_fd != -1);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 4/4] Typo fixes: avaiable -> available and priortiry -> priority
2013-03-01 18:37 [PATCH 0/4] mtd-utils: integck improvements Elie De Brauwer
` (2 preceding siblings ...)
2013-03-01 18:37 ` [PATCH 3/4] integck.c: Fix buffer overflow in save_file, avoid possible failure to write buffers when the filename length is equal to max_name_len Elie De Brauwer
@ 2013-03-01 18:37 ` Elie De Brauwer
2013-03-11 8:49 ` [PATCH 0/4] mtd-utils: integck improvements Artem Bityutskiy
4 siblings, 0 replies; 6+ messages in thread
From: Elie De Brauwer @ 2013-03-01 18:37 UTC (permalink / raw)
To: linux-mtd; +Cc: eliedebrauwer
Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>
---
mkfs.jffs2.1 | 10 +++++-----
mkfs.jffs2.c | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/mkfs.jffs2.1 b/mkfs.jffs2.1
index 47a3ac7..7c57ddc 100644
--- a/mkfs.jffs2.1
+++ b/mkfs.jffs2.1
@@ -105,7 +105,7 @@ or the present directory, if the
option is not specified.
Each block of the files to be placed into the file system image
-are compressed using one of the avaiable compressors depending
+are compressed using one of the available compressors depending
on the selected compression mode.
File systems are created with the same endianness as the host,
@@ -209,21 +209,21 @@ successful one. The alternatives are:
.B -x, --disable-compressor=NAME
Disable a compressor. Use
.B -L
-to see the list of the avaiable compressors and their default states.
+to see the list of the available compressors and their default states.
.TP
.B -X, --enable-compressor=NAME
Enable a compressor. Use
.B -L
-to see the list of the avaiable compressors and their default states.
+to see the list of the available compressors and their default states.
.TP
.B -y, --compressor-priority=PRIORITY:NAME
Set the priority of a compressor. Use
.B -L
-to see the list of the avaiable compressors and their default priority.
+to see the list of the available compressors and their default priority.
Priorities are used by priority compression mode.
.TP
.B -L, --list-compressors
-Show the list of the avaiable compressors and their states.
+Show the list of the available compressors and their states.
.TP
.B -t, --test-compression
Call decompress after every compress - and compare the result with the original data -, and
diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index a33a0d6..7ade078 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -1396,14 +1396,14 @@ static const char helptext[] =
" page size (default: 4KiB)\n"
" -e, --eraseblock=SIZE Use erase block size SIZE (default: 64KiB)\n"
" -c, --cleanmarker=SIZE Size of cleanmarker (default 12)\n"
-" -m, --compr-mode=MODE Select compression mode (default: priortiry)\n"
+" -m, --compr-mode=MODE Select compression mode (default: priority)\n"
" -x, --disable-compressor=COMPRESSOR_NAME\n"
" Disable a compressor\n"
" -X, --enable-compressor=COMPRESSOR_NAME\n"
" Enable a compressor\n"
" -y, --compressor-priority=PRIORITY:COMPRESSOR_NAME\n"
" Set the priority of a compressor\n"
-" -L, --list-compressors Show the list of the avaiable compressors\n"
+" -L, --list-compressors Show the list of the available compressors\n"
" -t, --test-compression Call decompress and compare with the original (for test)\n"
" -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n"
" -o, --output=FILE Output to FILE (default: stdout)\n"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 0/4] mtd-utils: integck improvements
2013-03-01 18:37 [PATCH 0/4] mtd-utils: integck improvements Elie De Brauwer
` (3 preceding siblings ...)
2013-03-01 18:37 ` [PATCH 4/4] Typo fixes: avaiable -> available and priortiry -> priority Elie De Brauwer
@ 2013-03-11 8:49 ` Artem Bityutskiy
4 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2013-03-11 8:49 UTC (permalink / raw)
To: Elie De Brauwer; +Cc: linux-mtd
On Fri, 2013-03-01 at 19:37 +0100, Elie De Brauwer wrote:
> Hello all,
>
> The past couple of days I've been doing some NAND stress testing on an
> i.MX28 platform. So far my observation is that at a certain point
> integck writes a buffer, then tries to verify this data, concludes the
> buffer is not what it was written and fails. However the file it saves
> (and the contents on flash) appear to be the correct data, hence the
> standard integck wasn't very useful in assisting troubleshooting this
> issue (which only appears once every couple of hours).
Hi, first of all - thanks for the hard work and the fixes. This test was
use on early days when we were developing UBIFS, and was extremely
useful for us. But we mostly used it with nandsim.
When UBIFS became stable, I add ed the "power cut emulation" support
there, and this is probably when I broke the report printing
functionality.
The test is not very cleanly written, and it is a bit of spaghetti,
which did not scare you off, and for which you get my kudos :-)
I've applied and pushed all your patches. I only briefly looked at them,
they looked OK. And I only compile-tested them. I just have not time
right now for more thorough review, and I forgot how integck works, and
your patches looked very trustworthy, so I just pushed them out.
I added your description to the commit messages. This e-mail will be
lost in the archives, but the commit messages will stay in the git
history and may be useful. Keep this in mind - put useful descriptive
comment so that they stay in the commit message, do not put all of them
to the cover letter.
I also amended few broken indentations - we indent using tabs, as a
convention. We do use spaces to fine-tune the indentation in tricky
places, but the basic style is using tabs.
Thanks!
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 6+ messages in thread