mirror of https://github.com/xemu-project/xemu.git
Block patches:
- Fix for block jobs when used with I/O threads
- Fix for a corruption when using qcow2's LUKS encryption mode
- cURL fix
- check-block.sh cleanups (for make check)
- Refactoring
-----BEGIN PGP SIGNATURE-----
iQFGBAABCAAwFiEEkb62CjDbPohX0Rgp9AfbAGHVz0AFAl1/kPsSHG1yZWl0ekBy
ZWRoYXQuY29tAAoJEPQH2wBh1c9Aeg8H/RTwqlrCmKmOHECAvnHduKusGJtEcTac
DRSl0g7uDNaNFSOVEPwip7U2y82emwI0SPW6ErHIO90qUjOOzyu3zFTqfweuwBjN
6Am+AChHOabrEc8upNj+HGMBBge9FARjhI7AlhCqNz1aQUMeOqKwahWESPEJ/Rfg
kMXcHhAp5E1vtHIOpYdxrgbwhJxpXPPZjhorUpmd4pZr+GZ8XxrW03C1T+EWCJL4
5g/JVsqgF90nJ4YGWy/YJiN5UBlSr5NjQhEso89X35ATAogSTVn6qfEXseqTeZJN
qVcDCpUPh28FTM5lhvxKFTHjBF0oqWy3nGOHZ2JBKohVOYT/uJ9Kne4=
=/poc
-----END PGP SIGNATURE-----
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2019-09-16' into staging
Block patches:
- Fix for block jobs when used with I/O threads
- Fix for a corruption when using qcow2's LUKS encryption mode
- cURL fix
- check-block.sh cleanups (for make check)
- Refactoring
# gpg: Signature made Mon 16 Sep 2019 14:41:15 BST
# gpg: using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg: issuer "mreitz@redhat.com"
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40
* remotes/maxreitz/tags/pull-block-2019-09-16:
qemu-iotests: Add test for bz #1745922
block/qcow2: refactor encryption code
block/qcow2: Fix corruption introduced by commit 8ac0f15f33
blockjob: update nodes head while removing all bdrv
curl: Check curl_multi_add_handle()'s return code
curl: Handle success in multi_check_completion
curl: Report only ready sockets
curl: Pass CURLSocket to curl_multi_do()
curl: Check completion in curl_multi_do()
curl: Keep *socket until the end of curl_sock_cb()
curl: Keep pointer to the CURLState in CURLSocket
tests/qemu-iotests: Fix qemu-io related output in 026.out.nocache
tests/Makefile: Do not print the name of the check-block.sh shell script
tests/qemu-iotests/check: Replace "tests" with "iotests" in final status text
block: Remove unused masks
block: Use QEMU_IS_ALIGNED
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
521db80318
|
@ -248,8 +248,8 @@ bochs_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
|
|||
QEMUIOVector local_qiov;
|
||||
int ret;
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
|
||||
|
||||
qemu_iovec_init(&local_qiov, qiov->niov);
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
|
|
|
@ -253,8 +253,8 @@ cloop_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
|
|||
int nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||
int ret, i;
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
|
||||
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
|
||||
|
|
135
block/curl.c
135
block/curl.c
|
@ -80,6 +80,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
|
|||
#define CURL_BLOCK_OPT_TIMEOUT_DEFAULT 5
|
||||
|
||||
struct BDRVCURLState;
|
||||
struct CURLState;
|
||||
|
||||
static bool libcurl_initialized;
|
||||
|
||||
|
@ -97,6 +98,7 @@ typedef struct CURLAIOCB {
|
|||
|
||||
typedef struct CURLSocket {
|
||||
int fd;
|
||||
struct CURLState *state;
|
||||
QLIST_ENTRY(CURLSocket) next;
|
||||
} CURLSocket;
|
||||
|
||||
|
@ -137,7 +139,6 @@ typedef struct BDRVCURLState {
|
|||
|
||||
static void curl_clean_state(CURLState *s);
|
||||
static void curl_multi_do(void *arg);
|
||||
static void curl_multi_read(void *arg);
|
||||
|
||||
#ifdef NEED_CURL_TIMER_CALLBACK
|
||||
/* Called from curl_multi_do_locked, with s->mutex held. */
|
||||
|
@ -170,33 +171,29 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
|||
|
||||
QLIST_FOREACH(socket, &state->sockets, next) {
|
||||
if (socket->fd == fd) {
|
||||
if (action == CURL_POLL_REMOVE) {
|
||||
QLIST_REMOVE(socket, next);
|
||||
g_free(socket);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!socket) {
|
||||
socket = g_new0(CURLSocket, 1);
|
||||
socket->fd = fd;
|
||||
socket->state = state;
|
||||
QLIST_INSERT_HEAD(&state->sockets, socket, next);
|
||||
}
|
||||
socket = NULL;
|
||||
|
||||
trace_curl_sock_cb(action, (int)fd);
|
||||
switch (action) {
|
||||
case CURL_POLL_IN:
|
||||
aio_set_fd_handler(s->aio_context, fd, false,
|
||||
curl_multi_read, NULL, NULL, state);
|
||||
curl_multi_do, NULL, NULL, socket);
|
||||
break;
|
||||
case CURL_POLL_OUT:
|
||||
aio_set_fd_handler(s->aio_context, fd, false,
|
||||
NULL, curl_multi_do, NULL, state);
|
||||
NULL, curl_multi_do, NULL, socket);
|
||||
break;
|
||||
case CURL_POLL_INOUT:
|
||||
aio_set_fd_handler(s->aio_context, fd, false,
|
||||
curl_multi_read, curl_multi_do, NULL, state);
|
||||
curl_multi_do, curl_multi_do, NULL, socket);
|
||||
break;
|
||||
case CURL_POLL_REMOVE:
|
||||
aio_set_fd_handler(s->aio_context, fd, false,
|
||||
|
@ -204,6 +201,11 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
|||
break;
|
||||
}
|
||||
|
||||
if (action == CURL_POLL_REMOVE) {
|
||||
QLIST_REMOVE(socket, next);
|
||||
g_free(socket);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -227,7 +229,6 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
|
|||
{
|
||||
CURLState *s = ((CURLState*)opaque);
|
||||
size_t realsize = size * nmemb;
|
||||
int i;
|
||||
|
||||
trace_curl_read_cb(realsize);
|
||||
|
||||
|
@ -243,32 +244,6 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
|
|||
memcpy(s->orig_buf + s->buf_off, ptr, realsize);
|
||||
s->buf_off += realsize;
|
||||
|
||||
for(i=0; i<CURL_NUM_ACB; i++) {
|
||||
CURLAIOCB *acb = s->acb[i];
|
||||
|
||||
if (!acb)
|
||||
continue;
|
||||
|
||||
if ((s->buf_off >= acb->end)) {
|
||||
size_t request_length = acb->bytes;
|
||||
|
||||
qemu_iovec_from_buf(acb->qiov, 0, s->orig_buf + acb->start,
|
||||
acb->end - acb->start);
|
||||
|
||||
if (acb->end - acb->start < request_length) {
|
||||
size_t offset = acb->end - acb->start;
|
||||
qemu_iovec_memset(acb->qiov, offset, 0,
|
||||
request_length - offset);
|
||||
}
|
||||
|
||||
acb->ret = 0;
|
||||
s->acb[i] = NULL;
|
||||
qemu_mutex_unlock(&s->s->mutex);
|
||||
aio_co_wake(acb->co);
|
||||
qemu_mutex_lock(&s->s->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
read_end:
|
||||
/* curl will error out if we do not return this value */
|
||||
return size * nmemb;
|
||||
|
@ -349,13 +324,14 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
|||
break;
|
||||
|
||||
if (msg->msg == CURLMSG_DONE) {
|
||||
int i;
|
||||
CURLState *state = NULL;
|
||||
bool error = msg->data.result != CURLE_OK;
|
||||
|
||||
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE,
|
||||
(char **)&state);
|
||||
|
||||
/* ACBs for successful messages get completed in curl_read_cb */
|
||||
if (msg->data.result != CURLE_OK) {
|
||||
int i;
|
||||
if (error) {
|
||||
static int errcount = 100;
|
||||
|
||||
/* Don't lose the original error message from curl, since
|
||||
|
@ -367,20 +343,35 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
|||
error_report("curl: further errors suppressed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < CURL_NUM_ACB; i++) {
|
||||
CURLAIOCB *acb = state->acb[i];
|
||||
for (i = 0; i < CURL_NUM_ACB; i++) {
|
||||
CURLAIOCB *acb = state->acb[i];
|
||||
|
||||
if (acb == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
acb->ret = -EIO;
|
||||
state->acb[i] = NULL;
|
||||
qemu_mutex_unlock(&s->mutex);
|
||||
aio_co_wake(acb->co);
|
||||
qemu_mutex_lock(&s->mutex);
|
||||
if (acb == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
/* Assert that we have read all data */
|
||||
assert(state->buf_off >= acb->end);
|
||||
|
||||
qemu_iovec_from_buf(acb->qiov, 0,
|
||||
state->orig_buf + acb->start,
|
||||
acb->end - acb->start);
|
||||
|
||||
if (acb->end - acb->start < acb->bytes) {
|
||||
size_t offset = acb->end - acb->start;
|
||||
qemu_iovec_memset(acb->qiov, offset, 0,
|
||||
acb->bytes - offset);
|
||||
}
|
||||
}
|
||||
|
||||
acb->ret = error ? -EIO : 0;
|
||||
state->acb[i] = NULL;
|
||||
qemu_mutex_unlock(&s->mutex);
|
||||
aio_co_wake(acb->co);
|
||||
qemu_mutex_lock(&s->mutex);
|
||||
}
|
||||
|
||||
curl_clean_state(state);
|
||||
|
@ -390,42 +381,30 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
|||
}
|
||||
|
||||
/* Called with s->mutex held. */
|
||||
static void curl_multi_do_locked(CURLState *s)
|
||||
static void curl_multi_do_locked(CURLSocket *socket)
|
||||
{
|
||||
CURLSocket *socket, *next_socket;
|
||||
BDRVCURLState *s = socket->state->s;
|
||||
int running;
|
||||
int r;
|
||||
|
||||
if (!s->s->multi) {
|
||||
if (!s->multi) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Need to use _SAFE because curl_multi_socket_action() may trigger
|
||||
* curl_sock_cb() which might modify this list */
|
||||
QLIST_FOREACH_SAFE(socket, &s->sockets, next, next_socket) {
|
||||
do {
|
||||
r = curl_multi_socket_action(s->s->multi, socket->fd, 0, &running);
|
||||
} while (r == CURLM_CALL_MULTI_PERFORM);
|
||||
}
|
||||
do {
|
||||
r = curl_multi_socket_action(s->multi, socket->fd, 0, &running);
|
||||
} while (r == CURLM_CALL_MULTI_PERFORM);
|
||||
}
|
||||
|
||||
static void curl_multi_do(void *arg)
|
||||
{
|
||||
CURLState *s = (CURLState *)arg;
|
||||
CURLSocket *socket = arg;
|
||||
BDRVCURLState *s = socket->state->s;
|
||||
|
||||
qemu_mutex_lock(&s->s->mutex);
|
||||
curl_multi_do_locked(s);
|
||||
qemu_mutex_unlock(&s->s->mutex);
|
||||
}
|
||||
|
||||
static void curl_multi_read(void *arg)
|
||||
{
|
||||
CURLState *s = (CURLState *)arg;
|
||||
|
||||
qemu_mutex_lock(&s->s->mutex);
|
||||
curl_multi_do_locked(s);
|
||||
curl_multi_check_completion(s->s);
|
||||
qemu_mutex_unlock(&s->s->mutex);
|
||||
qemu_mutex_lock(&s->mutex);
|
||||
curl_multi_do_locked(socket);
|
||||
curl_multi_check_completion(s);
|
||||
qemu_mutex_unlock(&s->mutex);
|
||||
}
|
||||
|
||||
static void curl_multi_timeout_do(void *arg)
|
||||
|
@ -903,7 +882,13 @@ static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
|
|||
trace_curl_setup_preadv(acb->bytes, start, state->range);
|
||||
curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);
|
||||
|
||||
curl_multi_add_handle(s->multi, state->curl);
|
||||
if (curl_multi_add_handle(s->multi, state->curl) != CURLM_OK) {
|
||||
state->acb[0] = NULL;
|
||||
acb->ret = -EIO;
|
||||
|
||||
curl_clean_state(state);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Tell curl it needs to kick things off */
|
||||
curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running);
|
||||
|
|
|
@ -697,8 +697,8 @@ dmg_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
|
|||
int nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||
int ret, i;
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
|
||||
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
|
||||
|
|
|
@ -1097,8 +1097,8 @@ static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs,
|
|||
sector_num = offset >> BDRV_SECTOR_BITS;
|
||||
nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
|
||||
assert(bytes <= BDRV_REQUEST_MAX_BYTES);
|
||||
assert(drv->bdrv_co_readv);
|
||||
|
||||
|
@ -1171,8 +1171,8 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
|
|||
sector_num = offset >> BDRV_SECTOR_BITS;
|
||||
nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
|
||||
assert(bytes <= BDRV_REQUEST_MAX_BYTES);
|
||||
|
||||
assert(drv->bdrv_co_writev);
|
||||
|
|
|
@ -462,27 +462,6 @@ static int coroutine_fn do_perform_cow_read(BlockDriverState *bs,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs,
|
||||
uint64_t src_cluster_offset,
|
||||
uint64_t cluster_offset,
|
||||
unsigned offset_in_cluster,
|
||||
uint8_t *buffer,
|
||||
unsigned bytes)
|
||||
{
|
||||
if (bytes && bs->encrypted) {
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
assert((offset_in_cluster & ~BDRV_SECTOR_MASK) == 0);
|
||||
assert((bytes & ~BDRV_SECTOR_MASK) == 0);
|
||||
assert(s->crypto);
|
||||
if (qcow2_co_encrypt(bs, cluster_offset,
|
||||
src_cluster_offset + offset_in_cluster,
|
||||
buffer, bytes) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int coroutine_fn do_perform_cow_write(BlockDriverState *bs,
|
||||
uint64_t cluster_offset,
|
||||
unsigned offset_in_cluster,
|
||||
|
@ -890,12 +869,19 @@ static int perform_cow(BlockDriverState *bs, QCowL2Meta *m)
|
|||
|
||||
/* Encrypt the data if necessary before writing it */
|
||||
if (bs->encrypted) {
|
||||
if (!do_perform_cow_encrypt(bs, m->offset, m->alloc_offset,
|
||||
start->offset, start_buffer,
|
||||
start->nb_bytes) ||
|
||||
!do_perform_cow_encrypt(bs, m->offset, m->alloc_offset,
|
||||
end->offset, end_buffer, end->nb_bytes)) {
|
||||
ret = -EIO;
|
||||
ret = qcow2_co_encrypt(bs,
|
||||
m->alloc_offset + start->offset,
|
||||
m->offset + start->offset,
|
||||
start_buffer, start->nb_bytes);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = qcow2_co_encrypt(bs,
|
||||
m->alloc_offset + end->offset,
|
||||
m->offset + end->offset,
|
||||
end_buffer, end->nb_bytes);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,35 +234,70 @@ static int qcow2_encdec_pool_func(void *opaque)
|
|||
}
|
||||
|
||||
static int coroutine_fn
|
||||
qcow2_co_encdec(BlockDriverState *bs, uint64_t file_cluster_offset,
|
||||
uint64_t offset, void *buf, size_t len, Qcow2EncDecFunc func)
|
||||
qcow2_co_encdec(BlockDriverState *bs, uint64_t host_offset,
|
||||
uint64_t guest_offset, void *buf, size_t len,
|
||||
Qcow2EncDecFunc func)
|
||||
{
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
Qcow2EncDecData arg = {
|
||||
.block = s->crypto,
|
||||
.offset = s->crypt_physical_offset ?
|
||||
file_cluster_offset + offset_into_cluster(s, offset) :
|
||||
offset,
|
||||
.offset = s->crypt_physical_offset ? host_offset : guest_offset,
|
||||
.buf = buf,
|
||||
.len = len,
|
||||
.func = func,
|
||||
};
|
||||
|
||||
return qcow2_co_process(bs, qcow2_encdec_pool_func, &arg);
|
||||
assert(QEMU_IS_ALIGNED(guest_offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(host_offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(len, BDRV_SECTOR_SIZE));
|
||||
assert(s->crypto);
|
||||
|
||||
return len == 0 ? 0 : qcow2_co_process(bs, qcow2_encdec_pool_func, &arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* qcow2_co_encrypt()
|
||||
*
|
||||
* Encrypts one or more contiguous aligned sectors
|
||||
*
|
||||
* @host_offset - underlying storage offset of the first sector of the
|
||||
* data to be encrypted
|
||||
*
|
||||
* @guest_offset - guest (virtual) offset of the first sector of the
|
||||
* data to be encrypted
|
||||
*
|
||||
* @buf - buffer with the data to encrypt, that after encryption
|
||||
* will be written to the underlying storage device at
|
||||
* @host_offset
|
||||
*
|
||||
* @len - length of the buffer (must be a BDRV_SECTOR_SIZE multiple)
|
||||
*
|
||||
* Depending on the encryption method, @host_offset and/or @guest_offset
|
||||
* may be used for generating the initialization vector for
|
||||
* encryption.
|
||||
*
|
||||
* Note that while the whole range must be aligned on sectors, it
|
||||
* does not have to be aligned on clusters and can also cross cluster
|
||||
* boundaries
|
||||
*/
|
||||
int coroutine_fn
|
||||
qcow2_co_encrypt(BlockDriverState *bs, uint64_t file_cluster_offset,
|
||||
uint64_t offset, void *buf, size_t len)
|
||||
qcow2_co_encrypt(BlockDriverState *bs, uint64_t host_offset,
|
||||
uint64_t guest_offset, void *buf, size_t len)
|
||||
{
|
||||
return qcow2_co_encdec(bs, file_cluster_offset, offset, buf, len,
|
||||
qcrypto_block_encrypt);
|
||||
return qcow2_co_encdec(bs, host_offset, guest_offset, buf, len,
|
||||
qcrypto_block_encrypt);
|
||||
}
|
||||
|
||||
/*
|
||||
* qcow2_co_decrypt()
|
||||
*
|
||||
* Decrypts one or more contiguous aligned sectors
|
||||
* Similar to qcow2_co_encrypt
|
||||
*/
|
||||
int coroutine_fn
|
||||
qcow2_co_decrypt(BlockDriverState *bs, uint64_t file_cluster_offset,
|
||||
uint64_t offset, void *buf, size_t len)
|
||||
qcow2_co_decrypt(BlockDriverState *bs, uint64_t host_offset,
|
||||
uint64_t guest_offset, void *buf, size_t len)
|
||||
{
|
||||
return qcow2_co_encdec(bs, file_cluster_offset, offset, buf, len,
|
||||
qcrypto_block_decrypt);
|
||||
return qcow2_co_encdec(bs, host_offset, guest_offset, buf, len,
|
||||
qcrypto_block_decrypt);
|
||||
}
|
||||
|
|
|
@ -2067,9 +2067,10 @@ static coroutine_fn int qcow2_co_preadv_part(BlockDriverState *bs,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((cur_bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
if (qcow2_co_decrypt(bs, cluster_offset, offset,
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(cur_bytes, BDRV_SECTOR_SIZE));
|
||||
if (qcow2_co_decrypt(bs, cluster_offset + offset_in_cluster,
|
||||
offset,
|
||||
cluster_data, cur_bytes) < 0) {
|
||||
ret = -EIO;
|
||||
goto fail;
|
||||
|
@ -2288,7 +2289,7 @@ static coroutine_fn int qcow2_co_pwritev_part(
|
|||
qemu_iovec_to_buf(qiov, qiov_offset + bytes_done,
|
||||
cluster_data, cur_bytes);
|
||||
|
||||
if (qcow2_co_encrypt(bs, cluster_offset, offset,
|
||||
if (qcow2_co_encrypt(bs, cluster_offset + offset_in_cluster, offset,
|
||||
cluster_data, cur_bytes) < 0) {
|
||||
ret = -EIO;
|
||||
goto out_unlocked;
|
||||
|
|
|
@ -758,10 +758,10 @@ ssize_t coroutine_fn
|
|||
qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size,
|
||||
const void *src, size_t src_size);
|
||||
int coroutine_fn
|
||||
qcow2_co_encrypt(BlockDriverState *bs, uint64_t file_cluster_offset,
|
||||
uint64_t offset, void *buf, size_t len);
|
||||
qcow2_co_encrypt(BlockDriverState *bs, uint64_t host_offset,
|
||||
uint64_t guest_offset, void *buf, size_t len);
|
||||
int coroutine_fn
|
||||
qcow2_co_decrypt(BlockDriverState *bs, uint64_t file_cluster_offset,
|
||||
uint64_t offset, void *buf, size_t len);
|
||||
qcow2_co_decrypt(BlockDriverState *bs, uint64_t host_offset,
|
||||
uint64_t guest_offset, void *buf, size_t len);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1547,8 +1547,8 @@ vvfat_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
|
|||
int nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||
void *buf;
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
|
||||
|
||||
buf = g_try_malloc(bytes);
|
||||
if (bytes && buf == NULL) {
|
||||
|
@ -3082,8 +3082,8 @@ vvfat_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
|
|||
int nb_sectors = bytes >> BDRV_SECTOR_BITS;
|
||||
void *buf;
|
||||
|
||||
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
|
||||
assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE));
|
||||
assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE));
|
||||
|
||||
buf = g_try_malloc(bytes);
|
||||
if (bytes && buf == NULL) {
|
||||
|
|
17
blockjob.c
17
blockjob.c
|
@ -175,14 +175,23 @@ static const BdrvChildRole child_job = {
|
|||
|
||||
void block_job_remove_all_bdrv(BlockJob *job)
|
||||
{
|
||||
GSList *l;
|
||||
for (l = job->nodes; l; l = l->next) {
|
||||
/*
|
||||
* bdrv_root_unref_child() may reach child_job_[can_]set_aio_ctx(),
|
||||
* which will also traverse job->nodes, so consume the list one by
|
||||
* one to make sure that such a concurrent access does not attempt
|
||||
* to process an already freed BdrvChild.
|
||||
*/
|
||||
while (job->nodes) {
|
||||
GSList *l = job->nodes;
|
||||
BdrvChild *c = l->data;
|
||||
|
||||
job->nodes = l->next;
|
||||
|
||||
bdrv_op_unblock_all(c->bs, job->blocker);
|
||||
bdrv_root_unref_child(c);
|
||||
|
||||
g_slist_free_1(l);
|
||||
}
|
||||
g_slist_free(job->nodes);
|
||||
job->nodes = NULL;
|
||||
}
|
||||
|
||||
bool block_job_has_bdrv(BlockJob *job, BlockDriverState *bs)
|
||||
|
|
|
@ -143,7 +143,6 @@ typedef struct HDGeometry {
|
|||
|
||||
#define BDRV_SECTOR_BITS 9
|
||||
#define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS)
|
||||
#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1)
|
||||
|
||||
#define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \
|
||||
INT_MAX >> BDRV_SECTOR_BITS)
|
||||
|
@ -195,7 +194,6 @@ typedef struct HDGeometry {
|
|||
#define BDRV_BLOCK_ALLOCATED 0x10
|
||||
#define BDRV_BLOCK_EOF 0x20
|
||||
#define BDRV_BLOCK_RECURSE 0x40
|
||||
#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK
|
||||
|
||||
typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;
|
||||
|
||||
|
|
|
@ -906,7 +906,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
|
|||
do {
|
||||
addr = qemu_get_be64(f);
|
||||
|
||||
flags = addr & ~BDRV_SECTOR_MASK;
|
||||
flags = addr & (BDRV_SECTOR_SIZE - 1);
|
||||
addr >>= BDRV_SECTOR_BITS;
|
||||
|
||||
if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) {
|
||||
|
|
|
@ -2141,7 +2141,7 @@ static int img_convert(int argc, char **argv)
|
|||
int64_t sval;
|
||||
|
||||
sval = cvtnum(optarg);
|
||||
if (sval < 0 || sval & (BDRV_SECTOR_SIZE - 1) ||
|
||||
if (sval < 0 || !QEMU_IS_ALIGNED(sval, BDRV_SECTOR_SIZE) ||
|
||||
sval / BDRV_SECTOR_SIZE > MAX_BUF_SECTORS) {
|
||||
error_report("Invalid buffer size for sparse output specified. "
|
||||
"Valid sizes are multiples of %llu up to %llu. Select "
|
||||
|
|
|
@ -1100,7 +1100,7 @@ QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu
|
|||
check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \
|
||||
qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
|
||||
$(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS)))
|
||||
$<
|
||||
@$<
|
||||
|
||||
.PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
|
||||
$(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
|
||||
|
|
|
@ -14,8 +14,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_update; errno: 5; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
|
||||
1 leaked clusters were found on the image.
|
||||
|
@ -23,8 +23,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_update; errno: 5; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
|
||||
1 leaked clusters were found on the image.
|
||||
|
@ -42,8 +42,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_update; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
1 leaked clusters were found on the image.
|
||||
|
@ -51,8 +51,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_update; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
1 leaked clusters were found on the image.
|
||||
|
@ -136,8 +136,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_update; errno: 5; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
wrote 131072/131072 bytes at offset 0
|
||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
|
@ -146,8 +146,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_update; errno: 5; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
wrote 131072/131072 bytes at offset 0
|
||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
|
@ -168,8 +168,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_update; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
wrote 131072/131072 bytes at offset 0
|
||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
|
@ -178,8 +178,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_update; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
wrote 131072/131072 bytes at offset 0
|
||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
|
@ -198,15 +198,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_alloc_write; errno: 5; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
|
||||
1 leaked clusters were found on the image.
|
||||
|
@ -224,15 +224,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_alloc_write; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
1 leaked clusters were found on the image.
|
||||
|
@ -250,15 +250,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: write_aio; errno: 5; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: write_aio; errno: 5; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -274,15 +274,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: write_aio; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: write_aio; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -298,15 +298,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_load; errno: 5; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_load; errno: 5; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -322,15 +322,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_load; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_load; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -346,15 +346,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_update_part; errno: 5; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_update_part; errno: 5; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -370,15 +370,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_update_part; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_update_part; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -394,15 +394,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc; errno: 5; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc; errno: 5; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -418,15 +418,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -485,8 +485,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
55 leaked clusters were found on the image.
|
||||
|
@ -494,8 +494,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
251 leaked clusters were found on the image.
|
||||
|
@ -513,15 +513,15 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_write; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -537,8 +537,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
10 leaked clusters were found on the image.
|
||||
|
@ -546,8 +546,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
23 leaked clusters were found on the image.
|
||||
|
@ -565,8 +565,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
10 leaked clusters were found on the image.
|
||||
|
@ -574,8 +574,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
23 leaked clusters were found on the image.
|
||||
|
@ -593,8 +593,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
10 leaked clusters were found on the image.
|
||||
|
@ -602,8 +602,8 @@ This means waste of disk space, but no harm to data.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write -b
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
23 leaked clusters were found on the image.
|
||||
|
@ -639,8 +639,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_grow_write_table; errno: 5; imm: off; once: off
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -651,8 +651,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_grow_write_table; errno: 28; imm: off; once: off
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
No errors were found on the image.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
@ -663,8 +663,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_grow_activate_table; errno: 5; imm: off; once: off
|
||||
Failed to flush the L2 table cache: Input/output error
|
||||
Failed to flush the refcount block cache: Input/output error
|
||||
qemu-io: Failed to flush the L2 table cache: Input/output error
|
||||
qemu-io: Failed to flush the refcount block cache: Input/output error
|
||||
write failed: Input/output error
|
||||
|
||||
96 leaked clusters were found on the image.
|
||||
|
@ -677,8 +677,8 @@ No errors were found on the image.
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
Event: l1_grow_activate_table; errno: 28; imm: off; once: off
|
||||
Failed to flush the L2 table cache: No space left on device
|
||||
Failed to flush the refcount block cache: No space left on device
|
||||
qemu-io: Failed to flush the L2 table cache: No space left on device
|
||||
qemu-io: Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
96 leaked clusters were found on the image.
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Test encrypted write that crosses cluster boundary of two unallocated clusters
|
||||
# Based on 188
|
||||
#
|
||||
# Copyright (C) 2019 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# creator
|
||||
owner=mlevitsk@redhat.com
|
||||
|
||||
seq=`basename $0`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
status=1 # failure is the default!
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
_cleanup_test_img
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_supported_fmt qcow2
|
||||
_supported_proto generic
|
||||
_supported_os Linux
|
||||
|
||||
|
||||
size=1M
|
||||
|
||||
SECRET="secret,id=sec0,data=astrochicken"
|
||||
QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
|
||||
|
||||
|
||||
_run_test()
|
||||
{
|
||||
echo "== reading the whole image =="
|
||||
$QEMU_IO --object $SECRET -c "read -P 0 0 $size" --image-opts "$1" | _filter_qemu_io | _filter_testdir
|
||||
|
||||
echo
|
||||
echo "== write two 512 byte sectors on a cluster boundary =="
|
||||
$QEMU_IO --object $SECRET -c "write -P 0xAA 0xFE00 0x400" --image-opts "$1" | _filter_qemu_io | _filter_testdir
|
||||
|
||||
echo
|
||||
echo "== verify that the rest of the image is not changed =="
|
||||
$QEMU_IO --object $SECRET -c "read -P 0x00 0x00000 0xFE00" --image-opts "$1" | _filter_qemu_io | _filter_testdir
|
||||
$QEMU_IO --object $SECRET -c "read -P 0xAA 0x0FE00 0x400" --image-opts "$1" | _filter_qemu_io | _filter_testdir
|
||||
$QEMU_IO --object $SECRET -c "read -P 0x00 0x10200 0xEFE00" --image-opts "$1" | _filter_qemu_io | _filter_testdir
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo
|
||||
echo "testing LUKS qcow2 encryption"
|
||||
echo
|
||||
|
||||
_make_test_img --object $SECRET -o "encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10,cluster_size=64K" $size
|
||||
_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG"
|
||||
_cleanup_test_img
|
||||
|
||||
echo
|
||||
echo "testing legacy AES qcow2 encryption"
|
||||
echo
|
||||
|
||||
|
||||
_make_test_img --object $SECRET -o "encrypt.format=aes,encrypt.key-secret=sec0,cluster_size=64K" $size
|
||||
_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG"
|
||||
_cleanup_test_img
|
||||
|
||||
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
status=0
|
|
@ -0,0 +1,40 @@
|
|||
QA output created by 263
|
||||
|
||||
testing LUKS qcow2 encryption
|
||||
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10
|
||||
== reading the whole image ==
|
||||
read 1048576/1048576 bytes at offset 0
|
||||
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
== write two 512 byte sectors on a cluster boundary ==
|
||||
wrote 1024/1024 bytes at offset 65024
|
||||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
== verify that the rest of the image is not changed ==
|
||||
read 65024/65024 bytes at offset 0
|
||||
63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 1024/1024 bytes at offset 65024
|
||||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 982528/982528 bytes at offset 66048
|
||||
959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
testing legacy AES qcow2 encryption
|
||||
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=aes encrypt.key-secret=sec0
|
||||
== reading the whole image ==
|
||||
read 1048576/1048576 bytes at offset 0
|
||||
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
== write two 512 byte sectors on a cluster boundary ==
|
||||
wrote 1024/1024 bytes at offset 65024
|
||||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
||||
== verify that the rest of the image is not changed ==
|
||||
read 65024/65024 bytes at offset 0
|
||||
63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 1024/1024 bytes at offset 65024
|
||||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 982528/982528 bytes at offset 66048
|
||||
959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
*** done
|
|
@ -694,12 +694,12 @@ END { if (NR > 0) {
|
|||
if [ ! -z "$n_bad" -a $n_bad != 0 ]
|
||||
then
|
||||
echo "Failures:$bad"
|
||||
echo "Failed $n_bad of $try tests"
|
||||
echo "Failed $n_bad of $try iotests"
|
||||
echo "Failures:$bad" | fmt >>check.log
|
||||
echo "Failed $n_bad of $try tests" >>check.log
|
||||
echo "Failed $n_bad of $try iotests" >>check.log
|
||||
else
|
||||
echo "Passed all $try tests"
|
||||
echo "Passed all $try tests" >>check.log
|
||||
echo "Passed all $try iotests"
|
||||
echo "Passed all $try iotests" >>check.log
|
||||
fi
|
||||
needwrap=false
|
||||
fi
|
||||
|
|
|
@ -274,5 +274,6 @@
|
|||
257 rw
|
||||
258 rw quick
|
||||
262 rw quick migration
|
||||
263 rw quick
|
||||
265 rw auto quick
|
||||
266 rw quick
|
||||
|
|
Loading…
Reference in New Issue