From ecab88ad9946ef28392b12aeff3f40d49a91b2f2 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 7 Oct 2021 13:29:03 -0700 Subject: [PATCH] devices: virtio: block: suppress error for GET_ID If the guest sends a VIRTIO_BLK_T_GET_ID request and the block device does not have an ID configured, crosvm prints an error message: [devices/src/virtio/block/asynchronous.rs:191] failed executing disk request: unsupported (8) Since there is no corresponding feature flag for GET_ID support, the guest can only detect if the command is supported by just trying it. However, the error message is confusing to the crosvm user, since this request failure is not indicative of a problem, just a part of normal operation. To avoid this confusion, suppress the error message when GET_ID fails while still returning the unsupported status to the guest. BUG=None TEST=crosvm run -r vm_rootfs.img vm_kernel # check syslog for no error Change-Id: I05fcd3c428ff1314998ac88fd92d78423155dba3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3213115 Reviewed-by: Chirantan Ekbote Tested-by: kokoro Commit-Queue: Daniel Verkamp --- devices/src/virtio/block/asynchronous.rs | 4 +++- devices/src/virtio/block/block.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/devices/src/virtio/block/asynchronous.rs b/devices/src/virtio/block/asynchronous.rs index 3ad10b8b01..d889137c55 100644 --- a/devices/src/virtio/block/asynchronous.rs +++ b/devices/src/virtio/block/asynchronous.rs @@ -188,7 +188,9 @@ async fn process_one_request( { Ok(()) => VIRTIO_BLK_S_OK, Err(e) => { - error!("failed executing disk request: {}", e); + if !matches!(e, ExecuteError::Unsupported(VIRTIO_BLK_T_GET_ID)) { + error!("failed executing disk request: {}", e); + } e.status() } }; diff --git a/devices/src/virtio/block/block.rs b/devices/src/virtio/block/block.rs index 7869abee97..c97e2e8e92 100644 --- a/devices/src/virtio/block/block.rs +++ b/devices/src/virtio/block/block.rs @@ -151,7 +151,9 @@ impl Worker { ) { Ok(()) => VIRTIO_BLK_S_OK, Err(e) => { - error!("failed executing disk request: {}", e); + if !matches!(e, ExecuteError::Unsupported(VIRTIO_BLK_T_GET_ID)) { + error!("failed executing disk request: {}", e); + } e.status() } };