Re: svn commit: r286234 - head/sys/boot/common

2016-01-13 Thread Oliver Pinter
On Wednesday, January 13, 2016, Edward Tomasz Napierala 
wrote:

> On 0107T2033, Oliver Pinter wrote:
> > On Mon, Aug 3, 2015 at 6:27 PM, 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.
> > >
> > >   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
> >
> > Do you still plan to MFC this commit to 10-STABLE / 10.3?
>
> That was the plan, yeah, but I cannot reproduce the problem on 10-STABLE.
> Can you?
>
>
Not yet tested this scenario, I just remembered to this commit was marked
to MFC,  but not MFCd.
When I have more time, I try to reproduce the issue.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r286234 - head/sys/boot/common

2016-01-13 Thread Edward Tomasz Napierala
On 0107T2033, Oliver Pinter wrote:
> On Mon, Aug 3, 2015 at 6:27 PM, 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.
> >
> >   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
> 
> Do you still plan to MFC this commit to 10-STABLE / 10.3?

That was the plan, yeah, but I cannot reproduce the problem on 10-STABLE.
Can you?

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r286234 - head/sys/boot/common

2016-01-07 Thread Oliver Pinter
On Mon, Aug 3, 2015 at 6:27 PM, 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.
>
>   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

Do you still plan to MFC this commit to 10-STABLE / 10.3?


>   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;
>  intdofile, 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);
>  }
>  /*
> ___
> svn-src-head@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r286234 - head/sys/boot/common

2015-08-04 Thread Edward Tomasz Napierala
On 0803T2054, Andriy Gapon wrote:
 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.

It's because the load_modules Forth word gets called twice.  It could
be fixed, I guess, but I'm no good at Forth, so I chose the other
way: I made the load command behave consistently; it already silently
refused to load KLDs twice, and I made it behave the same way for other
types of modules.

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r286234 - head/sys/boot/common

2015-08-04 Thread Alexey Dokuchaev
On Mon, Aug 03, 2015 at 08:54:51PM +0300, Andriy Gapon wrote:
 On 03/08/2015 19:27, Edward Tomasz Napierala wrote:
  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.

Seconded; it would be nice to know which commit had intriduced the issue,
to make it easier for review and understand which stable branches need MFC.

./danfe
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286234 - head/sys/boot/common

2015-08-03 Thread Edward Tomasz Napierala
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.
  
  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;
 intdofile, 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);
 }
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r286234 - head/sys/boot/common

2015-08-03 Thread NGie Cooper
On Mon, Aug 3, 2015 at 10:54 AM, Andriy Gapon a...@freebsd.org wrote:
 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.

Repro was something like this IIRC:

- Start module load.
- Hit a key to interrupt the boot so it drops into the loader prompt.
- Hit boot again.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r286234 - head/sys/boot/common

2015-08-03 Thread Andriy Gapon
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
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org