Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Mar 2014 11:58:24 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r263718 - stable/10/usr.sbin/ctld
Message-ID:  <201403251158.s2PBwOEh064573@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue Mar 25 11:58:24 2014
New Revision: 263718
URL: http://svnweb.freebsd.org/changeset/base/263718

Log:
  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

Modified:
  stable/10/usr.sbin/ctld/ctld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/ctld.c
==============================================================================
--- stable/10/usr.sbin/ctld/ctld.c	Tue Mar 25 11:53:47 2014	(r263717)
+++ stable/10/usr.sbin/ctld/ctld.c	Tue Mar 25 11:58:24 2014	(r263718)
@@ -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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403251158.s2PBwOEh064573>