Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TA2546] feat(snaprebuild) IOs on the cloned volume if it exists #117

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions lib/libzrepl/data_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ uzfs_zvol_worker(void *arg)
{
zvol_io_cmd_t *zio_cmd;
zvol_info_t *zinfo;
zvol_state_t *zvol_state, *read_zv;
zvol_state_t *zvol_state, *read_zv, *io_zv;
zvol_io_hdr_t *hdr;
metadata_desc_t **metadata_desc;
int rc = 0;
Expand All @@ -285,6 +285,12 @@ uzfs_zvol_worker(void *arg)
rebuild_cmd_req = hdr->flags & ZVOL_OP_FLAG_REBUILD;
read_metadata = hdr->flags & ZVOL_OP_FLAG_READ_METADATA;


if (zinfo->clone_zv)
io_zv = zinfo->clone_zv;
else
io_zv = zinfo->main_zv;

if (zinfo->is_io_ack_sender_created == B_FALSE) {
if (!(rebuild_cmd_req && (hdr->opcode == ZVOL_OPCODE_WRITE)))
zio_cmd_free(&zio_cmd);
Expand Down Expand Up @@ -318,7 +324,7 @@ uzfs_zvol_worker(void *arg)
}
switch (hdr->opcode) {
case ZVOL_OPCODE_READ:
read_zv = zinfo->main_zv;
read_zv = io_zv;
if (rebuild_cmd_req) {
/*
* if we are rebuilding, we have
Expand All @@ -345,7 +351,7 @@ uzfs_zvol_worker(void *arg)
break;

case ZVOL_OPCODE_SYNC:
uzfs_flush_data(zinfo->main_zv);
uzfs_flush_data(io_zv);
atomic_inc_64(&zinfo->sync_req_received_cnt);
break;

Expand Down Expand Up @@ -683,6 +689,8 @@ uzfs_zvol_rebuild_dw_replica(void *arg)
uzfs_zvol_set_status(zinfo->main_zv,
ZVOL_STATUS_HEALTHY);
uzfs_update_ionum_interval(zinfo, 0);
VERIFY0(uzfs_zvol_destroy_internal_clone(zinfo->main_zv,
&zinfo->snap_zv, &zinfo->clone_zv));
}
}
mutex_exit(&zinfo->main_zv->rebuild_mtx);
Expand Down Expand Up @@ -1109,6 +1117,8 @@ uzfs_zvol_rebuild_scanner_callback(off_t offset, size_t len,
* replica. Degraded replica will take care of breaking the connection
*/
uzfs_zvol_worker(zio_cmd);

zinfo->rebuild_zv = NULL;
return (0);
}

Expand Down