Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2022 14:49:58 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 262189] ZFS volume not showing up in /dev/zvol when 1 CPU
Message-ID:  <bug-262189-227-Tmb6cGITpR@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-262189-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-262189-227@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=3D262189

Aleksandr Fedorov <afedorov@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |afedorov@FreeBSD.org

--- Comment #2 from Aleksandr Fedorov <afedorov@FreeBSD.org> ---
There are two things.

First, I think /dev/zvol/<pool>/device is created asynchronously. Therefore,
after the completion of the "zfs create ..." command, the device may not ha=
ve
been created yet and the dd command will fail.

I think that if you add "sleep 5" to the script, the error will not be
reproduced:

seq 1 100 | while read i; do
zfs create -o volmode=3Ddev -V 1G $name_pool/data$i

sleep 5

dd if=3D/dev/zero of=3D/dev/zvol/$name_pool/data$i bs=3D1M
done

Second, the OpenZFS code creates a ZVOL device in a very strange way:
https://github.com/openzfs/zfs/blob/master/module/zfs/zvol.c#L1394

/*
* It's unfortunate we need to remove minors before we create new ones:
* this is necessary because our backing gendisk (zvol_state->zv_disk)
* could be different when we set, for instance, volmode from "geom"
* to "dev" (or vice versa).
*/

First, a ZVOL device is created with the default volmode, then it's removed=
 and
created with the requested one. In FreeBSD, the default value for
vfs.zfs.vol.mode is 1 (GEOM). Therefore, there is a race between the ZFS and
GEOM threads. That's why you see this error: "g_dev_taste:
g_dev_taste(zvol/test/data22) failed to g_attach, error=3D6".

For example output of the "cat /var/run/devd.pipe" when I create ZVOL (zfs
create -V 1G -o volmode=3Ddev datapool/test).
!system=3DGEOM subsystem=3DDEV type=3DCREATE cdev=3Dzvol/datapool/test
!system=3DDEVFS subsystem=3DCDEV type=3DDESTROY cdev=3Dzvol/datapool/test
!system=3DGEOM subsystem=3DDEV type=3DDESTROY cdev=3Dzvol/datapool/test
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dzvol/datapool/test

--=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-262189-227-Tmb6cGITpR>