this patch covers Lustre tests
Lustre-change: https://review.whamcloud.com/34661
Lustre-commit:
6733fbff9a682bcec5fdca6f7062c24f0fe27cfe
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I6345d603772fb32bbc4b38a758a3e97f0361d116
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/35005
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
char *good_buf; /* a pointer to the correct data */
char *temp_buf; /* a pointer to the current data */
char *fname; /* name of our test file */
char *good_buf; /* a pointer to the correct data */
char *temp_buf; /* a pointer to the current data */
char *fname; /* name of our test file */
-char logfile[1024]; /* name of our log file */
-char goodfile[1024]; /* name of our test file */
+char logfile[PATH_MAX]; /* name of our log file */
+char goodfile[PATH_MAX]; /* name of our test file */
off_t file_size = 0;
off_t biggest = 0;
off_t file_size = 0;
off_t biggest = 0;
randomoplen = 0;
break;
case 'P':
randomoplen = 0;
break;
case 'P':
- strncpy(goodfile, optarg, sizeof(goodfile));
+ strncpy(goodfile, optarg, sizeof(goodfile) - 1);
- strncpy(logfile, optarg, sizeof(logfile));
+ strncpy(logfile, optarg, sizeof(logfile) - 1);
strcat(logfile, "/");
dirpath = 1;
break;
strcat(logfile, "/");
dirpath = 1;
break;
/* Create subdirectories as long as we can. Each new subdir is
* "/x", so we need at least 3 characters left in testpath. */
while (len <= sizeof(testpath) - 3) {
/* Create subdirectories as long as we can. Each new subdir is
* "/x", so we need at least 3 characters left in testpath. */
while (len <= sizeof(testpath) - 3) {
- strncat(testpath, "/x", 2);
+ strncat(testpath, "/x", sizeof(testpath) - 1);
bool seen;
} links[num_links];
char buf[PATH_MAX];
bool seen;
} links[num_links];
char buf[PATH_MAX];
+ char buf2[PATH_MAX * 2];
struct lu_fid fid;
char fidstr[FID_LEN + 1];
int rc;
struct lu_fid fid;
char fidstr[FID_LEN + 1];
int rc;
uint64_t size;
const char *lfs = getenv("LFS");
char mypool[LOV_MAXPOOLNAME + 1] = { '\0' };
uint64_t size;
const char *lfs = getenv("LFS");
char mypool[LOV_MAXPOOLNAME + 1] = { '\0' };
+ char cmd[PATH_MAX + 128];
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s", lustre_dir, T4FILE);
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s", lustre_dir, T4FILE);
uint64_t size;
uint64_t pattern;
char dir[PATH_MAX];
uint64_t size;
uint64_t pattern;
char dir[PATH_MAX];
+ char cmd[PATH_MAX + 64];
snprintf(dir, sizeof(dir), "%s/%s", lustre_dir, T26DIR);
rc = rmdir(dir);
snprintf(dir, sizeof(dir), "%s/%s", lustre_dir, T26DIR);
rc = rmdir(dir);
uint64_t count;
uint64_t size;
uint64_t pattern;
uint64_t count;
uint64_t size;
uint64_t pattern;
- char dirpath[PATH_MAX];
- char filepath[PATH_MAX];
- char cmd[4096];
+ char dirpath[PATH_MAX + 128];
+ char filepath[PATH_MAX * 2];
+ char cmd[PATH_MAX * 2];
- snprintf(dirpath, sizeof(dirpath), "%s/%s", lustre_dir, T27DIR);
+ snprintf(dirpath, sizeof(dirpath) - 1, "%s/%s", lustre_dir, T27DIR);
snprintf(filepath, sizeof(filepath), "%s/nonesuch", dirpath);
rc = rmdir(dirpath);
snprintf(filepath, sizeof(filepath), "%s/nonesuch", dirpath);
rc = rmdir(dirpath);
const char *lfs = getenv("LFS");
uint64_t count;
char dirpath[PATH_MAX];
const char *lfs = getenv("LFS");
uint64_t count;
char dirpath[PATH_MAX];
+ char cmd[PATH_MAX + 64];
snprintf(dirpath, sizeof(dirpath), "%s/%s", lustre_dir, T28DIR);
snprintf(dirpath, sizeof(dirpath), "%s/%s", lustre_dir, T28DIR);
void rw_file(char *name, long stride, unsigned int seed)
{
void rw_file(char *name, long stride, unsigned int seed)
{
- char filename[MAX_FILENAME_LEN];
- char errmsg[MAX_FILENAME_LEN+20];
- char *buf, *o_buf;
- struct lov_user_md lum = {0};
- int fd, rc, i, bad = 0, root = 0;
- long off;
- long page_size = sysconf(_SC_PAGESIZE);
+ char filename[MAX_FILENAME_LEN];
+ char errmsg[MAX_FILENAME_LEN+32];
+ char *buf, *o_buf;
+ struct lov_user_md lum = {0};
+ int fd, rc, i, bad = 0, root = 0;
+ long off;
+ long page_size = sysconf(_SC_PAGESIZE);
sprintf(filename, "%s/%s", testdir, name);
sprintf(filename, "%s/%s", testdir, name);
int ndirs = 1;
char * dirfmt;
char dir[PATH_MAX];
int ndirs = 1;
char * dirfmt;
char dir[PATH_MAX];
-char mkdir_cmd[PATH_MAX+14];
+char mkdir_cmd[PATH_MAX+32];
int dirthreads;
int dirnum;
DIR * directory;
int dirthreads;
int dirnum;
DIR * directory;
char *lgbuf;
int lgbuf_size;
char filename[MAX_FILENAME_LEN];
char *lgbuf;
int lgbuf_size;
char filename[MAX_FILENAME_LEN];
-char errmsg[MAX_FILENAME_LEN+20];
+char errmsg[MAX_FILENAME_LEN+96];
static void
alloc_lgbuf()
static void
alloc_lgbuf()
fname = basename(path1);
dname = basename(dirname(path2));
/* dirname looping depends on the depth of the file from mount path */
fname = basename(path1);
dname = basename(dirname(path2));
/* dirname looping depends on the depth of the file from mount path */
- strncpy(mnt_path, dirname(dirname(path3)), sizeof(mnt_path));
+ strncpy(mnt_path, dirname(dirname(path3)), sizeof(mnt_path) - 1);
file_no = atoi(argv[2]);
if (!file_no) {
file_no = atoi(argv[2]);
if (!file_no) {
while ((c = getopt (argc, argv, "f:m:")) != -1) {
switch (c) {
case 'f': {
while ((c = getopt (argc, argv, "f:m:")) != -1) {
switch (c) {
case 'f': {
- cloned_flags = (char *)malloc(strlen(optarg)+1);
- if (cloned_flags == NULL) {
- fprintf(stderr, "Insufficient memory.\n");
- save_errno = -1;
- goto out;
- }
+ cloned_flags = strdup(optarg);
+ if (cloned_flags == NULL) {
+ fprintf(stderr, "Insufficient memory.\n");
+ save_errno = -1;
+ goto out;
+ }
- strncpy(cloned_flags, optarg, strlen(optarg)+1);
flags = atoi(cloned_flags);
if (flags > 0) {
flag_set = 1;
flags = atoi(cloned_flags);
if (flags > 0) {
flag_set = 1;
lmu->lum_hash_type = LMV_HASH_TYPE_FNV_1A_64;
if (lsa.lsa_pool_name)
strncpy(lmu->lum_pool_name, lsa.lsa_pool_name,
lmu->lum_hash_type = LMV_HASH_TYPE_FNV_1A_64;
if (lsa.lsa_pool_name)
strncpy(lmu->lum_pool_name, lsa.lsa_pool_name,
- sizeof(lmu->lum_pool_name));
+ sizeof(lmu->lum_pool_name) - 1);
if (lsa.lsa_nr_tgts > 1) {
int i;
if (lsa.lsa_nr_tgts > 1) {
int i;
lsb->sb_count = 0;
/* use mntdir for dirname() temporarily */
lsb->sb_count = 0;
/* use mntdir for dirname() temporarily */
- strncpy(mntdir, dname, sizeof(mntdir));
+ strncpy(mntdir, dname, sizeof(mntdir) - 1);
if (!realpath(dirname(mntdir), path)) {
result = -errno;
fprintf(stderr,
if (!realpath(dirname(mntdir), path)) {
result = -errno;
fprintf(stderr,