Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 2014 11:06:45 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264534 - head/usr.sbin/ctld
Message-ID:  <201404161106.s3GB6jRb077726@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Wed Apr 16 11:06:45 2014
New Revision: 264534
URL: http://svnweb.freebsd.org/changeset/base/264534

Log:
  If we fail to create LUN, try again on next configuration reload.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/ctld.c

Modified: head/usr.sbin/ctld/ctld.c
==============================================================================
--- head/usr.sbin/ctld/ctld.c	Wed Apr 16 11:05:57 2014	(r264533)
+++ head/usr.sbin/ctld/ctld.c	Wed Apr 16 11:06:45 2014	(r264534)
@@ -1222,6 +1222,13 @@ conf_apply(struct conf *oldconf, struct 
 		}
 	}
 
+	/*
+	 * 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 
 	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 
 			if (error != 0) {
 				log_warnx("failed to add lun %d, target %s",
 				    newlun->l_lun, newtarg->t_name);
+				lun_delete(newlun);
 				cumulated_error++;
 			}
 		}



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