diff --git a/src/client/dfs/obj.c b/src/client/dfs/obj.c index 4801e381334..024a230268d 100644 --- a/src/client/dfs/obj.c +++ b/src/client/dfs/obj.c @@ -854,8 +854,10 @@ ostatx_cb(tse_task_t *task, void *data) D_GOTO(out, rc = daos_errno2der(rc)); if (S_ISREG(args->obj->mode)) { - args->stbuf->st_size = op_args->array_stbuf.st_size; - args->stbuf->st_blocks = (args->stbuf->st_size + (1 << 9) - 1) >> 9; + args->stbuf->st_size = op_args->array_stbuf.st_size; + args->stbuf->st_blocks = (args->stbuf->st_size + (1 << 9) - 1) >> 9; + args->stbuf->st_blksize = op_args->entry.chunk_size ? op_args->entry.chunk_size : + args->dfs->attr.da_chunk_size; } else if (S_ISDIR(args->obj->mode)) { args->stbuf->st_size = sizeof(op_args->entry); } else if (S_ISLNK(args->obj->mode)) { diff --git a/src/tests/suite/dfs_unit_test.c b/src/tests/suite/dfs_unit_test.c index cbb827112f7..a5feb6c3ca5 100644 --- a/src/tests/suite/dfs_unit_test.c +++ b/src/tests/suite/dfs_unit_test.c @@ -1056,6 +1056,7 @@ dfs_test_rename(void **state) rc = dfs_ostatx(dfs_mt, obj2, &stbuf, NULL); assert_int_equal(rc, 0); assert_true(stbuf.st_size == 128); + assert_int_equal(stbuf.st_blksize, DFS_DEFAULT_CHUNK_SIZE); rc = dfs_chmod(dfs_mt, NULL, f1, S_IFREG | S_IRUSR | S_IWUSR); assert_int_equal(rc, 0);