On 29/09/2021 20:28, Xin LI wrote:
For context, the discussion was at
https://lists.freebsd.org/pipermail/freebsd-current/2020-June/thread.html#76210 .
My takeaway[*], perhaps incorrect, from reading that is that the problem is with
this check in g_label_taste():
/* Skip providers that are already open for writing. */
if (pp->acw > 0)
return (NULL);
On the one hand this looks reasonable, on the other hand if a disk is open for
writing it does not mean that its can change (it cannot). If a partition is
open for writing it does not mean that its label can change (it cannot unless
its container is open for writing as well). It does not necessarily mean that a
filesystem label will change (although it can).
We probably need a better mechanism to communicate label changes than the access
bits alone.
As a quick solution, perhaps we could add a flag that allows a label class to
declare that it can safely test a provider even when it's open for writing?
[*]
I made my conclusion based on this snippet:
ZFS gets an exclusive hold of 'ada1p2' despite the pool is carefully created
to use /dev/diskid/<DISKSERIAL>p2 instead of ada1p2.
...
However, this will prevent GEOM from properly creating
/dev/diskid/<DISKSERIAL>.
--
Andriy Gapon