Take into account the fact that a block filter like quorum will be in bs->file while a regular block driver device is really on the top level.
Signed-off-by: Benoit Canet <ben...@irqsave.net> --- block.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/block.c b/block.c index 07ac50a..d04f535 100644 --- a/block.c +++ b/block.c @@ -5400,14 +5400,16 @@ bool bdrv_is_first_non_filter(BlockDriverState *candidate) /* walk down the bs forest recursively */ QTAILQ_FOREACH(bs, &bdrv_states, device_list) { - bool perm; - - if (!bs->file) { - continue; + bool perm = false; + + if (bs->file && + bs->file->drv && + bs->file->drv->authorizations[BS_IS_A_FILTER]) { + perm = bdrv_recurse_is_first_non_filter(bs->file, candidate); + } else if (bs == candidate) { + perm = true; } - perm = bdrv_recurse_is_first_non_filter(bs->file, candidate); - /* candidate is the first non filter */ if (perm) { return true; -- 1.8.3.2