git: 5c0a03125988 - main - bhyve: don't flush readonly device at blockif_pause

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Mon, 06 Mar 2023 13:05:28 UTC
The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=5c0a03125988b89610f61a1bb2137b0e29d7cf31

commit 5c0a03125988b89610f61a1bb2137b0e29d7cf31
Author:     Vitaliy Gusev <gusev.vitaliy@gmail.com>
AuthorDate: 2023-03-06 11:35:17 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2023-03-06 13:04:07 +0000

    bhyve: don't flush readonly device at blockif_pause
    
    Reviewed by:            corvink, markj
    MFC after:              1 week
    Sponsored by:           vStack
    Differential Revision:  https://reviews.freebsd.org/D38855
---
 usr.sbin/bhyve/block_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c
index 53a892cbfa3a..6e47c3b7c4da 100644
--- a/usr.sbin/bhyve/block_if.c
+++ b/usr.sbin/bhyve/block_if.c
@@ -1009,7 +1009,7 @@ blockif_pause(struct blockif_ctxt *bc)
 		pthread_cond_wait(&bc->bc_work_done_cond, &bc->bc_mtx);
 	pthread_mutex_unlock(&bc->bc_mtx);
 
-	if (blockif_flush_bc(bc))
+	if (!bc->bc_rdonly && blockif_flush_bc(bc))
 		fprintf(stderr, "%s: [WARN] failed to flush backing file.\r\n",
 			__func__);
 }