Skip to content

Commit

Permalink
DLPX-86321 Hang when zoa gets killed after object store add (openzfs#905
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sdimitro authored Jun 9, 2023
1 parent b014fac commit 3ae893b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions module/os/linux/zfs/vdev_object_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ typedef struct vdev_object_store {
boolean_t vos_open_completed;
boolean_t vos_create_completed;
boolean_t vos_closing;
boolean_t vos_synced_once;
const char *vos_feature_enable;
uint64_t vos_result;

Expand Down Expand Up @@ -1147,6 +1148,7 @@ agent_resume_state_check(vdev_t *vd)
sizeof (uberblock_t)) == 0) {
return (0);
}

if (vos->vos_send_txg_selector == VOS_TXG_END) {
/*
* In this case, it's possible that the uberblock was written
Expand All @@ -1162,6 +1164,18 @@ agent_resume_state_check(vdev_t *vd)
return (0);
}
}

if (!vos->vos_synced_once && vos->vos_uberblock.ub_txg == 0) {
/*
* This can happen when we added an object store vdev to a
* block-based pool and the agent died before we managed to
* sync a single TXG/uberblock to the object store.
*/
ASSERT0(vos->vos_uberblock.ub_magic);
ASSERT0(vos->vos_uberblock.ub_guid_sum);
ASSERT0(vos->vos_uberblock.ub_timestamp);
return (0);
}
return (SET_ERROR(EBUSY));
}

Expand Down Expand Up @@ -1486,6 +1500,7 @@ object_store_end_txg(vdev_t *vd, nvlist_t *config, uint64_t txg)
ASSERT3U(len, ==, vos->vos_free_list_len);
vos->vos_free_list_len = 0;
vos->vos_send_txg_selector = VOS_TXG_NONE;
vos->vos_synced_once = B_TRUE;
}

void
Expand Down Expand Up @@ -2428,6 +2443,11 @@ vdev_object_store_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
error = agent_open_pool(vd, vos,
vdev_object_store_open_mode(spa_mode(vd->vdev_spa)),
B_FALSE);
/*
* Now that we've opened the pool, check if we've ever synced
* an uberblock to the object store.
*/
vos->vos_synced_once = (vos->vos_uberblock.ub_txg > 0);
}

/*
Expand Down

0 comments on commit 3ae893b

Please sign in to comment.