From owner-svn-src-head@freebsd.org Mon Aug 3 17:56:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ABD69B2122; Mon, 3 Aug 2015 17:56:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 4590C10A3; Mon, 3 Aug 2015 17:56:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id UAA26351; Mon, 03 Aug 2015 20:56:13 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1ZMJy8-000Bw5-Kz; Mon, 03 Aug 2015 20:56:13 +0300 Message-ID: <55BFAAEB.2020900@FreeBSD.org> Date: Mon, 03 Aug 2015 20:54:51 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Edward Tomasz Napierala , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r286234 - head/sys/boot/common References: <201508031627.t73GRbTB092225@repo.freebsd.org> In-Reply-To: <201508031627.t73GRbTB092225@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2015 17:56:17 -0000 On 03/08/2015 19:27, Edward Tomasz Napierala wrote: > Author: trasz > Date: Mon Aug 3 16:27:36 2015 > New Revision: 286234 > URL: https://svnweb.freebsd.org/changeset/base/286234 > > Log: > Fix a problem which made loader(8) load non-kld files twice. What was the problem? The change looks like defensive coding, but it's not clear why the loader would attempt to load the same file more than once in the first place. > For example, without this patch, the following three lines > in /boot/loader.conf would result in /boot/root.img being preloaded > twice, and two md(4) devices - md0 and md1 - being created. > > initmd_load="YES" > initmd_type="md_image" > initmd_name="/boot/root.img" > > Reviewed by: marcel@ > MFC after: 1 month > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D3204 > > Modified: > head/sys/boot/common/module.c > > Modified: head/sys/boot/common/module.c > ============================================================================== > --- head/sys/boot/common/module.c Mon Aug 3 14:58:46 2015 (r286233) > +++ head/sys/boot/common/module.c Mon Aug 3 16:27:36 2015 (r286234) > @@ -102,6 +102,7 @@ COMMAND_SET(load, "load", "load a kernel > static int > command_load(int argc, char *argv[]) > { > + struct preloaded_file *fp; > char *typestr; > int dofile, dokld, ch, error; > > @@ -139,6 +140,13 @@ command_load(int argc, char *argv[]) > command_errmsg = "invalid load type"; > return(CMD_ERROR); > } > + > + fp = file_findfile(argv[1], typestr); > + if (fp) { > + sprintf(command_errbuf, "warning: file '%s' already loaded", argv[1]); > + return (CMD_ERROR); > + } > + > return (file_loadraw(argv[1], typestr, 1) ? CMD_OK : CMD_ERROR); > } > /* > -- Andriy Gapon