diff options
author | mav <mav@FreeBSD.org> | 2015-10-05 08:52:37 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-10-05 08:52:37 +0000 |
commit | 3f61db5756a866fb4ec6b09cacd0ccbce7410361 (patch) | |
tree | d369d267fc93dd2f4f997f191e4630af47e29402 /sys/cam/ctl/ctl_backend_block.c | |
parent | c060972cd4ad911e494f964ecbd92d6c4ffd0f10 (diff) | |
download | FreeBSD-src-3f61db5756a866fb4ec6b09cacd0ccbce7410361.zip FreeBSD-src-3f61db5756a866fb4ec6b09cacd0ccbce7410361.tar.gz |
MFC r287500: Allow LUN options modification via CTL_LUNREQ_MODIFY.
Not all changes take effect, but that is a different question.
Diffstat (limited to 'sys/cam/ctl/ctl_backend_block.c')
-rw-r--r-- | sys/cam/ctl/ctl_backend_block.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 2d5a47f..7fd15b9 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -2437,9 +2437,6 @@ ctl_be_block_rm(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) params = &req->reqdata.rm; mtx_lock(&softc->lock); - - be_lun = NULL; - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->cbe_lun.lun_id == params->lun_id) break; @@ -2603,13 +2600,13 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) { struct ctl_lun_modify_params *params; struct ctl_be_block_lun *be_lun; + struct ctl_be_lun *cbe_lun; uint64_t oldsize; int error; params = &req->reqdata.modify; mtx_lock(&softc->lock); - be_lun = NULL; STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->cbe_lun.lun_id == params->lun_id) break; @@ -2622,8 +2619,11 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) params->lun_id); goto bailout_error; } + cbe_lun = &be_lun->cbe_lun; - be_lun->params.lun_size_bytes = params->lun_size_bytes; + if (params->lun_size_bytes != 0) + be_lun->params.lun_size_bytes = params->lun_size_bytes; + ctl_update_opts(&cbe_lun->options, req->num_be_args, req->kern_be_args); oldsize = be_lun->size_blocks; if (be_lun->vn == NULL) @@ -2636,11 +2636,11 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) error = EINVAL; if (be_lun->size_blocks != oldsize) - ctl_lun_capacity_changed(&be_lun->cbe_lun); - if ((be_lun->cbe_lun.flags & CTL_LUN_FLAG_OFFLINE) && + ctl_lun_capacity_changed(cbe_lun); + if ((cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) && be_lun->vn != NULL) { - be_lun->cbe_lun.flags &= ~CTL_LUN_FLAG_OFFLINE; - ctl_lun_online(&be_lun->cbe_lun); + cbe_lun->flags &= ~CTL_LUN_FLAG_OFFLINE; + ctl_lun_online(cbe_lun); } /* Tell the user the exact size we ended up using */ |