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

[DE81]uzfs_zvol_worker should not free zio_cmd if zio_cmd is related to rebuild write. #92

Merged
merged 1 commit into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions include/zrepl_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ typedef struct zvol_io_cmd_s {
zvol_io_hdr_t hdr;
void *zv;
void *buf;
uint64_t buf_len;
metadata_desc_t *metadata_desc;
int conn;
} zvol_io_cmd_t;
Expand Down
11 changes: 7 additions & 4 deletions lib/libzrepl/data_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ zio_cmd_alloc(zvol_io_hdr_t *hdr, int fd)
(hdr->opcode == ZVOL_OPCODE_WRITE) ||
(hdr->opcode == ZVOL_OPCODE_OPEN)) {
zio_cmd->buf = kmem_zalloc(sizeof (char) * hdr->len, KM_SLEEP);
zio_cmd->buf_len = hdr->len;
}

zio_cmd->conn = fd;
Expand All @@ -81,7 +82,7 @@ zio_cmd_free(zvol_io_cmd_t **cmd)
case ZVOL_OPCODE_WRITE:
case ZVOL_OPCODE_OPEN:
if (zio_cmd->buf != NULL) {
kmem_free(zio_cmd->buf, zio_cmd->hdr.len);
kmem_free(zio_cmd->buf, zio_cmd->buf_len);
}
break;

Expand Down Expand Up @@ -260,11 +261,13 @@ uzfs_zvol_worker(void *arg)
read_metadata = hdr->flags & ZVOL_OP_FLAG_READ_METADATA;

/*
* Why to delay offline activity ? anyway
* we are not going to ACK these IOs
* For rebuild case, do not free zio_cmd
*/
if (zinfo->state == ZVOL_INFO_STATE_OFFLINE) {
zio_cmd_free(&zio_cmd);
hdr->status = ZVOL_OP_STATUS_FAILED;
hdr->len = 0;
if (!(rebuild_cmd_req && (hdr->opcode == ZVOL_OPCODE_WRITE)))
zio_cmd_free(&zio_cmd);
goto drop_refcount;
}

Expand Down