summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-05-07 07:43:13 +0000
committertrasz <trasz@FreeBSD.org>2014-05-07 07:43:13 +0000
commit854e04966d12491fc82327e77ee99e4eb3c88fb0 (patch)
treefbf6723b9d6509d3fdc1b3dc0653d795f6fe3b85 /usr.sbin/ctld
parentdb043740d7933d51fc3d415d948b87cf049ef254 (diff)
downloadFreeBSD-src-854e04966d12491fc82327e77ee99e4eb3c88fb0.zip
FreeBSD-src-854e04966d12491fc82327e77ee99e4eb3c88fb0.tar.gz
MFC r264534:
If we fail to create LUN, try again on next configuration reload. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r--usr.sbin/ctld/ctld.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index 947e4d2..3300d53 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -1222,6 +1222,13 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
}
}
+ /*
+ * XXX: If target or lun removal fails, we should somehow "move"
+ * the old lun or target into newconf, so that subsequent
+ * conf_apply() will try to remove them again. That would
+ * be somewhat hairy, and lun deletion doesn't really happen,
+ * so leave it as it is for now.
+ */
TAILQ_FOREACH_SAFE(oldtarg, &oldconf->conf_targets, t_next, tmptarg) {
/*
* First, remove any targets present in the old configuration
@@ -1344,7 +1351,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
TAILQ_FOREACH(newtarg, &newconf->conf_targets, t_next) {
oldtarg = target_find(oldconf, newtarg->t_name);
- TAILQ_FOREACH(newlun, &newtarg->t_luns, l_next) {
+ TAILQ_FOREACH_SAFE(newlun, &newtarg->t_luns, l_next, tmplun) {
if (oldtarg != NULL) {
oldlun = lun_find(oldtarg, newlun->l_lun);
if (oldlun != NULL) {
@@ -1376,6 +1383,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
if (error != 0) {
log_warnx("failed to add lun %d, target %s",
newlun->l_lun, newtarg->t_name);
+ lun_delete(newlun);
cumulated_error++;
}
}
OpenPOWER on IntegriCloud