mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
During pool export flush the ARC asynchronously
This also includes removing L2 vdevs asynchronously. This commit also guarantees that spa_load_guid is unique. The zpool reguid feature introduced the spa_load_guid, which is a transient value used for runtime identification purposes in the ARC. This value is not the same as the spa's persistent pool guid. However, the value is seeded from spa_generate_load_guid() which does not check for uniqueness against the spa_load_guid from other pools. Although extremely rare, you can end up with two different pools sharing the same spa_load_guid value! So we guarantee that the value is always unique and additionally not still in use by an async arc flush task. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Allan Jude <allan@klarasystems.com> Signed-off-by: Don Brady <don.brady@klarasystems.com> Closes #16215
This commit is contained in:
@@ -1588,6 +1588,34 @@ spa_generate_guid(spa_t *spa)
|
||||
return (guid);
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
spa_load_guid_exists(uint64_t guid)
|
||||
{
|
||||
avl_tree_t *t = &spa_namespace_avl;
|
||||
|
||||
ASSERT(MUTEX_HELD(&spa_namespace_lock));
|
||||
|
||||
for (spa_t *spa = avl_first(t); spa != NULL; spa = AVL_NEXT(t, spa)) {
|
||||
if (spa_load_guid(spa) == guid)
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
return (arc_async_flush_guid_inuse(guid));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
spa_generate_load_guid(void)
|
||||
{
|
||||
uint64_t guid;
|
||||
|
||||
do {
|
||||
(void) random_get_pseudo_bytes((void *)&guid,
|
||||
sizeof (guid));
|
||||
} while (guid == 0 || spa_load_guid_exists(guid));
|
||||
|
||||
return (guid);
|
||||
}
|
||||
|
||||
void
|
||||
snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user