5bb04747 | 26-Jul-2022 |
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> |
block: Manipulate bs->file / bs->backing pointers in .attach/.detach
bs->file and bs->backing are a kind of duplication of part of bs->children. But very useful diplication, so let's not drop them a
block: Manipulate bs->file / bs->backing pointers in .attach/.detach
bs->file and bs->backing are a kind of duplication of part of bs->children. But very useful diplication, so let's not drop them at all:)
We should manage bs->file and bs->backing in same place, where we manage bs->children, to keep them in sync.
Moreover, generic io paths are unprepared to BdrvChild without a bs, so it's double good to clear bs->file / bs->backing when we detach the child.
Detach is simple: if we detach bs->file or bs->backing child, just set corresponding field to NULL.
Attach is a bit more complicated. But we still can precisely detect should we set one of bs->file / bs->backing or not:
- if role is BDRV_CHILD_COW, we definitely deal with bs->backing - else, if role is BDRV_CHILD_FILTERED (it must be also BDRV_CHILD_PRIMARY), it's a filtered child. Use bs->drv->filtered_child_is_backing to chose the pointer field to modify. - else, if role is BDRV_CHILD_PRIMARY, we deal with bs->file - in all other cases, it's neither bs->backing nor bs->file. It's some other child and we shouldn't care
OK. This change brings one more good thing: we can (and should) get rid of all indirect pointers in the block-graph-change transactions:
bdrv_attach_child_common() stores BdrvChild** into transaction to clear it on abort.
bdrv_attach_child_common() has two callers: bdrv_attach_child_noperm() just pass-through this feature, bdrv_root_attach_child() doesn't need the feature.
Look at bdrv_attach_child_noperm() callers: - bdrv_attach_child() doesn't need the feature - bdrv_set_file_or_backing_noperm() uses the feature to manage bs->file and bs->backing, we don't want it anymore - bdrv_append() uses the feature to manage bs->backing, again we don't want it anymore
So, we should drop this stuff! Great!
We could probably keep BdrvChild** argument to keep the int return value, but it seems not worth the complexity.
Finally, we now set .file / .backing automatically in generic code and want to restring setting them by hand outside of .attach/.detach. So, this patch cleanups all remaining places where they were set. To find such places I use:
git grep '\->file =' git grep '\->backing =' git grep '&.*\<backing\>' git grep '&.*\<file\>'
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220726201134.924743-14-vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
1921b4f7 | 26-Jul-2022 |
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> |
test-bdrv-graph-mod: fix filters to be filters
bdrv_pass_through is used as filter, even all node variables has corresponding names. We want to append it, so it should be backing-child-based filter
test-bdrv-graph-mod: fix filters to be filters
bdrv_pass_through is used as filter, even all node variables has corresponding names. We want to append it, so it should be backing-child-based filter like mirror_top. So, in test_update_perm_tree, first child should be DATA, as we don't want filters with two filtered children.
bdrv_exclusive_writer is used as a filter once. So it should be filter anyway. We want to append it, so it should be backing-child-based fitler too.
Make all FILTERED children to be PRIMARY as well. We are going to force this rule by assertion soon.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220726201134.924743-7-vsementsov@yandex-team.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
9ebfc111 | 26-Jul-2022 |
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> |
tests-bdrv-drain: bdrv_replace_test driver: declare supports_backing
We do add COW child to the node. In future we are going to forbid adding COW child to the node that doesn't support backing. So,
tests-bdrv-drain: bdrv_replace_test driver: declare supports_backing
We do add COW child to the node. In future we are going to forbid adding COW child to the node that doesn't support backing. So, fix it here now.
Don't worry about setting bs->backing itself: in further commit we'll update the block-layer to automatically set/unset this field in generic code.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220726201134.924743-6-vsementsov@yandex-team.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
da0ab2c4 | 05-Sep-2022 |
Daniel P. Berrangé <berrange@redhat.com> |
crypto: add test cases for many malformed LUKS header scenarios
Validate that we diagnose each malformed LUKS header scenario with a distinct error report.
Reviewed-by: Richard W.M. Jones <rjones@r
crypto: add test cases for many malformed LUKS header scenarios
Validate that we diagnose each malformed LUKS header scenario with a distinct error report.
Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
show more ...
|
741c314a | 05-Sep-2022 |
Daniel P. Berrangé <berrange@redhat.com> |
crypto: ensure LUKS tests run with GNUTLS crypto provider
GNUTLS is supported as a crypto provider since
commit cc4c7c738297958b3d1d16269f57d71d22f5a9ff Author: Daniel P. Berrangé <berrange@red
crypto: ensure LUKS tests run with GNUTLS crypto provider
GNUTLS is supported as a crypto provider since
commit cc4c7c738297958b3d1d16269f57d71d22f5a9ff Author: Daniel P. Berrangé <berrange@redhat.com> Date: Wed Jun 30 17:20:02 2021 +0100
crypto: introduce build system for gnutls crypto backend
So enable the LUKS tests in this config.
Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
show more ...
|
76f5148c | 06-Oct-2022 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
tests/unit: make test-io-channel-command work on win32
This has been tested under msys2 & windows 11. I haven't tried to make it work with other environments yet, but that should be enough to valida
tests/unit: make test-io-channel-command work on win32
This has been tested under msys2 & windows 11. I haven't tried to make it work with other environments yet, but that should be enough to validate the channel-command implementation anyway.
Here are the changes: - drop tests/ from fifo/pipe path, to avoid directory issues - use g_find_program() to lookup the socat executable (otherwise we would need to change ChanneCommand to use G_SPAWN_SEARCH_PATH, and deal with missing socat differently) - skip the "echo" test when socat is missing as well
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20221006113657.2656108-7-marcandre.lureau@redhat.com>
show more ...
|
9bd4d3c2 | 26-Sep-2022 |
Emanuele Giuseppe Esposito <eesposit@redhat.com> |
job: remove unused functions
These public functions are not used anywhere, thus can be dropped. Also, since this is the final job API that doesn't use AioContext lock and replaces it with job_lock,
job: remove unused functions
These public functions are not used anywhere, thus can be dropped. Also, since this is the final job API that doesn't use AioContext lock and replaces it with job_lock, adjust all remaining function documentation to clearly specify if the job lock is taken or not.
Also document the locking requirements for a few functions where the second version is not removed.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20220926093214.506243-22-eesposit@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
6f592e5a | 26-Sep-2022 |
Emanuele Giuseppe Esposito <eesposit@redhat.com> |
job.c: enable job lock/unlock and remove Aiocontext locks
Change the job_{lock/unlock} and macros to use job_mutex.
Now that they are not nop anymore, remove the aiocontext to avoid deadlocks.
The
job.c: enable job lock/unlock and remove Aiocontext locks
Change the job_{lock/unlock} and macros to use job_mutex.
Now that they are not nop anymore, remove the aiocontext to avoid deadlocks.
Therefore: - when possible, remove completely the aiocontext lock/unlock pair - if it is used by some other function too, reduce the locking section as much as possible, leaving the job API outside. - change AIO_WAIT_WHILE in AIO_WAIT_WHILE_UNLOCKED, since we are not using the aiocontext lock anymore
The only functions that still need the aiocontext lock are: - the JobDriver callbacks, already documented in job.h - job_cancel_sync() in replication.c is called with aio_context_lock taken, but now job is using AIO_WAIT_WHILE_UNLOCKED so we need to release the lock.
Reduce the locking section to only cover the callback invocation and document the functions that take the AioContext lock, to avoid taking it twice.
Also remove real_job_{lock/unlock}, as they are replaced by the public functions.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20220926093214.506243-19-eesposit@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
191e7af3 | 26-Sep-2022 |
Emanuele Giuseppe Esposito <eesposit@redhat.com> |
jobs: use job locks also in the unit tests
Add missing job synchronization in the unit tests, with explicit locks.
We are deliberately using _locked functions wrapped by a guard instead of a normal
jobs: use job locks also in the unit tests
Add missing job synchronization in the unit tests, with explicit locks.
We are deliberately using _locked functions wrapped by a guard instead of a normal call because the normal call will be removed in future, as the only usage is limited to the tests.
In other words, if a function like job_pause() is/will be only used in tests to avoid:
WITH_JOB_LOCK_GUARD(){ job_pause_locked(); }
then it is not worth keeping job_pause(), and just use the guard.
Note: at this stage, job_{lock/unlock} and job lock guard macros are *nop*.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20220926093214.506243-10-eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
5b9f2781 | 25-Sep-2022 |
Bin Meng <bin.meng@windriver.com> |
tests/unit: test-qga: Avoid using hardcoded /tmp
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() for a portable implementation.
Signed-off-b
tests/unit: test-qga: Avoid using hardcoded /tmp
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() for a portable implementation.
Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-24-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
582a098e | 27-Jul-2022 |
Thomas Huth <thuth@redhat.com> |
qga: Replace 'blacklist' command line and config file options by 'block-rpcs'
Let's use a more appropriate wording for this command line and config file option. The old ones are still accepted for c
qga: Replace 'blacklist' command line and config file options by 'block-rpcs'
Let's use a more appropriate wording for this command line and config file option. The old ones are still accepted for compatibility reasons, but marked as deprecated now so that it could be removed in a future version of QEMU.
This change is based on earlier patches from Philippe Mathieu-Daudé, with the idea for the new option name suggested by BALATON Zoltan.
And while we're at it, replace the "?" in the help text with "help" since that does not have the problem of conflicting with the wildcard character of the shells.
Message-Id: <20220727092135.302915-2-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
b3a58a6a | 05-Sep-2022 |
Paolo Bonzini <pbonzini@redhat.com> |
tests: unit: add NULL-pointer check
In CID 1432593, Coverity complains that the result of qdict_crumple() might leak if it is not a dictionary. This is not a practical concern since the test would
tests: unit: add NULL-pointer check
In CID 1432593, Coverity complains that the result of qdict_crumple() might leak if it is not a dictionary. This is not a practical concern since the test would fail immediately with a NULL pointer dereference in qdict_size().
However, it is not nice to depend on qdict_size() crashing, so add an explicit assertion that that the crumpled object was indeed a dictionary.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|