void n_create_delete(int nfiles) { char *base="/mnt/lustre/f3_"; char path[100]; char str[100]; int i; replay_barrier(); for (i = 0; i < nfiles; i++) { sprintf(path, "%s%d\n", base, i); sprintf(str, "TEST#%d CONTENT\n", i); t_echo_create(path, str); } mds_failover(); for (i = 0; i < nfiles; i++) { sprintf(path, "%s%d\n", base, i); sprintf(str, "TEST#%d CONTENT\n", i); t_grep(path, str); } replay_barrier(); for (i = 0; i < nfiles; i++) { sprintf(path, "%s%d\n", base, i); t_unlink(path); } mds_failover(); for (i = 0; i < nfiles; i++) { sprintf(path, "%s%d\n", base, i); t_check_stat_fail(path); } LEAVE(); }
void t4() { char *path = "/mnt/lustre/rp_ost_t4_file"; char namebuf[1024]; char str[1024]; int count = 10, i; ENTRY("|X| 10 open(CREAT)s (ping involved)"); printf("create %d files\n", count); for (i = 0; i < count; i++) { sprintf(namebuf, "%s%02d", path, i); sprintf(str, "%s-%08d-%08x-AAAAA", "content", i, i); t_echo_create(namebuf, str); } replay_barrier(); mds_failover(); printf("read & verify\n"); for (i = 0; i < count; i++) { sprintf(namebuf, "%s%02d", path, i); sprintf(str, "%s-%08d-%08x-AAAAA", "content", i, i); t_grep(namebuf, str); t_unlink(namebuf); } }
void t0() { char *path="/mnt/lustre/f0"; ENTRY("empty replay"); replay_barrier(); mds_failover(); t_check_stat_fail(path); LEAVE(); }
void t2a() { char *path="/mnt/lustre/f2a"; ENTRY("touch"); replay_barrier(); t_touch(path); mds_failover(); t_check_stat(path, NULL); t_unlink(path); LEAVE(); }
void t1() { char *path="/mnt/lustre/f1"; ENTRY("simple create"); replay_barrier(); t_create(path); mds_failover(); t_check_stat(path, NULL); t_unlink(path); LEAVE(); }
void t2() { char *path = "/mnt/lustre/rp_ost_t2_file"; char *str = "xxxxjoiwlsdf98lsjdfsjfoajflsjfajfoaidfojaj08eorje;"; ENTRY("empty replay"); replay_barrier(); mds_failover(); t_echo_create(path, str); t_grep(path, str); t_unlink(path); }
void t4() { char *dir="/mnt/lustre/d4"; char *path="/mnt/lustre/d4/f1"; ENTRY("mkdir + contained create"); replay_barrier(); t_mkdir(dir); t_create(path); mds_failover(); t_check_stat(dir, NULL); t_check_stat(path, NULL); sleep(2); /* wait for log process thread */ replay_barrier(); t_unlink(path); t_rmdir(dir); mds_failover(); t_check_stat_fail(dir); t_check_stat_fail(path); LEAVE(); }
void t7() { char *path="/mnt/lustre/f7"; char *path2="/mnt/lustre/f7-2"; ENTRY("create |X| rename unlink"); t_create(path); replay_barrier(); t_rename(path, path2); mds_failover(); t_check_stat_fail(path); t_check_stat(path2, NULL); t_unlink(path2); }
void t10() { char *path="/mnt/lustre/f10"; char *path2="/mnt/lustre/f10-2"; ENTRY("|X| mcreate, open write, rename"); replay_barrier(); t_create(path); t_echo_create(path, "old"); t_rename(path, path2); t_grep(path2, "old"); mds_failover(); t_grep(path2, "old"); t_unlink(path2); }
void t9() { char *path="/mnt/lustre/f9"; char *path2="/mnt/lustre/f9-2"; ENTRY("|X| open(O_CREAT), unlink, touch new, unlink new"); replay_barrier(); t_create(path); t_unlink(path); t_create(path2); mds_failover(); t_check_stat_fail(path); t_check_stat(path2, NULL); t_unlink(path2); }
void t6() { char *path="/mnt/lustre/f6"; int fd; ENTRY("open |X| close"); replay_barrier(); t_create(path); fd = t_open(path); sleep(1); mds_failover(); t_check_stat(path, NULL); t_close(fd); t_unlink(path); LEAVE(); }
void t5() { char *dir="/mnt/lustre/d5"; char *path="/mnt/lustre/d5/f1"; ENTRY("mkdir |X| contained create"); t_mkdir(dir); replay_barrier(); t_create(path); mds_failover(); t_check_stat(dir, NULL); t_check_stat(path, NULL); t_unlink(path); t_rmdir(dir); LEAVE(); }
void t1() { const int bufsize = 4096; char *path = "/mnt/lustre/rp_ost_t1_file"; char buf[bufsize]; int fd, i, j; ENTRY("open-write-close-open-failover-read (no ping involved)"); printf("create/open file...\n"); t_touch(path); fd = t_open(path); printf("write file...\n"); for (i = 0; i < 20; i++) { memset(buf, i, bufsize); if (write(fd, buf, bufsize) != bufsize) { perror("write error"); exit(-1); } } printf("close/reopen...\n"); t_close(fd); fd = t_open(path); lseek(fd, 0, SEEK_SET); printf("OST failover...\n"); replay_barrier(); mds_failover(); printf("read & verify...\n"); for (i = 0; i < 20; i++) { memset(buf, -1, bufsize); if (read(fd, buf, bufsize) != bufsize) { perror("read error after failover"); exit(-1); } for (j = 0; j < bufsize; j++) { if (buf[j] != i) { printf("verify error after failover\n"); exit(-1); } } } t_close(fd); t_unlink(path); LEAVE(); }
void t3() { char *path = "/mnt/lustre/rp_ost_t3_file"; char *str = "xxxxjoiwlsdf98lsjdfsjfoajflsjfajfoaidfojaj08eorje;"; ENTRY("touch"); printf("touch to create a file\n"); t_echo_create(path, str); replay_barrier(); mds_failover(); printf("read & verify\n"); t_grep(path, str); t_unlink(path); /* XXX have problem without this, seems server side problem XXX */ sleep(5); }
void t0() { const int bufsize = 4096; char *path = "/mnt/lustre/rp_ost_t0_file"; char buf[bufsize]; int fd, i, j, rc; ENTRY("open-failover-write-verification (no ping involved)"); printf("create/open file...\n"); t_touch(path); fd = t_open(path); printf("OST failover...\n"); replay_barrier(); mds_failover(); printf("write file...\n"); for (i = 0; i < 20; i++) { memset(buf, i, bufsize); if ((rc = write(fd, buf, bufsize)) != bufsize) { perror("write error after failover"); printf("i = %d, rc = %d\n", i, rc); exit(-1); } } /* verify */ printf("read & verify...\n"); lseek(fd, 0, SEEK_SET); for (i = 0; i < 20; i++) { memset(buf, -1, bufsize); if ((rc = read(fd, buf, bufsize)) != bufsize) { perror("read error rc"); printf("i = %d, rc = %d\n", i, rc); exit(-1); } for (j = 0; j < bufsize; j++) { if (buf[j] != i) { printf("verify error!\n"); exit(-1); } } } t_close(fd); t_unlink(path); LEAVE(); }
void t8() { char *path="/mnt/lustre/f8"; char *path2="/mnt/lustre/f8-2"; ENTRY("create open write rename |X| create-old-name read"); t_create(path); t_echo_create(path, "old"); t_rename(path, path2); replay_barrier(); t_echo_create(path, "new"); mds_failover(); t_grep(path, "new"); t_grep(path2, "old"); t_unlink(path); t_unlink(path2); }