-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZTS: dnode stress test #15608
ZTS: dnode stress test #15608
Conversation
22282e3
to
95c2fc7
Compare
The test seems to be failing on FreeBSD due to cp not supporting --reflink or other GNU-style options. Some people have been able to reproduce this with standard FreeBSD cp, though more rarely, so I'd suggest using cp without the extra options when run on FreeBSD. |
If you're going to use Might want to explicitly set I do wonder if a better way to do this would be with a couple of helper programs: one that creates a file and lobs N random bytes into it, and another that just does |
@robn I tried writing a little C program (below) but was unable to reproduce the error. Run the C program inside your pool. Warning: creates lots of test files in your directory. #include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
char *bigbuf;
int *file;
int main (int argc, char **argv)
{
char filename[255];
off_t hole_offset;
int i;
int count;
int bigbuf_count;
if (argc != 3) {
printf("usage ./main file_count file_size_in_bytes\n");
exit(1);
};
count = atoi(argv[1]);
bigbuf_count = atoi(argv[2]);
pid_t mypid = getpid();
file = calloc(count, sizeof(int));
bigbuf = malloc(bigbuf_count);
/* Make the initial file */
file[0] = open("/dev/urandom", O_RDONLY);
read(file[0], bigbuf, bigbuf_count);
close(file[0]);
sprintf(filename,"reproducer_%d_%d", mypid, 0);
file[0] = open(filename, O_RDWR | O_CREAT, 0666);
write(file[0], bigbuf, bigbuf_count);
close(file[0]);
for (i = 0; i < count; i++) {
sprintf(filename,"reproducer_%d_%d", mypid, i);
file[i] = open(filename, O_RDONLY, 0666);
/* Check SEEK_DATA on new file */
hole_offset = 0;
hole_offset = lseek(file[i], hole_offset, SEEK_DATA);
if (hole_offset != 0) {
printf("offset1 wrong %lu (expected %d) on %s\n", hole_offset, 0, filename);
exit(1);
}
/* Make a copy */
sprintf(filename,"reproducer_%d_%d", mypid, i + 1);
file[i+1] = open(filename, O_RDWR | O_CREAT, 0666);
read(file[i], bigbuf, bigbuf_count);
write(file[i+1], bigbuf, bigbuf_count);
/* Check SEEK_HOLE on new file */
hole_offset = 0;
hole_offset = lseek(file[i+1], hole_offset, SEEK_HOLE);
if (hole_offset != bigbuf_count) {
printf("offset2 wrong %lu (expected %d) on %s\n", hole_offset, bigbuf_count, filename);
exit(1);
}
close(file[i]);
close(file[i+1]);
}
free(file);
free(bigbuf);
return 0;
}
|
95c2fc7
to
35d37d3
Compare
@tonyhutter Try this: https://gist.github.com/robn/58dd57196dc7123c65736e10922d4d10
Typically hard for me to hit, but the hack I did in #15615 to add a sleep to force the window wider helped show it off. |
@robn thanks for |
a28bcaf
to
d49b42e
Compare
d49b42e
to
4ac56f1
Compare
This is ready for review. I removed my older code and just had the test case call @robn's seekflood.c reproducer, which works well even on the underpowered EC2 instances. This PR deliberately doesn't have the dirty dnode fix so it will reproduce the problem. As you can see, the test is correcty passing on Centos 7-8, and correctly failing on Centos 9 and Fedora 37-39. Note, do not pull this in after it's approved. I currently have the |
4ac56f1
to
e448aa8
Compare
@grahamperrin thanks I've pushed your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
e448aa8
to
90838f0
Compare
90838f0
to
eccd616
Compare
Rebased on master |
Add a test for the dirty dnode SEEK_HOLE/SEEK_DATA bug described in openzfs#15526 The bug was fixed in openzfs#15571 and was backported to 2.2.2 and 2.1.14. This test case is just to make sure it does not come back. seekflood.c originally written by Rob Norris. Signed-off-by: Tony Hutter <[email protected]>
eccd616
to
78c9850
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tonyhutter, for this and all adjacent work here. You kinda kicked this whole mess off ;)
This was rebased on master (and thus correctly passes now). I think it's ready to merge. |
Add a test for the dirty dnode SEEK_HOLE/SEEK_DATA bug described in openzfs#15526 The bug was fixed in openzfs#15571 and was backported to 2.2.2 and 2.1.14. This test case is just to make sure it does not come back. seekflood.c originally written by Rob Norris. Reviewed-by: Graham Perrin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes openzfs#15608
Add a test for the dirty dnode SEEK_HOLE/SEEK_DATA bug described in #15526 The bug was fixed in #15571 and was backported to 2.2.2 and 2.1.14. This test case is just to make sure it does not come back. seekflood.c originally written by Rob Norris. Reviewed-by: Graham Perrin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #15608
Add a test for the dirty dnode SEEK_HOLE/SEEK_DATA bug described in openzfs#15526 The bug was fixed in openzfs#15571 and was backported to 2.2.2 and 2.1.14. This test case is just to make sure it does not come back. seekflood.c originally written by Rob Norris. Reviewed-by: Graham Perrin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes openzfs#15608
Add a test for the dirty dnode SEEK_HOLE/SEEK_DATA bug described in openzfs#15526 The bug was fixed in openzfs#15571 and was backported to 2.2.2 and 2.1.14. This test case is just to make sure it does not come back. seekflood.c originally written by Rob Norris. Reviewed-by: Graham Perrin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes openzfs#15608
Motivation and Context
Add dnode stress test to test dirty dnode corruption: #15526
Description
Test dirty dnode corruption.
Marking this as WIP for now, as I don't know if the timing on the EC2 instances will trigger the bug. If it triggers the bug, then I will revert the changes to the
TEST
file before merging.How Has This Been Tested?
Ran locally on centos 9 VM
Types of changes
Checklist:
Signed-off-by
.