Searched hist:"69 b736e76567ecbc9b9e55570bc0afc840614a98" (Results 1 – 1 of 1) sorted by relevance
/openbmc/qemu/ |
H A D | block.c | diff 69b736e76567ecbc9b9e55570bc0afc840614a98 Tue Mar 05 10:18:22 CST 2019 Kevin Wolf <kwolf@redhat.com> block: Make permission changes in reopen less wrong
The way that reopen interacts with permission changes has one big problem: Both operations are recursive, and the permissions are changes for each node in the reopen queue.
For a simple graph that consists just of parent and child, .bdrv_check_perm will be called twice for the child, once recursively when adjusting the permissions of parent, and once again when the child itself is reopened.
Even worse, the first .bdrv_check_perm call happens before .bdrv_reopen_prepare was called for the child and the second one is called afterwards.
Making sure that .bdrv_check_perm (and the other permission callbacks) are called only once is hard. We can cope with multiple calls right now, but as soon as file-posix gets a dynamic auto-read-only that may need to open a new file descriptor, we get the additional requirement that all of them are after the .bdrv_reopen_prepare call.
So reorder things in bdrv_reopen_multiple() to first call .bdrv_reopen_prepare for all involved nodes and only then adjust permissions.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|