From owner-svn-src-all@FreeBSD.ORG Wed May 7 07:43:13 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8DF7B35E; Wed, 7 May 2014 07:43:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A90A1B7; Wed, 7 May 2014 07:43:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s477hDx3024662; Wed, 7 May 2014 07:43:13 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s477hDuR024661; Wed, 7 May 2014 07:43:13 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201405070743.s477hDuR024661@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 7 May 2014 07:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r265518 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 May 2014 07:43:13 -0000 Author: trasz Date: Wed May 7 07:43:13 2014 New Revision: 265518 URL: http://svnweb.freebsd.org/changeset/base/265518 Log: MFC r264534: If we fail to create LUN, try again on next configuration reload. 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 Wed May 7 07:42:47 2014 (r265517) +++ stable/10/usr.sbin/ctld/ctld.c Wed May 7 07:43:13 2014 (r265518) @@ -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++; } }