diff options
author | Alexander Motin <mav@FreeBSD.org> | 2020-07-28 22:32:50 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2020-07-28 22:32:50 +0000 |
commit | 3b11655c7efbd5b0877cd9a64fc395b9acf57db3 (patch) | |
tree | 3d1c51b6e3e333cf37504c09b7679843e73622e1 /usr.sbin/ctld | |
parent | 3008333d442f4daf0318cb1d249240e086208d68 (diff) | |
download | src-test2-3b11655c7efbd5b0877cd9a64fc395b9acf57db3.tar.gz src-test2-3b11655c7efbd5b0877cd9a64fc395b9acf57db3.zip |
When modifying LUN pass "special" options too.
Before switching to nvlists CTL merged previous and new options, so
any options not passed just kept previous value. Now CTL completely
replaces them, so we must pass everything still relevant.
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Notes
Notes:
svn path=/head/; revision=363656
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r-- | usr.sbin/ctld/kernel.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index 4da7c05f1e66..ed8d46d27a0e 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -777,6 +777,30 @@ kernel_lun_modify(struct lun *lun) req.reqdata.modify.lun_id = lun->l_ctl_lun; req.reqdata.modify.lun_size_bytes = lun->l_size; + if (lun->l_path != NULL) { + o = option_find(&lun->l_options, "file"); + if (o != NULL) { + option_set(o, lun->l_path); + } else { + o = option_new(&lun->l_options, "file", lun->l_path); + assert(o != NULL); + } + } + + o = option_find(&lun->l_options, "ctld_name"); + if (o != NULL) { + option_set(o, lun->l_name); + } else { + o = option_new(&lun->l_options, "ctld_name", lun->l_name); + assert(o != NULL); + } + + o = option_find(&lun->l_options, "scsiname"); + if (o == NULL && lun->l_scsiname != NULL) { + o = option_new(&lun->l_options, "scsiname", lun->l_scsiname); + assert(o != NULL); + } + if (!TAILQ_EMPTY(&lun->l_options)) { req.args_nvl = nvlist_create(0); if (req.args_nvl == NULL) { |