diff options
author | trasz <trasz@FreeBSD.org> | 2014-03-25 11:58:24 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-03-25 11:58:24 +0000 |
commit | 930438f7d5ffcf8c643bbd387b7f80615f3fdaa9 (patch) | |
tree | bd9af15c8064ef06c9a39ebf5bba511088933ddf /usr.sbin | |
parent | 57c5c942747cfe2cf61d45c980875c58189866b1 (diff) | |
download | FreeBSD-src-930438f7d5ffcf8c643bbd387b7f80615f3fdaa9.zip FreeBSD-src-930438f7d5ffcf8c643bbd387b7f80615f3fdaa9.tar.gz |
MFC r261750:
Improve check for duplicated paths. It shows the warning twice for every
path (once for each duplicate found), but it should do for now.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ctld/ctld.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 8e0d200..4088811 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -873,6 +873,7 @@ static int conf_verify_lun(struct lun *lun) { const struct lun *lun2; + const struct target *targ2; if (lun->l_backend == NULL) lun_set_backend(lun, "block"); @@ -901,16 +902,6 @@ conf_verify_lun(struct lun *lun) lun->l_target->t_iqn); return (1); } -#if 1 /* Should we? */ - TAILQ_FOREACH(lun2, &lun->l_target->t_luns, l_next) { - if (lun == lun2) - continue; - if (lun->l_path != NULL && lun2->l_path != NULL && - strcmp(lun->l_path, lun2->l_path) == 0) - log_debugx("WARNING: duplicate path for lun %d, " - "target \"%s\"", lun->l_lun, lun->l_target->t_iqn); - } -#endif if (lun->l_blocksize == 0) { lun_set_blocksize(lun, DEFAULT_BLOCKSIZE); } else if (lun->l_blocksize < 0) { @@ -924,6 +915,20 @@ conf_verify_lun(struct lun *lun) lun->l_target->t_iqn); return (1); } + TAILQ_FOREACH(targ2, &lun->l_target->t_conf->conf_targets, t_next) { + TAILQ_FOREACH(lun2, &targ2->t_luns, l_next) { + if (lun == lun2) + continue; + if (lun->l_path != NULL && lun2->l_path != NULL && + strcmp(lun->l_path, lun2->l_path) == 0) { + log_debugx("WARNING: path \"%s\" duplicated " + "between lun %d, target \"%s\", and " + "lun %d, target \"%s\"", lun->l_path, + lun->l_lun, lun->l_target->t_iqn, + lun2->l_lun, lun2->l_target->t_iqn); + } + } + } return (0); } |