Date: Sat, 12 Feb 2022 11:40:07 +0000 From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 260200] AHCI emulation throws CAM errors when backed by -t malloc memory disk devices Message-ID: <bug-260200-27103-zpP84oSCA2@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-260200-27103@https.bugs.freebsd.org/bugzilla/> References: <bug-260200-27103@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260200 Aleksandr Fedorov <afedorov@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |afedorov@FreeBSD.org, | |markj@FreeBSD.org --- Comment #2 from Aleksandr Fedorov <afedorov@FreeBSD.org> --- This is because md(4) + memory backend doesn't support the DIOCGFLUSH ioctl (BIO_FLUSH command): https://github.com/freebsd/freebsd-src/blob/main/sys/dev/md/md.c#L650 pci_ahci.c: https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/bhyve/pci_ahci.c#= L783 So I see two ways to solve this issue. First, fix bhyve with patch like this: diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c index 98c0f9f5f38b..3fb81bb86ae2 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -102,6 +102,7 @@ struct blockif_ctxt { int bc_ischr; int bc_isgeom; int bc_candelete; + int bc_canflush; int bc_rdonly; off_t bc_size; int bc_sectsz; @@ -224,6 +225,8 @@ static int blockif_flush_bc(struct blockif_ctxt *bc) { if (bc->bc_ischr) { + if (bc->bc_canflush =3D=3D 0) + return (0); if (ioctl(bc->bc_fd, DIOCGFLUSH)) return (errno); } else if (fsync(bc->bc_fd)) @@ -463,7 +466,7 @@ blockif_open(nvlist_t *nvl, const char *ident) struct diocgattr_arg arg; off_t size, psectsz, psectoff; int extra, fd, i, sectsz; - int ro, candelete, geom, ssopt, pssopt; + int ro, candelete, canflush, geom, ssopt, pssopt; int nodelete; #ifndef WITHOUT_CAPSICUM @@ -566,6 +569,12 @@ blockif_open(nvlist_t *nvl, const char *ident) candelete =3D arg.value.i; if (ioctl(fd, DIOCGPROVIDERNAME, name) =3D=3D 0) geom =3D 1; + if (ioctl(fd, DIOCGFLUSH) =3D=3D 0) + canflush =3D 1; + else if (errno =3D=3D ENOTSUP) { + canflush =3D 0; + errno =3D 0; + } } else psectsz =3D sbuf.st_blksize; @@ -614,6 +623,7 @@ blockif_open(nvlist_t *nvl, const char *ident) bc->bc_ischr =3D S_ISCHR(sbuf.st_mode); bc->bc_isgeom =3D geom; bc->bc_candelete =3D candelete; + bc->bc_canflush =3D canflush; bc->bc_rdonly =3D ro; bc->bc_size =3D size; bc->bc_sectsz =3D sectsz; Second, add a NOP support of the BIO_FLUSH cmd to md(4) (mdstart_malloc()). --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-260200-27103-zpP84oSCA2>