Am 24.08.2026 um 15:37 hat Denis V. Lunev geschrieben:
> From: Denis V. Lunev <[email protected]>
> 
> qcow2_reopen_prepare() clears the dirty bit whenever the node is
> reopened read-only, with an unguarded header write. A read-only node
> can still be dirty, inherited from an earlier writable session, and it
> holds no BLK_PERM_WRITE to resolve that. A read-only to read-only
> reopen of a dirty image therefore fails outright:
> 
>   $ qemu-io -r -f qcow2 dirty.qcow2 <<< $'reopen -r\nquit'
>   qemu-io: failed while preparing to reopen image 'dirty.qcow2'
> 
> Where the file node below is writable the write is not refused early,
> and bdrv_co_write_req_prepare() aborts on its BLK_PERM_WRITE assertion
> instead.
> 
> Clear it only for a node that is writable now, the predicate
> qcow2_do_open() already uses for the repair. bdrv_is_writable() also
> excludes an inactive node, whose header must not be touched either.
> 
> Signed-off-by: Denis V. Lunev <[email protected]>
> Reviewed-by: Andrey Drobyshev <[email protected]>
> CC: Kevin Wolf <[email protected]>
> CC: Hanna Reitz <[email protected]>
> CC: Andrey Drobyshev <[email protected]>
> Cc: [email protected]

Reviewed-by: Kevin Wolf <[email protected]>


Reply via email to