]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_librbd_fsx: align temporary buffers allocated in check_clone() 1766/head
authorIlya Dryomov <ilya.dryomov@inktank.com>
Wed, 7 May 2014 13:19:53 +0000 (17:19 +0400)
committerIlya Dryomov <ilya.dryomov@inktank.com>
Wed, 7 May 2014 13:30:06 +0000 (17:30 +0400)
check_clone() allocates temporary good_buf and temp_buf with malloc(),
which is not good enough for krbd with O_DIRECT.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
src/test/librbd/fsx.c

index b83bfb71dec2ac39094c2a565ff57cb436bf10ea..20106e02c1c41b29664bccc78cf1d7353a38acde 100644 (file)
@@ -1381,8 +1381,19 @@ check_clone(int clonenum)
                exit(169);
        }
 
-       good_buf = malloc(file_info.st_size);
-       temp_buf = malloc(file_info.st_size);
+       ret = posix_memalign((void **)&good_buf, MAX(writebdy, sizeof(void *)),
+                            file_info.st_size);
+       if (ret > 0) {
+               prterrcode("check_clone: posix_memalign(good_buf)", -ret);
+               exit(96);
+       }
+
+       ret = posix_memalign((void **)&temp_buf, MAX(readbdy, sizeof(void *)),
+                            file_info.st_size);
+       if (ret > 0) {
+               prterrcode("check_clone: posix_memalign(temp_buf)", -ret);
+               exit(97);
+       }
 
        if ((ret = pread(fd, good_buf, file_info.st_size, 0)) < 0) {
                simple_err("check_clone: pread", -errno);